using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace ErsatzTV.Infrastructure.MySql.Migrations { /// public partial class Add_PlayoutItemGraphicsElement : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.CreateTable( name: "GraphicsElement", columns: table => new { Id = table.Column(type: "int", nullable: false) .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), Path = table.Column(type: "longtext", nullable: true) .Annotation("MySql:CharSet", "utf8mb4"), Kind = table.Column(type: "int", nullable: false) }, constraints: table => { table.PrimaryKey("PK_GraphicsElement", x => x.Id); }) .Annotation("MySql:CharSet", "utf8mb4"); migrationBuilder.CreateTable( name: "PlayoutItemGraphicsElement", columns: table => new { PlayoutItemId = table.Column(type: "int", nullable: false), GraphicsElementId = table.Column(type: "int", nullable: false) }, constraints: table => { table.PrimaryKey("PK_PlayoutItemGraphicsElement", x => new { x.PlayoutItemId, x.GraphicsElementId }); table.ForeignKey( name: "FK_PlayoutItemGraphicsElement_GraphicsElement_GraphicsElementId", column: x => x.GraphicsElementId, principalTable: "GraphicsElement", principalColumn: "Id", onDelete: ReferentialAction.Cascade); table.ForeignKey( name: "FK_PlayoutItemGraphicsElement_PlayoutItem_PlayoutItemId", column: x => x.PlayoutItemId, principalTable: "PlayoutItem", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }) .Annotation("MySql:CharSet", "utf8mb4"); migrationBuilder.CreateIndex( name: "IX_PlayoutItemGraphicsElement_GraphicsElementId", table: "PlayoutItemGraphicsElement", column: "GraphicsElementId"); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "PlayoutItemGraphicsElement"); migrationBuilder.DropTable( name: "GraphicsElement"); } } }