-
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
Apply fill factor when creating tables #33407
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -241,8 +241,6 @@ protected virtual void Generate( | |||||
|
||||||
PrimaryKeyConstraint(operation, model, builder); | ||||||
|
||||||
KeyWithOptions(operation, builder); | ||||||
|
||||||
if (terminate) | ||||||
{ | ||||||
builder.AppendLine(Dependencies.SqlGenerationHelper.StatementTerminator); | ||||||
|
@@ -269,8 +267,6 @@ protected virtual void Generate( | |||||
|
||||||
UniqueConstraint(operation, model, builder); | ||||||
|
||||||
KeyWithOptions(operation, builder); | ||||||
|
||||||
builder.AppendLine(Dependencies.SqlGenerationHelper.StatementTerminator); | ||||||
EndStatement(builder); | ||||||
} | ||||||
|
@@ -1622,6 +1618,8 @@ protected virtual void PrimaryKeyConstraint( | |||||
builder.Append("(") | ||||||
.Append(ColumnList(operation.Columns)) | ||||||
.Append(")"); | ||||||
|
||||||
KeyTraits(operation, model, builder); | ||||||
} | ||||||
|
||||||
/// <summary> | ||||||
|
@@ -1669,6 +1667,8 @@ protected virtual void UniqueConstraint( | |||||
builder.Append("(") | ||||||
.Append(ColumnList(operation.Columns)) | ||||||
.Append(")"); | ||||||
|
||||||
KeyTraits(operation, model, builder); | ||||||
} | ||||||
|
||||||
/// <summary> | ||||||
|
@@ -1717,12 +1717,13 @@ protected virtual void CheckConstraint( | |||||
} | ||||||
|
||||||
/// <summary> | ||||||
/// Generates a SQL fragment for extra with options of a key from a | ||||||
/// <see cref="AddPrimaryKeyOperation" /> or <see cref="AddUniqueConstraintOperation" />. | ||||||
/// Generates a SQL fragment for traits of an primary key or alternate key from a <see cref="CreateTableOperation" />, | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
/// <see cref="AddPrimaryKeyOperation" />, or <see cref="AddUniqueConstraintOperation" />. | ||||||
/// </summary> | ||||||
/// <param name="operation">The operation.</param> | ||||||
/// <param name="model">The target model which may be <see langword="null" /> if the operations exist without a model.</param> | ||||||
/// <param name="builder">The command builder to use to add the SQL fragment.</param> | ||||||
protected virtual void KeyWithOptions(MigrationOperation operation, MigrationCommandListBuilder builder) | ||||||
protected virtual void KeyTraits(MigrationOperation operation, IModel? model, MigrationCommandListBuilder builder) | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For sequence/index I thing we use the word "Options" rather than "Traits" There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This copies the pattern used for There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Note however, we call There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah, missed that we had IndexTraits, makes sense I guess (though not sure why we have options in some places and traits in others...) |
||||||
{ | ||||||
} | ||||||
|
||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Am not sure at all, but do we think unique constraints have common options/traits with primary keys? I thought e.g. fill factor is defined at the index level, rather than on the unique constraint (not sure).
Maybe it's better to be safe and make this a SQL Server-only thing rather than a relational thing?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know. @AndriySvyryd approved the original PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SQL Server supports most of the index options at the primary key level, don't know about other databases
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Basically, we don't need
KeyTraits
, just callIndexOptions
here. Only the relevant facets will be present on the operation.