using System; using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace LANCommander.Migrations { /// public partial class AddPlatforms : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.CreateTable( name: "Platforms", columns: table => new { Id = table.Column(type: "TEXT", nullable: false), CreatedOn = table.Column(type: "TEXT", nullable: false), CreatedById = table.Column(type: "TEXT", nullable: true), UpdatedOn = table.Column(type: "TEXT", nullable: false), UpdatedById = table.Column(type: "TEXT", nullable: true), Name = table.Column(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(type: "TEXT", nullable: false), PlatformsId = table.Column(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"); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "GamePlatform"); migrationBuilder.DropTable( name: "Platforms"); } } }