EF Core move column data from table to another while migration (UP)

c# ef-migrations ef-model-builder entity-framework-core

Accepted Answer

within theUp() Using the migration technique, you may create your own SQL queries.migrationBuilder.Sql() I would typically manage data migration from one column to another, or in this example between tables, using the function.

Keep in mind that things happen in a certain sequence, thus you would need to run the SQL between adding a column and deleting another.

Both for safety's sake and to make the system backwards compatibleDown() You should also add the SQL that does the opposite so that you can always go back in the future.

1
10/24/2019 8:47:57 AM

Popular Answer

ZZZ_tmp


Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow