using System; using Microsoft.EntityFrameworkCore.Migrations; namespace AutoBet.Db.Migrations { public partial class Intialize : Migration { protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.CreateTable( name: "OddsSnapshots", columns: table => new { Id = table.Column(nullable: false) .Annotation("SqlServer:Identity", "1, 1"), EventName = table.Column(nullable: true), HorseName = table.Column(nullable: true), JockeyName = table.Column(nullable: true), SnapshotDate = table.Column(nullable: false) }, constraints: table => { table.PrimaryKey("PK_OddsSnapshots", x => x.Id); }); migrationBuilder.CreateTable( name: "BetOdds", columns: table => new { Id = table.Column(nullable: false) .Annotation("SqlServer:Identity", "1, 1"), OddsType = table.Column(nullable: false), Odds = table.Column(nullable: false), Available = table.Column(nullable: false), OddsSnapshotId = table.Column(nullable: true) }, constraints: table => { table.PrimaryKey("PK_BetOdds", x => x.Id); table.ForeignKey( name: "FK_BetOdds_OddsSnapshots_OddsSnapshotId", column: x => x.OddsSnapshotId, principalTable: "OddsSnapshots", principalColumn: "Id", onDelete: ReferentialAction.Restrict); }); migrationBuilder.CreateIndex( name: "IX_BetOdds_OddsSnapshotId", table: "BetOdds", column: "OddsSnapshotId"); } protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "BetOdds"); migrationBuilder.DropTable( name: "OddsSnapshots"); } } }