I have project which is Multi-Tenant. So each tenant has their own database.
This project is database first, and I'm updating this to be a code-first solution.
Now I've reversed engineered the Context / model from the existing database by following the documentation on Microsoft Docs - https://learn.microsoft.com/en-us/ef/ef6/modeling/code-first/migrations/existing-database.
I've created an Empty Migration for all existing databases. But because the user(s) can create a tenant run-time of the application I need to Run the initial migration for all new Databases.
At the moment I've moved the initial database creation and initial seed data to an SQL File and I intend to call this Method in the initial Migration.
Something like this.
public partial class InitialCreate : DbMigration
{
public override void Up()
{
this.Sql(TBCompany_Scripts.CreateTBCompanyDB_TB5);
}
public override void Down()
{
}
}
How would I skip this script from running for all existing databases - but run for new databases? As they already have the tables, schemas and seed data.
