protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.CreateTable( name: "EmailTemplates", columns: table => new { Id = table.Column <Guid>(nullable: false), ParentId = table.Column <Guid>(nullable: true), EmailTemplateId = table.Column <Guid>(nullable: true), EmailLabel = table.Column <string>(nullable: true), FromAddress = table.Column <string>(nullable: true), Subject = table.Column <string>(nullable: true), TemplateText = table.Column <string>(nullable: true), EmailType = table.Column <string>(nullable: true), Active = table.Column <bool>(nullable: false), DateUpdated = table.Column <DateTime>(nullable: false), LoadDrafts = table.Column <bool>(nullable: false), IsDefault = table.Column <bool>(nullable: false), BccAddress = table.Column <string>(nullable: true), VersionCount = table.Column <int>(nullable: false), DateDeleted = table.Column <DateTime>(nullable: true), DeletedBy = table.Column <string>(maxLength: 255, nullable: true), DeletionReason = table.Column <string>(nullable: true) }, constraints: table => { table.PrimaryKey("PK_EmailTemplates", x => x.Id); table.ForeignKey( name: "FK_EmailTemplates_EmailTemplates_EmailTemplateId", column: x => x.EmailTemplateId, principalTable: "EmailTemplates", principalColumn: "Id", onDelete: ReferentialAction.Restrict); }); migrationBuilder.CreateIndex( name: "IX_EmailTemplates_EmailTemplateId", table: "EmailTemplates", column: "EmailTemplateId"); //NLog migrationBuilder.Sql(NLogSql.GetCreateLogTable()); migrationBuilder.Sql(NLogSql.GetInsertLogSp()); }
public override void Up() { CreateTable( "dbo.Bets", c => new { Id = c.Int(nullable: false, identity: true), CustomerId = c.Int(nullable: false), HorseId = c.Int(nullable: false), RaceId = c.Int(nullable: false), Stake = c.Double(nullable: false), DateDeleted = c.DateTime(), DeletedBy = c.String(maxLength: 255), DeletionReason = c.String(), }) .PrimaryKey(t => t.Id) .ForeignKey("dbo.Customers", t => t.CustomerId, cascadeDelete: true) .ForeignKey("dbo.Races", t => t.RaceId, cascadeDelete: true) .Index(t => t.CustomerId) .Index(t => t.RaceId); CreateTable( "dbo.Customers", c => new { Id = c.Int(nullable: false, identity: true), Name = c.String(), DateDeleted = c.DateTime(), DeletedBy = c.String(maxLength: 255), DeletionReason = c.String(), Discriminator = c.String(nullable: true, maxLength: 255), }) .PrimaryKey(t => t.Id); CreateTable( "dbo.Horses", c => new { Id = c.Int(nullable: false, identity: true), RaceId = c.Int(nullable: false), Name = c.String(), Odds = c.Double(nullable: false), DateDeleted = c.DateTime(), DeletedBy = c.String(maxLength: 255), DeletionReason = c.String(), Discriminator = c.String(nullable: true, maxLength: 255), }) .PrimaryKey(t => t.Id) .ForeignKey("dbo.Races", t => t.RaceId, cascadeDelete: true) .Index(t => t.RaceId); CreateTable( "dbo.Races", c => new { Id = c.Int(nullable: false, identity: true), Name = c.String(), Status = c.String(), Start = c.DateTime(nullable: false), DateDeleted = c.DateTime(), DeletedBy = c.String(maxLength: 255), DeletionReason = c.String(), }) .PrimaryKey(t => t.Id); //NLog Sql(NLogSql.GetCreateLogTable()); Sql(NLogSql.GetInsertLogSp()); }