AddTable() public method

public AddTable ( string name, Action definition ) : TableAddAction
name string
definition Action
return TableAddAction
示例#1
0
        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");
            });
        }
示例#2
0
 public override void Up(SchemaAction schema)
 {
     schema.AddTable("t_all_types_1", t =>
     {
         t.AddString("string1").WithSize(123);
         t.AddInt32("int1");
     });
 }
示例#3
0
        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);
            });
        }
示例#4
0
        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()
                                    );

            });
        }
示例#5
0
        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");
            });
        }