コード例 #1
0
ファイル: Migration1.cs プロジェクト: juanplopes/simple
 public override void Up(SchemaAction schema)
 {
     schema.AddTable("t_all_types_1", t =>
     {
         t.AddString("string1").WithSize(123);
         t.AddInt32("int1");
     });
 }
コード例 #2
0
ファイル: Migration2.cs プロジェクト: juanplopes/simple
 public override void Up(SchemaAction schema)
 {
     schema.ChangeTable("t_change_table", t =>
     {
         t.RemoveColumn("string1");
         t.RemoveColumn("int1");
         t.AddString("whatever").WithSize(1000);
     });
 }
コード例 #3
0
ファイル: Migration1.cs プロジェクト: juanplopes/simple
        public override void Down(SchemaAction schema)
        {
            schema.ChangeTable("t_simple_fk_2", t =>
            {
                t.RemoveColumn("auto_fk");
            });

            schema.RemoveTable("t_simple_fk_2");
            schema.RemoveTable("t_simple_fk_1");
        }
コード例 #4
0
ファイル: Migration1.cs プロジェクト: juanplopes/simple
        public override void Up(SchemaAction schema)
        {
            schema.AddTable("t_simple_fk_1", t =>
               {
                   t.AddDateTime("field1");
               });

            schema.AddTable("t_simple_fk_2", t =>
            {
                t.AddInt32("auto_fk").Indexed().Default(1).AutoForeignKey("t_simple_fk_1");
            });
        }
コード例 #5
0
ファイル: Migration1.cs プロジェクト: juanplopes/simple
        public override void Up(SchemaAction schema)
        {
            schema.AddTable("t_change_column", t =>
            {
                t.AddString("string1").WithSize(123);
                t.AddInt32("int1");
            });

            schema.ChangeTable("t_change_column", t =>
            {
                t.ChangeString("string1").WithSize(42);
            });
        }
コード例 #6
0
ファイル: Migration1.cs プロジェクト: juanplopes/simple
        public override void Up(SchemaAction schema)
        {
            schema.AddTable("t_all_types_1", false, t =>
            {
                t.AddAnsiString("fieldAnsiString").PrimaryKey();
                t.AddBinary("fieldBinary").PrimaryKey();
                t.AddByte("fieldByte").PrimaryKey();
                t.AddBoolean("fieldBoolean").PrimaryKey();
                t.AddCurrency("fieldCurrency").PrimaryKey();
                t.AddDateTime("fieldDateTime").PrimaryKey();
                t.AddDecimal("fieldDecimal").PrimaryKey();
                t.AddDouble("fieldDouble").PrimaryKey();
                t.AddInt16("fieldInt16").PrimaryKey();
                t.AddInt32("fieldInt32").PrimaryKey();
                t.AddInt64("fieldInt64").PrimaryKey();
                t.AddSingle("fieldSingle").PrimaryKey();
                t.AddString("fieldString").PrimaryKey();
            });

            schema.AddTable("t_all_types_2", false, t =>
            {
                t.AutoForeignKey("t_all_types_1"
                                    , t.AddAnsiString("fieldAnsiString").PrimaryKey()
                                    , t.AddBinary("fieldBinary").PrimaryKey()
                                    , t.AddByte("fieldByte").PrimaryKey()
                                    , t.AddBoolean("fieldBoolean").PrimaryKey()
                                    , t.AddCurrency("fieldCurrency").PrimaryKey()
                                    , t.AddDateTime("fieldDateTime").PrimaryKey()
                                    , t.AddDecimal("fieldDecimal").PrimaryKey()
                                    , t.AddDouble("fieldDouble").PrimaryKey()
                                    , t.AddInt16("fieldInt16").PrimaryKey()
                                    , t.AddInt32("fieldInt32").PrimaryKey()
                                    , t.AddInt64("fieldInt64").PrimaryKey()
                                    , t.AddSingle("fieldSingle").PrimaryKey()
                                    , t.AddString("fieldString").PrimaryKey()
                                    );

            });
        }
コード例 #7
0
ファイル: Migration1.cs プロジェクト: juanplopes/simple
        public override void Up(SchemaAction schema)
        {
            schema.AddTable("t_double_fk_1", false, t =>
            {
                t.AddInt32("id1").PrimaryKey();
                t.AddString("id2").PrimaryKey();

                t.AddDateTime("field1");
            });

            schema.AddTable("t_double_fk_2", false, t =>
            {
                t.AutoForeignKey("t_double_fk_1",
                    t.AddInt32("id1").PrimaryKey().LinkedTo("id1"),
                    t.AddString("id2").PrimaryKey().LinkedTo("id2")).OnConflict(ForeignKeyConstraint.Cascade);

                t.UniqueColumns("uk_teste",
                    t.AddInt32("unique_field_1"),
                    t.AddSingle("unique_field_2"));

                t.AddDateTime("field2");
            });
        }
コード例 #8
0
ファイル: FluentMigration.cs プロジェクト: juanplopes/simple
 public abstract void Up(SchemaAction schema);
コード例 #9
0
ファイル: FluentMigration.cs プロジェクト: juanplopes/simple
 public virtual void ExecuteSchema(SchemaAction action)
 {
     action.Execute(Database);
 }
コード例 #10
0
ファイル: FluentMigration.cs プロジェクト: juanplopes/simple
 public abstract void Down(SchemaAction schema);
コード例 #11
0
ファイル: Migration1.cs プロジェクト: juanplopes/simple
 public override void Down(SchemaAction schema)
 {
     schema.RemoveTable("t_change_column");
 }
コード例 #12
0
ファイル: TableAddAction.cs プロジェクト: juanplopes/simple
 public TableAddAction(SchemaAction database, string name)
     : base(database, name)
 {
 }
コード例 #13
0
ファイル: Migration1.cs プロジェクト: juanplopes/simple
 public override void Down(SchemaAction schema)
 {
     schema.RemoveTable("t_all_types_1");
 }
コード例 #14
0
ファイル: TableAction.cs プロジェクト: arcondicionado/simple
 public TableAction(SchemaAction database, string name)
 {
     Name = name;
     Database = database;
     Actions = new List<IAction>();
 }
コード例 #15
0
ファイル: Migration1.cs プロジェクト: juanplopes/simple
 public override void Down(SchemaAction schema)
 {
     schema.RemoveTable("t_double_fk_2");
     schema.RemoveTable("t_double_fk_1");
 }