-
-
Notifications
You must be signed in to change notification settings - Fork 15
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
Better constraints management in migrations #5
Comments
ColumnSchemaBuilder, which is new in 2.0.6, can also be changed to creare single column FK like following: $this->createTable('child', [
...
'parent_id' => $this->integer()->notNull()
->foreignKey('parent', 'id', 'RESTRICT', 'CASCADE'),
...
]); |
I’m working on PRs to solve this. |
Current status:
I expect 1—2 weeks to finish part 1 and make a PR depending my job’s schedule. |
Part 1 has arrived. |
Status update on part 2:
I expect 1–3 weeks to polish tests. Stay tuned. ;) |
Status update 2 on part 2:
|
Currently we have to specify foreign key name with both adding and dropping.
Some DBMS like MySQL generate it automatically, but the dropping part for me is more frustrating.
You have to look through all previous migrations and find the name of corresponding foreign key.
One solution will be following some convention and ask team members to follow it too, but it will be great if:
And foreign key will be found and dropped automatically.
That way developer only cares about relations and not names.
I think It can be applied to primary keys, indices, etc. too.
What do you think? Is it possible with DBMS?
Maybe use some naming convention if DBMS don't support auto generation? In this case we can build constraint name string depending on relations and add / drop it.
Funding
The text was updated successfully, but these errors were encountered: