efcore.pg
efcore.pg copied to clipboard
migration on changed includedPropertyNames for IsGeneratedTsVectorColumn creates up/down code in wrong order
My entity setup has this code:
entityBuilder.Property<NpgsqlTsVector>(AllTextColumnsFullTextComputedColumnName) .IsGeneratedTsVectorColumn(FullTextDictionaryName, FieldsIncludedInFullTextColumn);
where FieldsIncludedInFullTextColumn
is a string[].
Now I added a new string property to the entity and added the name as the last entry to FieldsIncludedInFullTextColumn
.
Now the migration created by add-migration
powershell script does this in Up method:
-
migrationBuilder.AlterColumn<NpgsqlTsVector>(... // referencing column name of step2
-
migrationBuilder.AddColumn<string>(...
And so the resulting SQL is also in wrong order:
- drop tsvector column
- recreate tsvector column referencing column which gets created in step 3
- create text column needed for step 2
Same problem with Down method, just in inverse order.