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.
OptifitWebService/Infrastructure/Migrations/20250212145647_Initialize.cs

126 lines
5.5 KiB

using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Infrastructure.Migrations
{
/// <inheritdoc />
public partial class Initialize : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "Programs",
columns: table => new
{
Id = table.Column<string>(type: "TEXT", nullable: false),
Name = table.Column<string>(type: "TEXT", nullable: false),
WeekDuration = table.Column<int>(type: "INTEGER", nullable: false),
Description = table.Column<string>(type: "TEXT", nullable: false),
Difficulty = table.Column<string>(type: "TEXT", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Programs", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Users",
columns: table => new
{
Id = table.Column<string>(type: "TEXT", nullable: false),
Name = table.Column<string>(type: "TEXT", nullable: false),
Age = table.Column<int>(type: "INTEGER", nullable: false),
Height = table.Column<float>(type: "REAL", nullable: false),
Weight = table.Column<float>(type: "REAL", nullable: false),
Sexe = table.Column<bool>(type: "INTEGER", nullable: false),
Logo = table.Column<string>(type: "TEXT", nullable: false),
NbSessionPerWeek = table.Column<int>(type: "INTEGER", nullable: false),
EGoal = table.Column<string>(type: "TEXT", nullable: true),
EHealthProblem = table.Column<int>(type: "INTEGER", nullable: false),
ESport = table.Column<int>(type: "INTEGER", nullable: true),
ESleepLevel = table.Column<int>(type: "INTEGER", nullable: true),
ESportLevel = table.Column<int>(type: "INTEGER", nullable: true),
HashPassword = table.Column<string>(type: "TEXT", nullable: false),
OAuthProvider = table.Column<string>(type: "TEXT", nullable: true),
OAuthId = table.Column<string>(type: "TEXT", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Users", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Sessions",
columns: table => new
{
Id = table.Column<string>(type: "TEXT", nullable: false),
Name = table.Column<string>(type: "TEXT", nullable: false),
Description = table.Column<string>(type: "TEXT", nullable: false),
Duration = table.Column<float>(type: "REAL", nullable: false),
TrainingProgramId = table.Column<string>(type: "TEXT", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Sessions", x => x.Id);
table.ForeignKey(
name: "FK_Sessions_Programs_TrainingProgramId",
column: x => x.TrainingProgramId,
principalTable: "Programs",
principalColumn: "Id");
});
migrationBuilder.CreateTable(
name: "Exercices",
columns: table => new
{
Id = table.Column<string>(type: "TEXT", nullable: false),
Name = table.Column<string>(type: "TEXT", nullable: false),
Description = table.Column<string>(type: "TEXT", nullable: false),
Duration = table.Column<float>(type: "REAL", nullable: false),
Image = table.Column<string>(type: "TEXT", nullable: false),
Video = table.Column<string>(type: "TEXT", nullable: false),
NbSeries = table.Column<int>(type: "INTEGER", nullable: false),
NbRepetitions = table.Column<int>(type: "INTEGER", nullable: false),
SessionId = table.Column<string>(type: "TEXT", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Exercices", x => x.Id);
table.ForeignKey(
name: "FK_Exercices_Sessions_SessionId",
column: x => x.SessionId,
principalTable: "Sessions",
principalColumn: "Id");
});
migrationBuilder.CreateIndex(
name: "IX_Exercices_SessionId",
table: "Exercices",
column: "SessionId");
migrationBuilder.CreateIndex(
name: "IX_Sessions_TrainingProgramId",
table: "Sessions",
column: "TrainingProgramId");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "Exercices");
migrationBuilder.DropTable(
name: "Users");
migrationBuilder.DropTable(
name: "Sessions");
migrationBuilder.DropTable(
name: "Programs");
}
}
}