Code First Migrations Help
Posted: Thu 05 Mar 2015 16:14
We are using EF's code first migrations to update our database and I have ran into some issues with some edge cases and was wondering if there was currently any work around.
The main issues we are having are:
- The generated index names are too long
- The generated foreign key names are too long
- Not able to specify default values, default attribute is not picked up by the generator
I was not able to find any support for any of these other than modifying the generated migration classes, the issue with this is that if we delete the migration and regenerate it then all that work was lost, we have a rather large database the initial create of the database took over 6 hours to rename all the indexes and foreign keys.
I was hoping there is someway to extend the PgSqlEntityMigrationSqlGenerator class to be able to achieve this. I know these are all constraints with EF's migrations I was just wondering if there was a way to extend the SqlGenerator to include these features myself.
Thanks,
The main issues we are having are:
- The generated index names are too long
- The generated foreign key names are too long
- Not able to specify default values, default attribute is not picked up by the generator
I was not able to find any support for any of these other than modifying the generated migration classes, the issue with this is that if we delete the migration and regenerate it then all that work was lost, we have a rather large database the initial create of the database took over 6 hours to rename all the indexes and foreign keys.
I was hoping there is someway to extend the PgSqlEntityMigrationSqlGenerator class to be able to achieve this. I know these are all constraints with EF's migrations I was just wondering if there was a way to extend the SqlGenerator to include these features myself.
Thanks,