using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace Infrastructure.Migrations { /// public partial class Initialize : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.CreateTable( name: "Programs", columns: table => new { Id = table.Column(type: "TEXT", nullable: false), Name = table.Column(type: "TEXT", nullable: false), WeekDuration = table.Column(type: "INTEGER", nullable: false), Description = table.Column(type: "TEXT", nullable: false), Difficulty = table.Column(type: "TEXT", nullable: false) }, constraints: table => { table.PrimaryKey("PK_Programs", x => x.Id); }); migrationBuilder.CreateTable( name: "Users", columns: table => new { Id = table.Column(type: "TEXT", nullable: false), Name = table.Column(type: "TEXT", nullable: false), Age = table.Column(type: "INTEGER", nullable: false), Height = table.Column(type: "REAL", nullable: false), Weight = table.Column(type: "REAL", nullable: false), Sexe = table.Column(type: "INTEGER", nullable: false), Logo = table.Column(type: "TEXT", nullable: false), NbSessionPerWeek = table.Column(type: "INTEGER", nullable: false), EGoal = table.Column(type: "TEXT", nullable: true), EHealthProblem = table.Column(type: "INTEGER", nullable: false), ESport = table.Column(type: "INTEGER", nullable: true), ESleepLevel = table.Column(type: "INTEGER", nullable: true), ESportLevel = table.Column(type: "INTEGER", nullable: true), HashPassword = table.Column(type: "TEXT", nullable: false), OAuthProvider = table.Column(type: "TEXT", nullable: true), OAuthId = table.Column(type: "TEXT", nullable: true) }, constraints: table => { table.PrimaryKey("PK_Users", x => x.Id); }); migrationBuilder.CreateTable( name: "Sessions", columns: table => new { Id = table.Column(type: "TEXT", nullable: false), Name = table.Column(type: "TEXT", nullable: false), Description = table.Column(type: "TEXT", nullable: false), Duration = table.Column(type: "REAL", nullable: false), TrainingProgramId = table.Column(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(type: "TEXT", nullable: false), Name = table.Column(type: "TEXT", nullable: false), Description = table.Column(type: "TEXT", nullable: false), Duration = table.Column(type: "REAL", nullable: false), Image = table.Column(type: "TEXT", nullable: false), Video = table.Column(type: "TEXT", nullable: false), NbSeries = table.Column(type: "INTEGER", nullable: false), NbRepetitions = table.Column(type: "INTEGER", nullable: false), SessionId = table.Column(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"); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "Exercices"); migrationBuilder.DropTable( name: "Users"); migrationBuilder.DropTable( name: "Sessions"); migrationBuilder.DropTable( name: "Programs"); } } }