Skip to content
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

[BUG] Default sequelize schema ids conflict with primary keys #100

Open
Michael-Vol opened this issue Mar 30, 2022 · 0 comments
Open

[BUG] Default sequelize schema ids conflict with primary keys #100

Michael-Vol opened this issue Mar 30, 2022 · 0 comments
Labels
bug Something isn't working

Comments

@Michael-Vol
Copy link
Contributor

Describe the bug
Currently, the sequelize schema adds a default uuid (_id) as a primary key to the model. In case the user provides a database for introspection and the tables have already a primary key, there will be a conflict between that primary key and the _id we are trying to add to the schema.
We need to keep both ids though, since Conduit uses the _id for any queries related to that model.
One possible solution would be to change the _id from primary key to virtual, however sequelize currently doesn't support converting the virtual datatype into the sql equivalent (see sequelize/sequelize#12451).

To Reproduce

  1. Start the database module with an existing database connection in the envs
  2. Notice that the database won't sync because of the virtual field is not defined.

Expected Behavior
The database module should introspect the db by keeping both it's already defined primary key and adding the conduit _id used for future queries.

@Michael-Vol Michael-Vol added the bug Something isn't working label Mar 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant