using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace EntityFrameWorkLib.Migrations
{
///
public partial class AllMigrations : Migration
{
///
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "Case",
columns: table => new
{
CaseId = table.Column(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
Value = table.Column(type: "INTEGER", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Case", x => x.CaseId);
});
migrationBuilder.CreateTable(
name: "Game",
columns: table => new
{
GameId = table.Column(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
Duration = table.Column(type: "TEXT", nullable: false),
Date = table.Column(type: "TEXT", nullable: false),
NbPlayers = table.Column(type: "INTEGER", nullable: false),
Name = table.Column(type: "TEXT", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Game", x => x.GameId);
});
migrationBuilder.CreateTable(
name: "Grille",
columns: table => new
{
GrilleId = table.Column(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
NbChains = table.Column(type: "INTEGER", nullable: false),
NbZones = table.Column(type: "INTEGER", nullable: false),
MaxChain = table.Column(type: "INTEGER", nullable: false),
MaxZone = table.Column(type: "INTEGER", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Grille", x => x.GrilleId);
});
migrationBuilder.CreateTable(
name: "Players",
columns: table => new
{
PlayerId = table.Column(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
Pseudo = table.Column(type: "TEXT", nullable: false),
NbWin = table.Column(type: "INTEGER", nullable: false),
NbPlayed = table.Column(type: "INTEGER", nullable: false),
MaxZone = table.Column(type: "INTEGER", nullable: false),
MaxPoints = table.Column(type: "INTEGER", nullable: false),
NbPoints = table.Column(type: "INTEGER", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Players", x => x.PlayerId);
});
migrationBuilder.CreateTable(
name: "Turn",
columns: table => new
{
TurnId = table.Column(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
DiceValue1 = table.Column(type: "INTEGER", nullable: false),
DiceValue2 = table.Column(type: "INTEGER", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Turn", x => x.TurnId);
});
migrationBuilder.CreateTable(
name: "Score",
columns: table => new
{
ScoreId = table.Column(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
NbPoints = table.Column(type: "INTEGER", nullable: false),
GameId = table.Column(type: "INTEGER", nullable: false),
PlayerId = table.Column(type: "INTEGER", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Score", x => x.ScoreId);
table.ForeignKey(
name: "FK_Score_Game_GameId",
column: x => x.GameId,
principalTable: "Game",
principalColumn: "GameId",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_Score_Players_PlayerId",
column: x => x.PlayerId,
principalTable: "Players",
principalColumn: "PlayerId",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_Score_GameId",
table: "Score",
column: "GameId");
migrationBuilder.CreateIndex(
name: "IX_Score_PlayerId",
table: "Score",
column: "PlayerId");
}
///
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "Case");
migrationBuilder.DropTable(
name: "Grille");
migrationBuilder.DropTable(
name: "Score");
migrationBuilder.DropTable(
name: "Turn");
migrationBuilder.DropTable(
name: "Game");
migrationBuilder.DropTable(
name: "Players");
}
}
}