You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
295 lines
12 KiB
295 lines
12 KiB
using System;
|
|
using Microsoft.EntityFrameworkCore.Migrations;
|
|
|
|
#nullable disable
|
|
|
|
namespace Entity_Framework.Migrations
|
|
{
|
|
/// <inheritdoc />
|
|
public partial class test : Migration
|
|
{
|
|
/// <inheritdoc />
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.CreateTable(
|
|
name: "Circuits",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<int>(type: "INTEGER", nullable: false)
|
|
.Annotation("Sqlite:Autoincrement", true),
|
|
Name = table.Column<string>(type: "TEXT", nullable: false)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_Circuits", x => x.Id);
|
|
});
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "Pilotes",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<int>(type: "INTEGER", nullable: false)
|
|
.Annotation("Sqlite:Autoincrement", true),
|
|
Pseudo = table.Column<string>(type: "TEXT", nullable: false),
|
|
Email = table.Column<string>(type: "TEXT", nullable: false),
|
|
Password = table.Column<string>(type: "TEXT", nullable: false)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_Pilotes", x => x.Id);
|
|
});
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "Ecuries",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<int>(type: "INTEGER", nullable: false)
|
|
.Annotation("Sqlite:Autoincrement", true),
|
|
Name = table.Column<string>(type: "TEXT", nullable: false),
|
|
IdPiloteProprietaire = table.Column<int>(type: "INTEGER", nullable: false)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_Ecuries", x => x.Id);
|
|
table.ForeignKey(
|
|
name: "FK_Ecuries_Pilotes_IdPiloteProprietaire",
|
|
column: x => x.IdPiloteProprietaire,
|
|
principalTable: "Pilotes",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
});
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "Images",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<int>(type: "INTEGER", nullable: false)
|
|
.Annotation("Sqlite:Autoincrement", true),
|
|
Base64 = table.Column<string>(type: "TEXT", nullable: false),
|
|
IdPilote = table.Column<int>(type: "INTEGER", nullable: false)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_Images", x => x.Id);
|
|
table.ForeignKey(
|
|
name: "FK_Images_Pilotes_IdPilote",
|
|
column: x => x.IdPilote,
|
|
principalTable: "Pilotes",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
});
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "Sessions",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<long>(type: "INTEGER", nullable: false)
|
|
.Annotation("Sqlite:Autoincrement", true),
|
|
Name = table.Column<string>(type: "TEXT", nullable: false),
|
|
Type = table.Column<string>(type: "TEXT", nullable: false),
|
|
Date = table.Column<DateTime>(type: "TEXT", nullable: false),
|
|
IdCircuit = table.Column<int>(type: "INTEGER", nullable: false),
|
|
IdPilote = table.Column<int>(type: "INTEGER", nullable: false)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_Sessions", x => x.Id);
|
|
table.ForeignKey(
|
|
name: "FK_Sessions_Circuits_IdCircuit",
|
|
column: x => x.IdCircuit,
|
|
principalTable: "Circuits",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
table.ForeignKey(
|
|
name: "FK_Sessions_Pilotes_IdPilote",
|
|
column: x => x.IdPilote,
|
|
principalTable: "Pilotes",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
});
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "RelationEcuriePilote",
|
|
columns: table => new
|
|
{
|
|
IdPilote = table.Column<int>(type: "INTEGER", nullable: false),
|
|
IdEcurie = table.Column<int>(type: "INTEGER", nullable: false),
|
|
Grade = table.Column<string>(type: "TEXT", nullable: false),
|
|
PiloteId = table.Column<int>(type: "INTEGER", nullable: false),
|
|
EcurieId = table.Column<int>(type: "INTEGER", nullable: false)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_RelationEcuriePilote", x => new { x.IdPilote, x.IdEcurie });
|
|
table.ForeignKey(
|
|
name: "FK_RelationEcuriePilote_Ecuries_EcurieId",
|
|
column: x => x.EcurieId,
|
|
principalTable: "Ecuries",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
table.ForeignKey(
|
|
name: "FK_RelationEcuriePilote_Pilotes_PiloteId",
|
|
column: x => x.PiloteId,
|
|
principalTable: "Pilotes",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
});
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "Tours",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<long>(type: "INTEGER", nullable: false)
|
|
.Annotation("Sqlite:Autoincrement", true),
|
|
Temps = table.Column<string>(type: "TEXT", nullable: false),
|
|
Numero = table.Column<int>(type: "INTEGER", nullable: false),
|
|
IdSession = table.Column<long>(type: "INTEGER", nullable: false)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_Tours", x => x.Id);
|
|
table.ForeignKey(
|
|
name: "FK_Tours_Sessions_IdSession",
|
|
column: x => x.IdSession,
|
|
principalTable: "Sessions",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
});
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "Points",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<long>(type: "INTEGER", nullable: false)
|
|
.Annotation("Sqlite:Autoincrement", true),
|
|
Timer = table.Column<float>(type: "REAL", nullable: false),
|
|
Latitude = table.Column<double>(type: "REAL", nullable: false),
|
|
Longitude = table.Column<double>(type: "REAL", nullable: false),
|
|
Distance = table.Column<float>(type: "REAL", nullable: false),
|
|
P_BreakF = table.Column<float>(type: "REAL", nullable: false),
|
|
NGearASCII = table.Column<float>(type: "REAL", nullable: false),
|
|
A_Steer = table.Column<float>(type: "REAL", nullable: false),
|
|
R_Pedal = table.Column<float>(type: "REAL", nullable: false),
|
|
G_Lon = table.Column<float>(type: "REAL", nullable: false),
|
|
G_Lat = table.Column<float>(type: "REAL", nullable: false),
|
|
V_Car = table.Column<float>(type: "REAL", nullable: false),
|
|
IdTours = table.Column<long>(type: "INTEGER", nullable: false)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_Points", x => x.Id);
|
|
table.ForeignKey(
|
|
name: "FK_Points_Tours_IdTours",
|
|
column: x => x.IdTours,
|
|
principalTable: "Tours",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
});
|
|
|
|
migrationBuilder.InsertData(
|
|
table: "Circuits",
|
|
columns: new[] { "Id", "Name" },
|
|
values: new object[] { 1, "test_CIRCUIT" });
|
|
|
|
migrationBuilder.InsertData(
|
|
table: "Pilotes",
|
|
columns: new[] { "Id", "Email", "Password", "Pseudo" },
|
|
values: new object[] { 1, "test@gmail.com", "7NcYcNGWMxapfjrDQIyYNa2M8PPBvHA1J8MCZVNPda4=", "test_PILOTE" });
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_Circuits_Name",
|
|
table: "Circuits",
|
|
column: "Name",
|
|
unique: true);
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_Ecuries_IdPiloteProprietaire",
|
|
table: "Ecuries",
|
|
column: "IdPiloteProprietaire",
|
|
unique: true);
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_Ecuries_Name",
|
|
table: "Ecuries",
|
|
column: "Name",
|
|
unique: true);
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_Images_IdPilote",
|
|
table: "Images",
|
|
column: "IdPilote",
|
|
unique: true);
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_Pilotes_Email",
|
|
table: "Pilotes",
|
|
column: "Email",
|
|
unique: true);
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_Pilotes_Pseudo",
|
|
table: "Pilotes",
|
|
column: "Pseudo",
|
|
unique: true);
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_Points_IdTours",
|
|
table: "Points",
|
|
column: "IdTours");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_RelationEcuriePilote_EcurieId",
|
|
table: "RelationEcuriePilote",
|
|
column: "EcurieId");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_RelationEcuriePilote_PiloteId",
|
|
table: "RelationEcuriePilote",
|
|
column: "PiloteId");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_Sessions_IdCircuit",
|
|
table: "Sessions",
|
|
column: "IdCircuit");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_Sessions_IdPilote",
|
|
table: "Sessions",
|
|
column: "IdPilote");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_Tours_IdSession",
|
|
table: "Tours",
|
|
column: "IdSession");
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DropTable(
|
|
name: "Images");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "Points");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "RelationEcuriePilote");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "Tours");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "Ecuries");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "Sessions");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "Circuits");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "Pilotes");
|
|
}
|
|
}
|
|
}
|