Files

64 lines
2.4 KiB
C#
Raw Permalink Normal View History

2020-04-13 15:16:46 +01:00
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<int>(nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
EventName = table.Column<string>(nullable: true),
HorseName = table.Column<string>(nullable: true),
JockeyName = table.Column<string>(nullable: true),
SnapshotDate = table.Column<DateTime>(nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_OddsSnapshots", x => x.Id);
});
migrationBuilder.CreateTable(
name: "BetOdds",
columns: table => new
{
Id = table.Column<int>(nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
OddsType = table.Column<int>(nullable: false),
Odds = table.Column<decimal>(nullable: false),
Available = table.Column<decimal>(nullable: false),
OddsSnapshotId = table.Column<int>(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");
}
}
}