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), Name = table.Column(type: "TEXT", nullable: false), Email = table.Column(type: "TEXT", nullable: false), ProfilePicture = table.Column(type: "TEXT", 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", "Name", "ProfilePicture" }, values: new object[,] { { 1, "maxime@mail.com", "maxime", "https://cdn.pixabay.com/photo/2015/10/05/22/37/blank-profile-picture-973460_960_720.png" }, { 2, "mael@mail.com", "mael", "https://cdn.pixabay.com/photo/2015/10/05/22/37/blank-profile-picture-973460_960_720.png" }, { 3, "yanis@mail.com", "yanis", "https://cdn.pixabay.com/photo/2015/10/05/22/37/blank-profile-picture-973460_960_720.png" }, { 4, "simon@mail.com", "simon", "https://cdn.pixabay.com/photo/2015/10/05/22/37/blank-profile-picture-973460_960_720.png" }, { 5, "vivien@mail.com", "vivien", "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"); } } }