|
|
|
@ -0,0 +1,393 @@ |
|
|
|
|
using System; |
|
|
|
|
using Microsoft.EntityFrameworkCore.Migrations; |
|
|
|
|
|
|
|
|
|
#nullable disable |
|
|
|
|
|
|
|
|
|
namespace DreamsCaster.Migrations |
|
|
|
|
{ |
|
|
|
|
public partial class Initial : Migration |
|
|
|
|
{ |
|
|
|
|
protected override void Up(MigrationBuilder migrationBuilder) |
|
|
|
|
{ |
|
|
|
|
migrationBuilder.AlterDatabase() |
|
|
|
|
.Annotation("MySql:CharSet", "utf8mb4"); |
|
|
|
|
|
|
|
|
|
migrationBuilder.CreateTable( |
|
|
|
|
name: "Developers", |
|
|
|
|
columns: table => new |
|
|
|
|
{ |
|
|
|
|
Id = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"), |
|
|
|
|
Name = table.Column<string>(type: "longtext", nullable: false) |
|
|
|
|
.Annotation("MySql:CharSet", "utf8mb4") |
|
|
|
|
}, |
|
|
|
|
constraints: table => |
|
|
|
|
{ |
|
|
|
|
table.PrimaryKey("PK_Developers", x => x.Id); |
|
|
|
|
}) |
|
|
|
|
.Annotation("MySql:CharSet", "utf8mb4"); |
|
|
|
|
|
|
|
|
|
migrationBuilder.CreateTable( |
|
|
|
|
name: "Manufacturers", |
|
|
|
|
columns: table => new |
|
|
|
|
{ |
|
|
|
|
Id = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"), |
|
|
|
|
Name = table.Column<string>(type: "longtext", nullable: false) |
|
|
|
|
.Annotation("MySql:CharSet", "utf8mb4") |
|
|
|
|
}, |
|
|
|
|
constraints: table => |
|
|
|
|
{ |
|
|
|
|
table.PrimaryKey("PK_Manufacturers", x => x.Id); |
|
|
|
|
}) |
|
|
|
|
.Annotation("MySql:CharSet", "utf8mb4"); |
|
|
|
|
|
|
|
|
|
migrationBuilder.CreateTable( |
|
|
|
|
name: "Publishers", |
|
|
|
|
columns: table => new |
|
|
|
|
{ |
|
|
|
|
Id = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"), |
|
|
|
|
Name = table.Column<string>(type: "longtext", nullable: false) |
|
|
|
|
.Annotation("MySql:CharSet", "utf8mb4") |
|
|
|
|
}, |
|
|
|
|
constraints: table => |
|
|
|
|
{ |
|
|
|
|
table.PrimaryKey("PK_Publishers", x => x.Id); |
|
|
|
|
}) |
|
|
|
|
.Annotation("MySql:CharSet", "utf8mb4"); |
|
|
|
|
|
|
|
|
|
migrationBuilder.CreateTable( |
|
|
|
|
name: "DevelopersMetaData", |
|
|
|
|
columns: table => new |
|
|
|
|
{ |
|
|
|
|
Id = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"), |
|
|
|
|
Description = table.Column<string>(type: "longtext", nullable: false) |
|
|
|
|
.Annotation("MySql:CharSet", "utf8mb4"), |
|
|
|
|
CoverPhoto = table.Column<string>(type: "longtext", nullable: false) |
|
|
|
|
.Annotation("MySql:CharSet", "utf8mb4"), |
|
|
|
|
OwnerId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci") |
|
|
|
|
}, |
|
|
|
|
constraints: table => |
|
|
|
|
{ |
|
|
|
|
table.PrimaryKey("PK_DevelopersMetaData", x => x.Id); |
|
|
|
|
table.ForeignKey( |
|
|
|
|
name: "FK_DevelopersMetaData_Developers_OwnerId", |
|
|
|
|
column: x => x.OwnerId, |
|
|
|
|
principalTable: "Developers", |
|
|
|
|
principalColumn: "Id", |
|
|
|
|
onDelete: ReferentialAction.Cascade); |
|
|
|
|
}) |
|
|
|
|
.Annotation("MySql:CharSet", "utf8mb4"); |
|
|
|
|
|
|
|
|
|
migrationBuilder.CreateTable( |
|
|
|
|
name: "Consoles", |
|
|
|
|
columns: table => new |
|
|
|
|
{ |
|
|
|
|
Id = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"), |
|
|
|
|
ManufacturerId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"), |
|
|
|
|
Name = table.Column<string>(type: "longtext", nullable: false) |
|
|
|
|
.Annotation("MySql:CharSet", "utf8mb4") |
|
|
|
|
}, |
|
|
|
|
constraints: table => |
|
|
|
|
{ |
|
|
|
|
table.PrimaryKey("PK_Consoles", x => x.Id); |
|
|
|
|
table.ForeignKey( |
|
|
|
|
name: "FK_Consoles_Manufacturers_ManufacturerId", |
|
|
|
|
column: x => x.ManufacturerId, |
|
|
|
|
principalTable: "Manufacturers", |
|
|
|
|
principalColumn: "Id", |
|
|
|
|
onDelete: ReferentialAction.Cascade); |
|
|
|
|
}) |
|
|
|
|
.Annotation("MySql:CharSet", "utf8mb4"); |
|
|
|
|
|
|
|
|
|
migrationBuilder.CreateTable( |
|
|
|
|
name: "ManufacturersMetaData", |
|
|
|
|
columns: table => new |
|
|
|
|
{ |
|
|
|
|
Id = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"), |
|
|
|
|
Description = table.Column<string>(type: "longtext", nullable: false) |
|
|
|
|
.Annotation("MySql:CharSet", "utf8mb4"), |
|
|
|
|
CoverPhoto = table.Column<string>(type: "longtext", nullable: false) |
|
|
|
|
.Annotation("MySql:CharSet", "utf8mb4"), |
|
|
|
|
OwnerId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci") |
|
|
|
|
}, |
|
|
|
|
constraints: table => |
|
|
|
|
{ |
|
|
|
|
table.PrimaryKey("PK_ManufacturersMetaData", x => x.Id); |
|
|
|
|
table.ForeignKey( |
|
|
|
|
name: "FK_ManufacturersMetaData_Manufacturers_OwnerId", |
|
|
|
|
column: x => x.OwnerId, |
|
|
|
|
principalTable: "Manufacturers", |
|
|
|
|
principalColumn: "Id", |
|
|
|
|
onDelete: ReferentialAction.Cascade); |
|
|
|
|
}) |
|
|
|
|
.Annotation("MySql:CharSet", "utf8mb4"); |
|
|
|
|
|
|
|
|
|
migrationBuilder.CreateTable( |
|
|
|
|
name: "PublishersMetaData", |
|
|
|
|
columns: table => new |
|
|
|
|
{ |
|
|
|
|
Id = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"), |
|
|
|
|
Description = table.Column<string>(type: "longtext", nullable: false) |
|
|
|
|
.Annotation("MySql:CharSet", "utf8mb4"), |
|
|
|
|
CoverPhoto = table.Column<string>(type: "longtext", nullable: false) |
|
|
|
|
.Annotation("MySql:CharSet", "utf8mb4"), |
|
|
|
|
OwnerId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci") |
|
|
|
|
}, |
|
|
|
|
constraints: table => |
|
|
|
|
{ |
|
|
|
|
table.PrimaryKey("PK_PublishersMetaData", x => x.Id); |
|
|
|
|
table.ForeignKey( |
|
|
|
|
name: "FK_PublishersMetaData_Publishers_OwnerId", |
|
|
|
|
column: x => x.OwnerId, |
|
|
|
|
principalTable: "Publishers", |
|
|
|
|
principalColumn: "Id", |
|
|
|
|
onDelete: ReferentialAction.Cascade); |
|
|
|
|
}) |
|
|
|
|
.Annotation("MySql:CharSet", "utf8mb4"); |
|
|
|
|
|
|
|
|
|
migrationBuilder.CreateTable( |
|
|
|
|
name: "ConsolesMetaData", |
|
|
|
|
columns: table => new |
|
|
|
|
{ |
|
|
|
|
Id = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"), |
|
|
|
|
Description = table.Column<string>(type: "longtext", nullable: false) |
|
|
|
|
.Annotation("MySql:CharSet", "utf8mb4"), |
|
|
|
|
CoverPhoto = table.Column<string>(type: "longtext", nullable: false) |
|
|
|
|
.Annotation("MySql:CharSet", "utf8mb4"), |
|
|
|
|
OwnerId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci") |
|
|
|
|
}, |
|
|
|
|
constraints: table => |
|
|
|
|
{ |
|
|
|
|
table.PrimaryKey("PK_ConsolesMetaData", x => x.Id); |
|
|
|
|
table.ForeignKey( |
|
|
|
|
name: "FK_ConsolesMetaData_Consoles_OwnerId", |
|
|
|
|
column: x => x.OwnerId, |
|
|
|
|
principalTable: "Consoles", |
|
|
|
|
principalColumn: "Id", |
|
|
|
|
onDelete: ReferentialAction.Cascade); |
|
|
|
|
}) |
|
|
|
|
.Annotation("MySql:CharSet", "utf8mb4"); |
|
|
|
|
|
|
|
|
|
migrationBuilder.CreateTable( |
|
|
|
|
name: "Games", |
|
|
|
|
columns: table => new |
|
|
|
|
{ |
|
|
|
|
Id = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"), |
|
|
|
|
ConsoleId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"), |
|
|
|
|
Name = table.Column<string>(type: "longtext", nullable: false) |
|
|
|
|
.Annotation("MySql:CharSet", "utf8mb4") |
|
|
|
|
}, |
|
|
|
|
constraints: table => |
|
|
|
|
{ |
|
|
|
|
table.PrimaryKey("PK_Games", x => x.Id); |
|
|
|
|
table.ForeignKey( |
|
|
|
|
name: "FK_Games_Consoles_ConsoleId", |
|
|
|
|
column: x => x.ConsoleId, |
|
|
|
|
principalTable: "Consoles", |
|
|
|
|
principalColumn: "Id"); |
|
|
|
|
}) |
|
|
|
|
.Annotation("MySql:CharSet", "utf8mb4"); |
|
|
|
|
|
|
|
|
|
migrationBuilder.CreateTable( |
|
|
|
|
name: "DeveloperGame", |
|
|
|
|
columns: table => new |
|
|
|
|
{ |
|
|
|
|
DevelopersId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"), |
|
|
|
|
GamesId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci") |
|
|
|
|
}, |
|
|
|
|
constraints: table => |
|
|
|
|
{ |
|
|
|
|
table.PrimaryKey("PK_DeveloperGame", x => new { x.DevelopersId, x.GamesId }); |
|
|
|
|
table.ForeignKey( |
|
|
|
|
name: "FK_DeveloperGame_Developers_DevelopersId", |
|
|
|
|
column: x => x.DevelopersId, |
|
|
|
|
principalTable: "Developers", |
|
|
|
|
principalColumn: "Id", |
|
|
|
|
onDelete: ReferentialAction.Cascade); |
|
|
|
|
table.ForeignKey( |
|
|
|
|
name: "FK_DeveloperGame_Games_GamesId", |
|
|
|
|
column: x => x.GamesId, |
|
|
|
|
principalTable: "Games", |
|
|
|
|
principalColumn: "Id", |
|
|
|
|
onDelete: ReferentialAction.Cascade); |
|
|
|
|
}) |
|
|
|
|
.Annotation("MySql:CharSet", "utf8mb4"); |
|
|
|
|
|
|
|
|
|
migrationBuilder.CreateTable( |
|
|
|
|
name: "GamePublisher", |
|
|
|
|
columns: table => new |
|
|
|
|
{ |
|
|
|
|
GamesId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"), |
|
|
|
|
PublishersId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci") |
|
|
|
|
}, |
|
|
|
|
constraints: table => |
|
|
|
|
{ |
|
|
|
|
table.PrimaryKey("PK_GamePublisher", x => new { x.GamesId, x.PublishersId }); |
|
|
|
|
table.ForeignKey( |
|
|
|
|
name: "FK_GamePublisher_Games_GamesId", |
|
|
|
|
column: x => x.GamesId, |
|
|
|
|
principalTable: "Games", |
|
|
|
|
principalColumn: "Id", |
|
|
|
|
onDelete: ReferentialAction.Cascade); |
|
|
|
|
table.ForeignKey( |
|
|
|
|
name: "FK_GamePublisher_Publishers_PublishersId", |
|
|
|
|
column: x => x.PublishersId, |
|
|
|
|
principalTable: "Publishers", |
|
|
|
|
principalColumn: "Id", |
|
|
|
|
onDelete: ReferentialAction.Cascade); |
|
|
|
|
}) |
|
|
|
|
.Annotation("MySql:CharSet", "utf8mb4"); |
|
|
|
|
|
|
|
|
|
migrationBuilder.CreateTable( |
|
|
|
|
name: "GamesMetaData", |
|
|
|
|
columns: table => new |
|
|
|
|
{ |
|
|
|
|
Id = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"), |
|
|
|
|
Description = table.Column<string>(type: "longtext", nullable: false) |
|
|
|
|
.Annotation("MySql:CharSet", "utf8mb4"), |
|
|
|
|
CoverPhoto = table.Column<string>(type: "longtext", nullable: false) |
|
|
|
|
.Annotation("MySql:CharSet", "utf8mb4"), |
|
|
|
|
OwnerId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci") |
|
|
|
|
}, |
|
|
|
|
constraints: table => |
|
|
|
|
{ |
|
|
|
|
table.PrimaryKey("PK_GamesMetaData", x => x.Id); |
|
|
|
|
table.ForeignKey( |
|
|
|
|
name: "FK_GamesMetaData_Games_OwnerId", |
|
|
|
|
column: x => x.OwnerId, |
|
|
|
|
principalTable: "Games", |
|
|
|
|
principalColumn: "Id", |
|
|
|
|
onDelete: ReferentialAction.Cascade); |
|
|
|
|
}) |
|
|
|
|
.Annotation("MySql:CharSet", "utf8mb4"); |
|
|
|
|
|
|
|
|
|
migrationBuilder.CreateTable( |
|
|
|
|
name: "Releases", |
|
|
|
|
columns: table => new |
|
|
|
|
{ |
|
|
|
|
Id = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"), |
|
|
|
|
ReleaseDate = table.Column<DateTime>(type: "datetime(6)", nullable: false), |
|
|
|
|
GameId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"), |
|
|
|
|
ConsoleId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci") |
|
|
|
|
}, |
|
|
|
|
constraints: table => |
|
|
|
|
{ |
|
|
|
|
table.PrimaryKey("PK_Releases", x => x.Id); |
|
|
|
|
table.ForeignKey( |
|
|
|
|
name: "FK_Releases_Consoles_ConsoleId", |
|
|
|
|
column: x => x.ConsoleId, |
|
|
|
|
principalTable: "Consoles", |
|
|
|
|
principalColumn: "Id", |
|
|
|
|
onDelete: ReferentialAction.Cascade); |
|
|
|
|
table.ForeignKey( |
|
|
|
|
name: "FK_Releases_Games_GameId", |
|
|
|
|
column: x => x.GameId, |
|
|
|
|
principalTable: "Games", |
|
|
|
|
principalColumn: "Id", |
|
|
|
|
onDelete: ReferentialAction.Cascade); |
|
|
|
|
}) |
|
|
|
|
.Annotation("MySql:CharSet", "utf8mb4"); |
|
|
|
|
|
|
|
|
|
migrationBuilder.CreateIndex( |
|
|
|
|
name: "IX_Consoles_ManufacturerId", |
|
|
|
|
table: "Consoles", |
|
|
|
|
column: "ManufacturerId"); |
|
|
|
|
|
|
|
|
|
migrationBuilder.CreateIndex( |
|
|
|
|
name: "IX_ConsolesMetaData_OwnerId", |
|
|
|
|
table: "ConsolesMetaData", |
|
|
|
|
column: "OwnerId", |
|
|
|
|
unique: true); |
|
|
|
|
|
|
|
|
|
migrationBuilder.CreateIndex( |
|
|
|
|
name: "IX_DeveloperGame_GamesId", |
|
|
|
|
table: "DeveloperGame", |
|
|
|
|
column: "GamesId"); |
|
|
|
|
|
|
|
|
|
migrationBuilder.CreateIndex( |
|
|
|
|
name: "IX_DevelopersMetaData_OwnerId", |
|
|
|
|
table: "DevelopersMetaData", |
|
|
|
|
column: "OwnerId", |
|
|
|
|
unique: true); |
|
|
|
|
|
|
|
|
|
migrationBuilder.CreateIndex( |
|
|
|
|
name: "IX_GamePublisher_PublishersId", |
|
|
|
|
table: "GamePublisher", |
|
|
|
|
column: "PublishersId"); |
|
|
|
|
|
|
|
|
|
migrationBuilder.CreateIndex( |
|
|
|
|
name: "IX_Games_ConsoleId", |
|
|
|
|
table: "Games", |
|
|
|
|
column: "ConsoleId"); |
|
|
|
|
|
|
|
|
|
migrationBuilder.CreateIndex( |
|
|
|
|
name: "IX_GamesMetaData_OwnerId", |
|
|
|
|
table: "GamesMetaData", |
|
|
|
|
column: "OwnerId", |
|
|
|
|
unique: true); |
|
|
|
|
|
|
|
|
|
migrationBuilder.CreateIndex( |
|
|
|
|
name: "IX_ManufacturersMetaData_OwnerId", |
|
|
|
|
table: "ManufacturersMetaData", |
|
|
|
|
column: "OwnerId", |
|
|
|
|
unique: true); |
|
|
|
|
|
|
|
|
|
migrationBuilder.CreateIndex( |
|
|
|
|
name: "IX_PublishersMetaData_OwnerId", |
|
|
|
|
table: "PublishersMetaData", |
|
|
|
|
column: "OwnerId", |
|
|
|
|
unique: true); |
|
|
|
|
|
|
|
|
|
migrationBuilder.CreateIndex( |
|
|
|
|
name: "IX_Releases_ConsoleId", |
|
|
|
|
table: "Releases", |
|
|
|
|
column: "ConsoleId"); |
|
|
|
|
|
|
|
|
|
migrationBuilder.CreateIndex( |
|
|
|
|
name: "IX_Releases_GameId", |
|
|
|
|
table: "Releases", |
|
|
|
|
column: "GameId"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
protected override void Down(MigrationBuilder migrationBuilder) |
|
|
|
|
{ |
|
|
|
|
migrationBuilder.DropTable( |
|
|
|
|
name: "ConsolesMetaData"); |
|
|
|
|
|
|
|
|
|
migrationBuilder.DropTable( |
|
|
|
|
name: "DeveloperGame"); |
|
|
|
|
|
|
|
|
|
migrationBuilder.DropTable( |
|
|
|
|
name: "DevelopersMetaData"); |
|
|
|
|
|
|
|
|
|
migrationBuilder.DropTable( |
|
|
|
|
name: "GamePublisher"); |
|
|
|
|
|
|
|
|
|
migrationBuilder.DropTable( |
|
|
|
|
name: "GamesMetaData"); |
|
|
|
|
|
|
|
|
|
migrationBuilder.DropTable( |
|
|
|
|
name: "ManufacturersMetaData"); |
|
|
|
|
|
|
|
|
|
migrationBuilder.DropTable( |
|
|
|
|
name: "PublishersMetaData"); |
|
|
|
|
|
|
|
|
|
migrationBuilder.DropTable( |
|
|
|
|
name: "Releases"); |
|
|
|
|
|
|
|
|
|
migrationBuilder.DropTable( |
|
|
|
|
name: "Developers"); |
|
|
|
|
|
|
|
|
|
migrationBuilder.DropTable( |
|
|
|
|
name: "Publishers"); |
|
|
|
|
|
|
|
|
|
migrationBuilder.DropTable( |
|
|
|
|
name: "Games"); |
|
|
|
|
|
|
|
|
|
migrationBuilder.DropTable( |
|
|
|
|
name: "Consoles"); |
|
|
|
|
|
|
|
|
|
migrationBuilder.DropTable( |
|
|
|
|
name: "Manufacturers"); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |