using System; using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace TeleWave.Infrastructure.Migrations { /// public partial class DropLegacyRotation : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable(name: "ChannelAd"); migrationBuilder.DropTable(name: "ChannelShowHour"); migrationBuilder.DropTable(name: "OverrideShow"); migrationBuilder.DropTable(name: "ChannelShow"); migrationBuilder.DropTable(name: "ProgrammingOverride"); migrationBuilder.DropColumn(name: "AdInsertion", table: "Channels"); migrationBuilder.DropColumn(name: "AdsPerBreak", table: "Channels"); migrationBuilder.DropColumn(name: "NextAdIndex", table: "Channels"); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.AddColumn( name: "AdInsertion", table: "Channels", type: "integer", nullable: false, defaultValue: 0 ); migrationBuilder.AddColumn( name: "AdsPerBreak", table: "Channels", type: "integer", nullable: false, defaultValue: 0 ); migrationBuilder.AddColumn( name: "NextAdIndex", table: "Channels", type: "integer", nullable: false, defaultValue: 0 ); migrationBuilder.CreateTable( name: "ChannelAd", columns: table => new { Id = table.Column(type: "uuid", nullable: false), ChannelId = table.Column(type: "uuid", nullable: false), MediaAssetId = table.Column(type: "uuid", nullable: false), Position = table.Column(type: "integer", nullable: false), }, constraints: table => { table.PrimaryKey("PK_ChannelAd", x => x.Id); table.ForeignKey( name: "FK_ChannelAd_Channels_ChannelId", column: x => x.ChannelId, principalTable: "Channels", principalColumn: "Id", onDelete: ReferentialAction.Cascade ); } ); migrationBuilder.CreateTable( name: "ChannelShow", columns: table => new { Id = table.Column(type: "uuid", nullable: false), BlockMode = table.Column(type: "integer", nullable: false), BlockValue = table.Column(type: "integer", nullable: false), ChannelId = table.Column(type: "uuid", nullable: false), IsEnabled = table.Column(type: "boolean", nullable: false), NextEpisodeIndex = table.Column(type: "integer", nullable: false), PreferredWeightMultiplier = table.Column( type: "integer", nullable: false, defaultValue: 3 ), ShowId = table.Column(type: "uuid", nullable: false), Weight = table.Column(type: "integer", nullable: false), }, constraints: table => { table.PrimaryKey("PK_ChannelShow", x => x.Id); table.ForeignKey( name: "FK_ChannelShow_Channels_ChannelId", column: x => x.ChannelId, principalTable: "Channels", principalColumn: "Id", onDelete: ReferentialAction.Cascade ); } ); migrationBuilder.CreateTable( name: "ProgrammingOverride", columns: table => new { Id = table.Column(type: "uuid", nullable: false), ChannelId = table.Column(type: "uuid", nullable: false), DayOfWeek = table.Column(type: "integer", nullable: true), EndMinute = table.Column(type: "integer", nullable: true), EndsAtUtc = table.Column( type: "timestamp with time zone", nullable: true ), Mode = table.Column(type: "integer", nullable: false), Recurrence = table.Column(type: "integer", nullable: false), StartMinute = table.Column(type: "integer", nullable: true), StartsAtUtc = table.Column( type: "timestamp with time zone", nullable: true ), }, constraints: table => { table.PrimaryKey("PK_ProgrammingOverride", x => x.Id); table.ForeignKey( name: "FK_ProgrammingOverride_Channels_ChannelId", column: x => x.ChannelId, principalTable: "Channels", principalColumn: "Id", onDelete: ReferentialAction.Cascade ); } ); migrationBuilder.CreateTable( name: "ChannelShowHour", columns: table => new { Id = table.Column(type: "uuid", nullable: false), ChannelShowId = table.Column(type: "uuid", nullable: false), EndHour = table.Column(type: "integer", nullable: false), StartHour = table.Column(type: "integer", nullable: false), }, constraints: table => { table.PrimaryKey("PK_ChannelShowHour", x => x.Id); table.ForeignKey( name: "FK_ChannelShowHour_ChannelShow_ChannelShowId", column: x => x.ChannelShowId, principalTable: "ChannelShow", principalColumn: "Id", onDelete: ReferentialAction.Cascade ); } ); migrationBuilder.CreateTable( name: "OverrideShow", columns: table => new { Id = table.Column(type: "uuid", nullable: false), ProgrammingOverrideId = table.Column(type: "uuid", nullable: false), ShowId = table.Column(type: "uuid", nullable: false), Weight = table.Column(type: "integer", nullable: false), }, constraints: table => { table.PrimaryKey("PK_OverrideShow", x => x.Id); table.ForeignKey( name: "FK_OverrideShow_ProgrammingOverride_ProgrammingOverrideId", column: x => x.ProgrammingOverrideId, principalTable: "ProgrammingOverride", principalColumn: "Id", onDelete: ReferentialAction.Cascade ); } ); migrationBuilder.CreateIndex( name: "IX_ChannelAd_ChannelId_Position", table: "ChannelAd", columns: new[] { "ChannelId", "Position" } ); migrationBuilder.CreateIndex( name: "IX_ChannelShow_ChannelId_ShowId", table: "ChannelShow", columns: new[] { "ChannelId", "ShowId" } ); migrationBuilder.CreateIndex( name: "IX_ChannelShowHour_ChannelShowId", table: "ChannelShowHour", column: "ChannelShowId" ); migrationBuilder.CreateIndex( name: "IX_OverrideShow_ProgrammingOverrideId", table: "OverrideShow", column: "ProgrammingOverrideId" ); migrationBuilder.CreateIndex( name: "IX_ProgrammingOverride_ChannelId_StartsAtUtc_EndsAtUtc", table: "ProgrammingOverride", columns: new[] { "ChannelId", "StartsAtUtc", "EndsAtUtc" } ); } } }