using System; using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace LANCommander.Migrations { /// public partial class AddMediaEntity : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.CreateTable( name: "Media", columns: table => new { Id = table.Column(type: "TEXT", nullable: false), FileId = table.Column(type: "TEXT", nullable: false), Type = table.Column(type: "INTEGER", nullable: false), SourceUrl = table.Column(type: "TEXT", maxLength: 2048, nullable: false), GameId = 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) }, constraints: table => { table.PrimaryKey("PK_Media", x => x.Id); table.ForeignKey( name: "FK_Media_AspNetUsers_CreatedById", column: x => x.CreatedById, principalTable: "AspNetUsers", principalColumn: "Id"); table.ForeignKey( name: "FK_Media_AspNetUsers_UpdatedById", column: x => x.UpdatedById, principalTable: "AspNetUsers", principalColumn: "Id"); table.ForeignKey( name: "FK_Media_Games_GameId", column: x => x.GameId, principalTable: "Games", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateIndex( name: "IX_Media_CreatedById", table: "Media", column: "CreatedById"); migrationBuilder.CreateIndex( name: "IX_Media_GameId", table: "Media", column: "GameId"); migrationBuilder.CreateIndex( name: "IX_Media_UpdatedById", table: "Media", column: "UpdatedById"); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "Media"); } } }