public void CreateAllObjects(IDatabaseSource conn, ISqlDumper dmp, ISqlDialect dialect) { var dbmem = new DatabaseStructureMembers { TableList = true, TableMembers = TableStructureMembers.AllNoRefs, DomainList = true, DomainDetails = true, SpecificObjectList = true, SpecificObjectDetails = true, LoadDependencies = true, IgnoreSystemObjects = true, }; var dbs = new DatabaseStructure(conn.InvokeLoadStructure(dbmem, null)); var props = new CreateDatabaseObjectsProps { CreateDomains = Domains, CreateFixedData = FixedData, CreateSchemata = Schemata, CreateSpecificObjects = SpecificObjects, CreateTables = Tables }; IMigrationProfile profile = dialect.CreateMigrationProfile(); dialect.MigrateDatabase(dbs, profile, null); dmp.CreateDatabaseObjects(dbs, props); }
public void GenerateDropAllTables(IDatabaseSource conn, ISqlDumper dmp, ISqlDialect dialect) { DatabaseStructureMembers dbmem = new DatabaseStructureMembers { TableList = true, TableMembers = TableStructureMembers.ForeignKeys, IgnoreSystemObjects = true, }; var dbs = new DatabaseStructure(conn.InvokeLoadStructure(dbmem, null)); IMigrationProfile profile = dialect.CreateMigrationProfile(); dialect.MigrateDatabase(dbs, profile, null); foreach (ITableStructure tbl in dbs.Tables) { if (conn.Dialect.IsSystemTable(tbl.FullName)) { continue; } foreach (IForeignKey fk in tbl.GetConstraints <IForeignKey>()) { dmp.DropConstraint(fk); } } foreach (ITableStructure tbl in dbs.Tables) { if (conn.Dialect.IsSystemTable(tbl.FullName)) { continue; } dmp.DropTable(tbl, DropFlags.None); } }
public void GenerateFillTable(ITableSource table, ISqlDumper dmp, ISqlDialect dialect) { IMigrationProfile profile = dialect.CreateMigrationProfile(); var tbl = new TableStructure(table.InvokeLoadStructure(TableStructureMembers.AllNoRefs)); dialect.MigrateTable(tbl, profile, null); GenerateFillTable(tbl, dmp); }
public override void GenerateSql(IDatabaseSource db, FullDatabaseRelatedName objname, ISqlDumper dmp, ISqlDialect dialect) { IMigrationProfile profile = dialect.CreateMigrationProfile(); var tbl = new TableStructure(db.GetTable(objname.ObjectName).InvokeLoadStructure(TableStructureMembers.AllNoRefs)); dialect.MigrateTable(tbl, profile, null); InsertTemplate(tbl, dmp, dialect); }
public static IMigrationProfile GetDefaultMigrationProfile(this ISqlDialect dialect) { lock (m_migrationProfileCache) { var res = m_migrationProfileCache.Get(dialect.DialectName, null); if (res == null) { res = dialect.CreateMigrationProfile(); m_migrationProfileCache[dialect.DialectName] = res; } return(res); } }
public void CreateReferences(IDatabaseSource conn, ISqlDumper dmp, ISqlDialect dialect) { var dbmem = new DatabaseStructureMembers { TableList = true, TableMembers = TableStructureMembers.AllNoRefs, IgnoreSystemObjects = true, }; var dbs = new DatabaseStructure(conn.InvokeLoadStructure(dbmem, null)); IMigrationProfile profile = dialect.CreateMigrationProfile(); dialect.MigrateDatabase(dbs, profile, null); CreateReferences(dmp, dbs); }
public void CreateDomains(IDatabaseSource conn, ISqlDumper dmp, ISqlDialect dialect) { var dbmem = new DatabaseStructureMembers { DomainDetails = true, DomainList = true, IgnoreSystemObjects = true, }; var dbs = new DatabaseStructure(conn.InvokeLoadStructure(dbmem, null)); IMigrationProfile profile = dialect.CreateMigrationProfile(); dialect.MigrateDatabase(dbs, profile, null); CreateDomains(dmp, dbs); }
public void FillAllTables(IDatabaseSource conn, ISqlDumper dmp, ISqlDialect dialect) { var dbmem = new DatabaseStructureMembers { TableList = true, TableMembers = TableStructureMembers.Columns, }; var dbs = new DatabaseStructure(conn.InvokeLoadStructure(dbmem, null)); IMigrationProfile profile = dialect.CreateMigrationProfile(); dialect.MigrateDatabase(dbs, profile, null); foreach (var tbl in dbs.Tables) { GenerateFillTable(tbl, dmp); } }
public virtual IMigrationProfile CreateMigrationProfile() { return(m_dialect.CreateMigrationProfile()); }