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

Auto migrations ignore primary key changes #2262

Open
kazimuth opened this issue Feb 14, 2025 · 1 comment
Open

Auto migrations ignore primary key changes #2262

kazimuth opened this issue Feb 14, 2025 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@kazimuth
Copy link
Contributor

kazimuth commented Feb 14, 2025

This is wrong.

You can't add a #[unique] column so that's fine -- #[primary_key] is implemented as adding a #[unique] constraint plus setting a primary key field on the TableDef. The #[unique] constraint is checked for but the primary key field ignored. This means that if you remove a #[primary_key] annotation -- the primary key will be removed in the ModuleDef but not in the system tables, I think.

@kazimuth kazimuth added the bug Something isn't working label Feb 14, 2025
@kazimuth kazimuth self-assigned this Feb 14, 2025
@gefjon
Copy link
Contributor

gefjon commented Feb 17, 2025

I would expect it to be valid to transition between #[unique] and #[primary_key], though I don't feel strongly.

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

2 participants