Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -640,7 +640,7 @@ protected virtual void Generate(AlterColumnOperation operation, IndentedStringBu
.Append("oldComputedColumnSql: ")
.Append(Code.Literal(operation.OldColumn.ComputedColumnSql));

if (operation.IsStored != null)
if (operation.OldColumn.IsStored != null)
{
builder
.AppendLine(",")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -633,6 +633,37 @@ public void AlterColumnOperation_all_args()
Assert.Equal("Some Collation", o.OldColumn.Collation);
});

[Fact]
public void AlterColumnOperation_computed_to_non_computed_preserves_oldStored()
=> Test(
new AlterColumnOperation
{
Name = "Id",
Table = "Post",
ClrType = typeof(int),
OldColumn =
{
ComputedColumnSql = "1",
IsStored = true
}
},
"""
mb.AlterColumn<int>(
name: "Id",
table: "Post",
nullable: false,
oldComputedColumnSql: "1",
oldStored: true);
""",
o =>
{
Assert.Equal("Id", o.Name);
Assert.Equal("Post", o.Table);
Assert.Equal(typeof(int), o.ClrType);
Assert.Equal("1", o.OldColumn.ComputedColumnSql);
Assert.True(o.OldColumn.IsStored);
});

[Fact]
public void AlterColumnOperation_DefaultValueSql()
=> Test(
Expand Down
Loading