New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support orUpdate for SQLite #4097
Conversation
@@ -249,7 +249,7 @@ export class InsertQueryBuilder<Entity> extends QueryBuilder<Entity> { | |||
if (statement && statement.overwrite instanceof Array) { | |||
if (this.connection.driver instanceof MysqlDriver) { | |||
this.expressionMap.onUpdate.overwrite = statement.overwrite.map(column => `${column} = VALUES(${column})`).join(", "); | |||
} else if (this.connection.driver instanceof PostgresDriver) { | |||
} else if (this.connection.driver instanceof PostgresDriver || this.connection.driver instanceof AbstractSqliteDriver) { | |||
this.expressionMap.onUpdate.overwrite = statement.overwrite.map(column => `${column} = EXCLUDED.${column}`).join(", "); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hm so confusing, is it onUpdate or orUpdate? Looks like second, not sure who named it onUpdate before then.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I could take advantage of this PR and change the key within expressionMap
to orUpdate
if you see it ok.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we can left it as it is right now, and change it later (do it if you want), I just commented on what confused me...
@pleerock I want to mean SQLite doesn't seem to support Typeorm's |
I'm not sure if the error in CI is related with this PR (the last commit was only to solve the conflict in the Changelog file). Error message
|
@emibloque its not your fault sometimes it hangs. |
Looks like okay to merge it @Kononnable |
Sumary
This PR adds support of
QueryBuilder
'sorUpdate
for SQLite.Issue
This closes issue #4096
Background
In PR #3056, support for
ON CONFLICT
was added for MySQL and Postgres when usingorUpdate
, and in this PR #3190 support for PostgresonConflict
was added for SQLite as they have the same syntax.