-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
sql: sequelize support is blocked on stored procedures #12120
sql: sequelize support is blocked on stored procedures #12120
Comments
Because Sequelize ships with few dialects and it's going to take us a while to support stored procedures, the custom dialect seems like the fastest path to supporting Sequelize. So, is it possible to create a minimally hacky solution for patching the |
FYI http://dev.mysql.com/doc/refman/5.7/en/insert-on-duplicate.html Relevant quote: With |
Another option would be to submit a PR upstream to sequelize that would make the postgres dialect use |
The Postgres dialect for Sequelize uses a stored procedure to implement upserts, for compatibility with PostgreSQL before 9.5. CockroachDB has upsert but no stored procedures, so this monkey patch for the built-in Sequelize dialect replaces Sequelize's Model.upsert() with a version that uses `INSERT ... ON CONFLICT DO UPDATE SET`, which CockroachDB does support. require()ing the package multiple times should be fine, as `index.js` is idempotent. Note that tests will not pass until cockroachdb/cockroach#13962 is fixed. Resolves cockroachdb/cockroach#12120
Sequelize's
postgres
dialect currently uses stored procedures for all database updates: seeupsertQuery
.This is a pretty serious blocker to supporting Sequelize out of the box. As an alternative, we could consider creating a simple custom Sequelize dialect that simply overrides
upsertQuery
from thepostgres
dialect to do something without stored procedures.The text was updated successfully, but these errors were encountered: