Skip to content

Conversation

@maumar
Copy link
Contributor

@maumar maumar commented May 9, 2025

Adding model builder API to allow specifying explicit constraint name when adding default value (sql) to a column. Also added switch on the model level (opt-in) to switch from system-generated constraints to generating them automatically by name and storing in the model. This is opt-in because we don't want to cause unnecessary migrations. Added de-duplication logic in the finalize model step, in case our generated names happen to clash with ones specified explicitly by user.

Also split temporal tables migration tests for SqlServer into a separate file - there were way to many tests in MigrationsSqlServerTest

Fixes #11502

@maumar
Copy link
Contributor Author

maumar commented May 9, 2025

sql server specific, still needs some cleanup (docs, error messages) - will use this as starting point to porting this feature to relational (and see about npg implementation). But saving SqlServer specific version in case port to relational doesn't work.

Adding model builder API to allow specifying explicit constraint name when adding default value (sql) to a column.
Also added switch on the model level (opt-in) to switch from system-generated constraints to generating them automatically by name and storing in the model.
This is opt-in because we don't want to cause unnecessary migrations.
Added de-duplication logic in the finalize model step, in case our generated names happen to clash with ones specified explicitly by user.

Also split temporal tables migration tests for SqlServer into a separate file - there were way to many tests in MigrationsSqlServerTest

Fixes #11502
@maumar
Copy link
Contributor Author

maumar commented May 12, 2025

closing in favor of #36067

@maumar maumar closed this May 12, 2025
@roji roji deleted the fix11502 branch January 5, 2026 17:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow to specify constraint name for default values

2 participants