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.
135 lines
5.7 KiB
135 lines
5.7 KiB
using System;
|
|
using Microsoft.EntityFrameworkCore.Migrations;
|
|
|
|
#nullable disable
|
|
|
|
#pragma warning disable CA1814 // Prefer jagged arrays over multidimensional
|
|
|
|
namespace StubContext.Migrations
|
|
{
|
|
/// <inheritdoc />
|
|
public partial class m1 : Migration
|
|
{
|
|
/// <inheritdoc />
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.CreateTable(
|
|
name: "Teams",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<int>(type: "INTEGER", nullable: false)
|
|
.Annotation("Sqlite:Autoincrement", true),
|
|
Name = table.Column<string>(type: "TEXT", nullable: false),
|
|
Picture = table.Column<string>(type: "TEXT", nullable: false),
|
|
MainColor = table.Column<string>(type: "TEXT", nullable: false),
|
|
SecondColor = table.Column<string>(type: "TEXT", nullable: false)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_Teams", x => x.Id);
|
|
});
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "Users",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<int>(type: "INTEGER", nullable: false)
|
|
.Annotation("Sqlite:Autoincrement", true),
|
|
Name = table.Column<string>(type: "TEXT", nullable: false),
|
|
Email = table.Column<string>(type: "TEXT", nullable: false),
|
|
ProfilePicture = table.Column<string>(type: "TEXT", nullable: false)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_Users", x => x.Id);
|
|
});
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "Members",
|
|
columns: table => new
|
|
{
|
|
TeamId = table.Column<int>(type: "INTEGER", nullable: false),
|
|
UserId = table.Column<int>(type: "INTEGER", nullable: false),
|
|
Role = table.Column<string>(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<int>(type: "INTEGER", nullable: false)
|
|
.Annotation("Sqlite:Autoincrement", true),
|
|
Name = table.Column<string>(type: "TEXT", nullable: false),
|
|
CreationDate = table.Column<DateTime>(type: "TEXT", nullable: false),
|
|
OwnerId = table.Column<int>(type: "INTEGER", nullable: false),
|
|
Type = table.Column<int>(type: "INTEGER", nullable: false),
|
|
JsonContent = table.Column<string>(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");
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DropTable(
|
|
name: "Members");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "Tactics");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "Teams");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "Users");
|
|
}
|
|
}
|
|
}
|