using System; using Microsoft.EntityFrameworkCore.Migrations; #nullable disable #pragma warning disable CA1814 // Prefer jagged arrays over multidimensional namespace StubContext.Migrations { /// public partial class m3 : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.CreateTable( name: "Teams", columns: table => new { Id = table.Column(type: "INTEGER", nullable: false) .Annotation("Sqlite:Autoincrement", true), Name = table.Column(type: "TEXT", nullable: false), Picture = table.Column(type: "TEXT", nullable: false), MainColor = table.Column(type: "TEXT", nullable: false), SecondColor = table.Column(type: "TEXT", nullable: false) }, constraints: table => { table.PrimaryKey("PK_Teams", x => x.Id); }); migrationBuilder.CreateTable( name: "Users", columns: table => new { Id = table.Column(type: "INTEGER", nullable: false) .Annotation("Sqlite:Autoincrement", true), Password = table.Column(type: "TEXT", nullable: false), Salt = table.Column(type: "BLOB", nullable: false), Name = table.Column(type: "TEXT", nullable: false), Email = table.Column(type: "TEXT", nullable: false), ProfilePicture = table.Column(type: "TEXT", nullable: false), IsAdmin = table.Column(type: "INTEGER", nullable: false) }, constraints: table => { table.PrimaryKey("PK_Users", x => x.Id); }); migrationBuilder.CreateTable( name: "Members", columns: table => new { TeamId = table.Column(type: "INTEGER", nullable: false), UserId = table.Column(type: "INTEGER", nullable: false), Role = table.Column(type: "TEXT", nullable: false) }, constraints: table => { table.PrimaryKey("PK_Members", x => new { x.TeamId, x.UserId }); table.ForeignKey( name: "FK_Members_Teams_TeamId", column: x => x.TeamId, principalTable: "Teams", principalColumn: "Id", onDelete: ReferentialAction.Cascade); table.ForeignKey( name: "FK_Members_Users_UserId", column: x => x.UserId, principalTable: "Users", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateTable( name: "Tactics", columns: table => new { Id = table.Column(type: "INTEGER", nullable: false) .Annotation("Sqlite:Autoincrement", true), Name = table.Column(type: "TEXT", nullable: false), CreationDate = table.Column(type: "TEXT", nullable: false), OwnerId = table.Column(type: "INTEGER", nullable: false), Type = table.Column(type: "INTEGER", nullable: false) }, constraints: table => { table.PrimaryKey("PK_Tactics", x => x.Id); table.ForeignKey( name: "FK_Tactics_Users_OwnerId", column: x => x.OwnerId, principalTable: "Users", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateTable( name: "TacticSteps", columns: table => new { Id = table.Column(type: "INTEGER", nullable: false) .Annotation("Sqlite:Autoincrement", true), TacticId = table.Column(type: "INTEGER", nullable: false), ParentId = table.Column(type: "INTEGER", nullable: true), StepId = table.Column(type: "INTEGER", nullable: false), JsonContent = table.Column(type: "TEXT", nullable: false) }, constraints: table => { table.PrimaryKey("PK_TacticSteps", x => x.Id); table.ForeignKey( name: "FK_TacticSteps_TacticSteps_ParentId", column: x => x.ParentId, principalTable: "TacticSteps", principalColumn: "Id"); table.ForeignKey( name: "FK_TacticSteps_Tactics_TacticId", column: x => x.TacticId, principalTable: "Tactics", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }); migrationBuilder.InsertData( table: "Users", columns: new[] { "Id", "Email", "IsAdmin", "Name", "Password", "ProfilePicture", "Salt" }, values: new object[,] { { 1, "maxime@mail.com", true, "maxime", "MA/xRuayPtWrv8x3Cgz5OzmlHs/d2kdqpsejjELTgVo=", "https://cdn.pixabay.com/photo/2015/10/05/22/37/blank-profile-picture-973460_960_720.png", new byte[] { 150, 122, 99, 167, 226, 248, 165, 213, 13, 3, 4, 9, 173, 71, 224, 221, 124, 172, 97, 145, 188, 142, 224, 77, 247, 77, 124, 37, 24, 107, 43, 189 } }, { 2, "mael@mail.com", true, "mael", "d4SIGx08pW4fFOFycWyscF9MwGhN5/1b0NC1Qk23YCw=", "https://cdn.pixabay.com/photo/2015/10/05/22/37/blank-profile-picture-973460_960_720.png", new byte[] { 139, 244, 180, 246, 0, 73, 0, 219, 14, 221, 232, 49, 46, 122, 94, 50, 119, 154, 154, 53, 224, 187, 86, 230, 63, 73, 65, 232, 218, 136, 75, 142 } }, { 3, "yanis@mail.com", true, "yanis", "rtqwioPIa+g4C7hlsJMynrxVjUYw1V09z21bA6nBORM=", "https://cdn.pixabay.com/photo/2015/10/05/22/37/blank-profile-picture-973460_960_720.png", new byte[] { 154, 78, 98, 162, 75, 166, 161, 47, 28, 160, 107, 245, 28, 33, 244, 213, 64, 247, 249, 28, 216, 58, 63, 44, 71, 179, 227, 67, 81, 146, 81, 87 } }, { 4, "simon@mail.com", true, "simon", "RWebQFKoA5GHSVibfFwKJ+YrgliWiCjzHmDCQYA6h9Y=", "https://cdn.pixabay.com/photo/2015/10/05/22/37/blank-profile-picture-973460_960_720.png", new byte[] { 151, 193, 143, 48, 112, 90, 1, 91, 205, 85, 248, 129, 36, 50, 255, 5, 247, 95, 2, 156, 141, 189, 98, 4, 223, 179, 132, 19, 109, 43, 75, 43 } }, { 5, "vivien@mail.com", true, "vivien", "aduT6b63cL7GYh6qX1VdL0YvQIDz7uXxwnqrM9SSzzU=", "https://cdn.pixabay.com/photo/2015/10/05/22/37/blank-profile-picture-973460_960_720.png", new byte[] { 163, 203, 253, 50, 184, 48, 93, 231, 249, 199, 182, 214, 40, 190, 70, 79, 53, 18, 26, 151, 57, 183, 166, 150, 179, 165, 48, 68, 12, 31, 129, 242 } } }); migrationBuilder.CreateIndex( name: "IX_Members_UserId", table: "Members", column: "UserId"); migrationBuilder.CreateIndex( name: "IX_Tactics_OwnerId", table: "Tactics", column: "OwnerId"); migrationBuilder.CreateIndex( name: "IX_TacticSteps_ParentId", table: "TacticSteps", column: "ParentId"); migrationBuilder.CreateIndex( name: "IX_TacticSteps_TacticId", table: "TacticSteps", column: "TacticId"); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "Members"); migrationBuilder.DropTable( name: "TacticSteps"); migrationBuilder.DropTable( name: "Teams"); migrationBuilder.DropTable( name: "Tactics"); migrationBuilder.DropTable( name: "Users"); } } }