There is an unsaved comment in progress. You will lose your changes if you continue. Are you sure you want to reopen the work item?
Migrations: Can't move history table after 5->6 upgrade
After upgrading an existing, migrations-enabled app from 5 to 6, moving the history table via HasDefaultSchema is broken. The issue is that we update the history table by
adding the new ContextKey column, rather than re-creating the table from scratch. This means that the ContextKey column appears last in the list of columns, rather than 2nd as is usually the case.
The issue manifests when we attempt to move the history table such as after a change via HasDefaultSchema. We generate an INSERT INTO Foo SELECT * FROM Bar to copy the data from the old history table to the new one. Because we are doing a select * rather than
explicitly specifying the columns, we end up attempting to insert the Model column into the ContextKey column of the new table, which throws a SQL data conversion error.