Esempio n. 1
0
        public void Up(IDatabase db)
        {
            db.CreateTable(ResellerToSupplier)
            .WithForeignKeyColumnTo(Reseller)
            .WithForeignKeyColumnTo(Supplier);
            var table = db.Tables[ResellerToSupplier];

            table.AddDefaultForeignKeyTo(Reseller);
            table.AddDefaultForeignKeyTo(Supplier);
            table.AddUniqueConstraint(Unique)
            .OnColumn(ForeignKey.ColumnTo(Reseller))
            .OnColumn(ForeignKey.ColumnTo(Supplier));
        }
        public void Up(IDatabase db)
        {
            db.CreateTable(SupplierProduct)
            .WithId()
            .WithForeignKeyColumnTo(ProductVariant)
            .WithForeignKeyColumnTo(Supplier)
            .WithNotNullableColumn("CostPrice", DbType.Decimal).OfSize(19, 2)
            .WithNotNullableColumn("CurrentStockCount", DbType.Int32);

            var table = db.Tables[SupplierProduct];

            table.AddDefaultForeignKeyTo(ProductVariant);
            table.AddDefaultForeignKeyTo(Supplier);
            table.AddUniqueConstraint(UniqueSupplierProduct)
            .OnColumn(ForeignKey.ColumnTo(Supplier))
            .OnColumn(ForeignKey.ColumnTo(ProductVariant));
        }