vapor/sql-kit

SQLInsertBuilder and SQLUpdateBuilder do not expose the ignore flag

0xTim opened this issue · 2 comments

0xTim commented

While it is possible to issue an INSERT IGNORE (or other database equivalent) query at the Fluent level using Model.create(orIgnore:on:), it is not possible to issue the same query at the SQL level using SQLInsertBuilder - one must build the appropriate SQLInsert object manually or use a raw query. Once Fluent supports UPDATE IGNORE, a similar issue will exist for SQLUpdateBuilder as well. The best API for this is probably a simple public func ignore(_ flag: Bool = true) -> Self function on both builders.

Looks like the syntax for this varies a bit between SQLs.

I'm not 100% sure whether that PostgreSQL syntax actually has the same functionality. Either way, this seems like it will need to be added to the DB packages individually similar to the ALTER TABLE query and other stuff.

Duplicate of #31