using System; using Microsoft.EntityFrameworkCore.Migrations; #nullable disable #pragma warning disable CA1814 // Prefer jagged arrays over multidimensional namespace StubContext.Migrations { /// public partial class m1 : 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), 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), JsonContent = table.Column(type: "TEXT", 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.InsertData( table: "Users", columns: new[] { "Id", "Email", "IsAdmin", "Name", "Password", "ProfilePicture" }, values: new object[,] { { 1, "maxime@mail.com", true, "maxime", "lhrwN9GTh2+T/KWpOnGJTI5rt8mZVrljOtDRuYv9Xck=", "https://cdn.pixabay.com/photo/2015/10/05/22/37/blank-profile-picture-973460_960_720.png" }, { 2, "mael@mail.com", true, "mael", "m+9+DO+fDO5BH33h6rpEvHwVlFTt4Xb0Sa3/qGmDymI=", "https://cdn.pixabay.com/photo/2015/10/05/22/37/blank-profile-picture-973460_960_720.png" }, { 3, "yanis@mail.com", true, "yanis", "I63Z72IN7LSzp1nG18wX2yAN2kM16WOxMIIMI3o5Nno=", "https://cdn.pixabay.com/photo/2015/10/05/22/37/blank-profile-picture-973460_960_720.png" }, { 4, "simon@mail.com", true, "simon", "SGbhGgYSXuQpyvdKOlTrUxJcrV3iBZGt5NFZiWtxKWw=", "https://cdn.pixabay.com/photo/2015/10/05/22/37/blank-profile-picture-973460_960_720.png" }, { 5, "vivien@mail.com", true, "vivien", "v5dtqo9qg96d7ajz+DQlvVZ1Mbeu9RstFXtuhX5SGfo=", "https://cdn.pixabay.com/photo/2015/10/05/22/37/blank-profile-picture-973460_960_720.png" } }); migrationBuilder.CreateIndex( name: "IX_Members_UserId", table: "Members", column: "UserId"); migrationBuilder.CreateIndex( name: "IX_Tactics_OwnerId", table: "Tactics", column: "OwnerId"); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "Members"); migrationBuilder.DropTable( name: "Tactics"); migrationBuilder.DropTable( name: "Teams"); migrationBuilder.DropTable( name: "Users"); } } }