Ejemplo n.º 1
0
        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);
            }
        }
Ejemplo n.º 2
0
 //public static void DropConstraint(this ISqlDumper fmt, IConstraint cnt, DropFlags flags)
 //{
 //    fmt.DropConstraint(cnt.Table, cnt.Name, cnt.SqlTypeName, flags);
 //}
 //public static void DropConstraint(this ISqlDumper fmt, IConstraint cnt)
 //{
 //    fmt.DropConstraint(cnt.Table, cnt.Name, cnt.SqlTypeName, DropFlags.None);
 //}
 public static void DropConstraints(this ISqlDumper fmt, IEnumerable constraints, DropFlags flags)
 {
     foreach (IConstraint cnt in constraints)
     {
         fmt.DropConstraint(cnt, flags);
     }
 }
Ejemplo n.º 3
0
 public static void DropConstraints(this ISqlDumper fmt, IEnumerable constraints)
 {
     foreach (ConstraintInfo cnt in constraints)
     {
         fmt.DropConstraint(cnt);
     }
 }
Ejemplo n.º 4
0
 protected override void DoGenerateSql(ISqlDumper dmp, ITableStructure ts, IConstraint cnt)
 {
     dmp.DropConstraint(cnt);
 }