-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
Migrations: CHECK enum columns #15411
Comments
hi @AndriySvyryd, Could you tell me which file i can add this CHECK? |
This is about adding a CHECK constraint to enum columns e.g.: mycol VARCHAR(10) NOT NULL CHECK (mycol IN('Useful', 'Useless', 'Unknown')) The easiest way of doing this is by adding a SqlServer convention (IModelFinalizedConvention) that calls |
Find below my solution in the form of test case. Will it serve the purpose? Please add your comments.
|
@SARAVANA1501 Not quite, this should happen without needing to call |
SqlServerEnumConstraintConvention Please review the convention, and guide me to register it with other conventions, Thanks. |
You are heading in the right direction.
ConventionSet.AddBefore(
conventionSet.ModelFinalizedConventions,
new SqlServerEnumConvention(),
typeof(ValidatingConvention));
I'll give further feedback on the PR |
Fixed in e17584c |
No description provided.
The text was updated successfully, but these errors were encountered: