LANCommander/LANCommander.Server.Data.SQLite/Migrations/20240701040116_AddPlatforms.cs

92 lines
3.6 KiB
C#

using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace LANCommander.Migrations
{
/// <inheritdoc />
public partial class AddPlatforms : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "Platforms",
columns: table => new
{
Id = table.Column<Guid>(type: "TEXT", nullable: false),
CreatedOn = table.Column<DateTime>(type: "TEXT", nullable: false),
CreatedById = table.Column<Guid>(type: "TEXT", nullable: true),
UpdatedOn = table.Column<DateTime>(type: "TEXT", nullable: false),
UpdatedById = table.Column<Guid>(type: "TEXT", nullable: true),
Name = table.Column<string>(type: "TEXT", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Platforms", x => x.Id);
table.ForeignKey(
name: "FK_Platforms_AspNetUsers_CreatedById",
column: x => x.CreatedById,
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.SetNull);
table.ForeignKey(
name: "FK_Platforms_AspNetUsers_UpdatedById",
column: x => x.UpdatedById,
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.SetNull);
});
migrationBuilder.CreateTable(
name: "GamePlatform",
columns: table => new
{
GamesId = table.Column<Guid>(type: "TEXT", nullable: false),
PlatformsId = table.Column<Guid>(type: "TEXT", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_GamePlatform", x => new { x.GamesId, x.PlatformsId });
table.ForeignKey(
name: "FK_GamePlatform_Games_GamesId",
column: x => x.GamesId,
principalTable: "Games",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_GamePlatform_Platforms_PlatformsId",
column: x => x.PlatformsId,
principalTable: "Platforms",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_GamePlatform_PlatformsId",
table: "GamePlatform",
column: "PlatformsId");
migrationBuilder.CreateIndex(
name: "IX_Platforms_CreatedById",
table: "Platforms",
column: "CreatedById");
migrationBuilder.CreateIndex(
name: "IX_Platforms_UpdatedById",
table: "Platforms",
column: "UpdatedById");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "GamePlatform");
migrationBuilder.DropTable(
name: "Platforms");
}
}
}