-
Notifications
You must be signed in to change notification settings - Fork 2
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
Execute DDL - Ecto.Adapters.SQL.Connection #44
Comments
When creating a table, we can add the cid primary key to the columns to create, then forward the modified request on to the Postgres adapter. But what do we want to do if the user has already specified a primary key in their creation table. Do we raise an error, or do we create a composite primary key, which is the default when multiple columns are marked as the pk? |
Raising an error might be a good first step if a primary key is defined by the user. As you mention on the standup we can later on if necessary create a new primary key by combining the cid and the primary key created by the user. |
The only thing left to do for this function is to add a unique index for cid when a table is created (see #45 (comment)). Not sure exactly the best way to go about that yet, need to look into it a bit more. |
Part of #38
https://hexdocs.pm/ecto_sql/Ecto.Adapters.SQL.Connection.html#c:execute_ddl/1
This is the function we use to run migrations. The existing implementation of this has multiple function clauses, so it's likely that we can use some of them, and override others.
It's here that we can ensure certain columns are added to tables when they're created, as well as defining the cid as the primary key.
The text was updated successfully, but these errors were encountered: