-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Change WorkflowStatus column as int #18369
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
base: main
Are you sure you want to change the base?
Conversation
await SchemaBuilder.AlterIndexTableAsync<WorkflowIndex>(table => | ||
{ | ||
table.AddColumn<string>("WorkflowStatus"); | ||
table.AddColumn<int>("WorkflowStatus"); |
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.
You have to create a new version for altering the table. I.e. create a new method UpdateFrom3Async
etc.
This reverts commit bd8c7d5.
Co-authored-by: Hisham Bin Ateya <[email protected]>
Co-authored-by: Hisham Bin Ateya <[email protected]>
Co-authored-by: Hisham Bin Ateya <[email protected]>
await SchemaBuilder.AlterIndexTableAsync<WorkflowIndex>(table => | ||
{ | ||
// Drop the existing column (if it exists) | ||
table.DropColumn("WorkflowStatus"); |
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.
What if the actual table contains data in the WorkflowStatus
column?
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.
Maybe admin should export the data to recipe to deal with it.
but OC deal with the data in the similar way:
// SqLite does not support dropping columns.
try
{
await SchemaBuilder.AlterIndexTableAsync(table => table
.DropColumn("Time"));
await SchemaBuilder.AlterIndexTableAsync<TimeFieldIndex>(table => table
.AddColumn<TimeSpan>("Time", column => column.Nullable()));
}
catch
{
_logger.LogWarning("Failed to alter 'Time' column. This is not an error when using SqLite");
}
Co-authored-by: Hisham Bin Ateya <[email protected]>
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.
@sebastienros Is changing the column type like done here and in
OrchardCore/src/OrchardCore.Modules/OrchardCore.ContentFields/Indexing/SQL/Migrations.cs
Lines 784 to 796 in 22203ea
// SqLite does not support dropping columns. | |
try | |
{ | |
await SchemaBuilder.AlterIndexTableAsync<TimeFieldIndex>(table => table | |
.DropColumn("Time")); | |
await SchemaBuilder.AlterIndexTableAsync<TimeFieldIndex>(table => table | |
.AddColumn<TimeSpan>("Time", column => column.Nullable())); | |
} | |
catch | |
{ | |
_logger.LogWarning("Failed to alter 'Time' column. This is not an error when using SqLite"); | |
} |
actually a good idea?
"CreatedUtc") | ||
); | ||
|
||
return 4; |
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.
The Create
method should always return the latest version (and contain the latest changes as well).
Fix #18301