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/20250207101932_TESTTraining...

319 lines
10 KiB

using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Infrastructure.Migrations
{
/// <inheritdoc />
public partial class TESTTrainingProgMig : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_Exercices_Sessions_SessionId",
table: "Exercices");
migrationBuilder.DropForeignKey(
name: "FK_Sessions_Programs_TrainingProgramId",
table: "Sessions");
migrationBuilder.DropColumn(
name: "Duration",
table: "Sessions");
migrationBuilder.DropColumn(
name: "Description",
table: "Exercices");
migrationBuilder.DropColumn(
name: "Duration",
table: "Exercices");
migrationBuilder.DropColumn(
name: "Image",
table: "Exercices");
migrationBuilder.DropColumn(
name: "Name",
table: "Exercices");
migrationBuilder.RenameColumn(
name: "Description",
table: "Programs",
newName: "OwnerId");
migrationBuilder.RenameColumn(
name: "Video",
table: "Exercices",
newName: "TemplateId");
migrationBuilder.RenameColumn(
name: "NbSeries",
table: "Exercices",
newName: "RestingTime");
migrationBuilder.RenameColumn(
name: "NbRepetitions",
table: "Exercices",
newName: "NbSets");
migrationBuilder.AlterColumn<string>(
name: "TrainingProgramId",
table: "Sessions",
type: "TEXT",
nullable: false,
defaultValue: "",
oldClrType: typeof(string),
oldType: "TEXT",
oldNullable: true);
migrationBuilder.AddColumn<int>(
name: "Day",
table: "Sessions",
type: "INTEGER",
nullable: false,
defaultValue: 0);
migrationBuilder.AddColumn<int>(
name: "Target",
table: "Sessions",
type: "INTEGER",
nullable: false,
defaultValue: 0);
migrationBuilder.AlterColumn<int>(
name: "Difficulty",
table: "Programs",
type: "INTEGER",
nullable: false,
oldClrType: typeof(string),
oldType: "TEXT");
migrationBuilder.AddColumn<int>(
name: "Goal",
table: "Programs",
type: "INTEGER",
nullable: false,
defaultValue: 0);
migrationBuilder.AddColumn<int>(
name: "Lang",
table: "Programs",
type: "INTEGER",
nullable: false,
defaultValue: 0);
migrationBuilder.AlterColumn<string>(
name: "SessionId",
table: "Exercices",
type: "TEXT",
nullable: false,
defaultValue: "",
oldClrType: typeof(string),
oldType: "TEXT",
oldNullable: true);
migrationBuilder.AddColumn<int>(
name: "Category",
table: "Exercices",
type: "INTEGER",
nullable: false,
defaultValue: 0);
migrationBuilder.AddColumn<int>(
name: "NbReps",
table: "Exercices",
type: "INTEGER",
nullable: false,
defaultValue: 0);
migrationBuilder.CreateTable(
name: "Exercice_template",
columns: table => new
{
Id = table.Column<string>(type: "TEXT", nullable: false),
Name = table.Column<string>(type: "TEXT", nullable: false),
Equipment = table.Column<string>(type: "TEXT", nullable: false),
Instructions = table.Column<string>(type: "TEXT", nullable: false),
Duration = table.Column<float>(type: "REAL", nullable: false),
ImageId = table.Column<string>(type: "TEXT", nullable: true),
VideoId = table.Column<string>(type: "TEXT", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Exercice_template", x => x.Id);
});
migrationBuilder.CreateIndex(
name: "IX_Exercices_TemplateId",
table: "Exercices",
column: "TemplateId");
migrationBuilder.AddForeignKey(
name: "FK_Exercices_Exercice_template_TemplateId",
table: "Exercices",
column: "TemplateId",
principalTable: "Exercice_template",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_Exercices_Sessions_SessionId",
table: "Exercices",
column: "SessionId",
principalTable: "Sessions",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_Sessions_Programs_TrainingProgramId",
table: "Sessions",
column: "TrainingProgramId",
principalTable: "Programs",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_Exercices_Exercice_template_TemplateId",
table: "Exercices");
migrationBuilder.DropForeignKey(
name: "FK_Exercices_Sessions_SessionId",
table: "Exercices");
migrationBuilder.DropForeignKey(
name: "FK_Sessions_Programs_TrainingProgramId",
table: "Sessions");
migrationBuilder.DropTable(
name: "Exercice_template");
migrationBuilder.DropIndex(
name: "IX_Exercices_TemplateId",
table: "Exercices");
migrationBuilder.DropColumn(
name: "Day",
table: "Sessions");
migrationBuilder.DropColumn(
name: "Target",
table: "Sessions");
migrationBuilder.DropColumn(
name: "Goal",
table: "Programs");
migrationBuilder.DropColumn(
name: "Lang",
table: "Programs");
migrationBuilder.DropColumn(
name: "Category",
table: "Exercices");
migrationBuilder.DropColumn(
name: "NbReps",
table: "Exercices");
migrationBuilder.RenameColumn(
name: "OwnerId",
table: "Programs",
newName: "Description");
migrationBuilder.RenameColumn(
name: "TemplateId",
table: "Exercices",
newName: "Video");
migrationBuilder.RenameColumn(
name: "RestingTime",
table: "Exercices",
newName: "NbSeries");
migrationBuilder.RenameColumn(
name: "NbSets",
table: "Exercices",
newName: "NbRepetitions");
migrationBuilder.AlterColumn<string>(
name: "TrainingProgramId",
table: "Sessions",
type: "TEXT",
nullable: true,
oldClrType: typeof(string),
oldType: "TEXT");
migrationBuilder.AddColumn<float>(
name: "Duration",
table: "Sessions",
type: "REAL",
nullable: false,
defaultValue: 0f);
migrationBuilder.AlterColumn<string>(
name: "Difficulty",
table: "Programs",
type: "TEXT",
nullable: false,
oldClrType: typeof(int),
oldType: "INTEGER");
migrationBuilder.AlterColumn<string>(
name: "SessionId",
table: "Exercices",
type: "TEXT",
nullable: true,
oldClrType: typeof(string),
oldType: "TEXT");
migrationBuilder.AddColumn<string>(
name: "Description",
table: "Exercices",
type: "TEXT",
nullable: false,
defaultValue: "");
migrationBuilder.AddColumn<float>(
name: "Duration",
table: "Exercices",
type: "REAL",
nullable: false,
defaultValue: 0f);
migrationBuilder.AddColumn<string>(
name: "Image",
table: "Exercices",
type: "TEXT",
nullable: false,
defaultValue: "");
migrationBuilder.AddColumn<string>(
name: "Name",
table: "Exercices",
type: "TEXT",
nullable: false,
defaultValue: "");
migrationBuilder.AddForeignKey(
name: "FK_Exercices_Sessions_SessionId",
table: "Exercices",
column: "SessionId",
principalTable: "Sessions",
principalColumn: "Id");
migrationBuilder.AddForeignKey(
name: "FK_Sessions_Programs_TrainingProgramId",
table: "Sessions",
column: "TrainingProgramId",
principalTable: "Programs",
principalColumn: "Id");
}
}
}