efcore icon indicating copy to clipboard operation
efcore copied to clipboard

Default columns of __EFMigrationsHistory

Open ichensky opened this issue 7 years ago • 2 comments

Proposal: change default columns of __EFMigrationsHistory table to:

Id, MigrationName, MigrationSource, Created

Where Id - hash (for ex. sha1) from MigrationSource MigrationName - name of migration. MigrationSource - sql representation of migration. Created - date, when migration was applied to database.

With this columns, it would be possible

  • See what migrations were applied, without having source code (so this will be good for admins, that have no access to the source code).
  • Apply same migration several times.
  • By Id hash developer will always know what migration was and when applied even if MigrationSource not included into database by security restrictions.
  • Migrations can have the same names, but with different source code, of different names with the same source code.

ichensky avatar Jan 15 '19 07:01 ichensky

@bricelam to follow up.

ajcvickers avatar Jan 16 '19 19:01 ajcvickers

This sounds like too fundamental of a change for us to consider. Applications, however, are free to add columns to the history table. See Custom Migrations History Table. With this, you could achieve most of what you propose.

Note, issue #2532 is also about storing SQL (the down script) in the table.

We would still certainly consider improving the Migrations experience based on specific feedback from teams using Migrations. Our current approach has been used since 2011, and we haven't heard much feedback regarding the issues you've listed.

bricelam avatar Jan 16 '19 23:01 bricelam