using System; using Microsoft.EntityFrameworkCore.Migrations; using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; #nullable disable namespace Backend.Migrations { /// public partial class AddClipAdminMenuVisible : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.AddColumn( name: "ClipAdminMenuVisible", table: "SiteSettings", type: "boolean", nullable: false, defaultValue: false); migrationBuilder.AddColumn( name: "ShowactApplicationDisabledMessage", table: "SiteSettings", type: "character varying(240)", maxLength: 240, nullable: false, defaultValue: ""); migrationBuilder.AddColumn( name: "ShowactApplicationsEnabled", table: "SiteSettings", type: "boolean", nullable: false, defaultValue: false); migrationBuilder.AddColumn( name: "ShowactsContent", table: "SiteSettings", type: "text", nullable: false, defaultValue: ""); migrationBuilder.AddColumn( name: "ShowactsUrl", table: "SiteSettings", type: "character varying(400)", maxLength: 400, nullable: false, defaultValue: ""); migrationBuilder.AddColumn( name: "SponsorsVisible", table: "SiteSettings", type: "boolean", nullable: false, defaultValue: true); migrationBuilder.CreateTable( name: "ShowactApplications", columns: table => new { Id = table.Column(type: "integer", nullable: false) .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), SeasonId = table.Column(type: "integer", nullable: false), ArtistName = table.Column(type: "character varying(120)", maxLength: 120, nullable: false), ContactEmail = table.Column(type: "character varying(180)", maxLength: 180, nullable: false), ContactDiscord = table.Column(type: "character varying(120)", maxLength: 120, nullable: false), PlatformUrl = table.Column(type: "character varying(500)", maxLength: 500, nullable: false), PerformanceType = table.Column(type: "character varying(80)", maxLength: 80, nullable: false), Description = table.Column(type: "character varying(1000)", maxLength: 1000, nullable: false), TechnicalNotes = table.Column(type: "character varying(1000)", maxLength: 1000, nullable: false), ReferenceUrl = table.Column(type: "character varying(500)", maxLength: 500, nullable: false), Status = table.Column(type: "character varying(20)", maxLength: 20, nullable: false), ReviewNote = table.Column(type: "character varying(500)", maxLength: 500, nullable: true), ReviewedByTwitchId = table.Column(type: "character varying(120)", maxLength: 120, nullable: true), CreatedFromIp = table.Column(type: "character varying(80)", maxLength: 80, nullable: false), UserAgent = table.Column(type: "character varying(400)", maxLength: 400, nullable: false), CreatedAt = table.Column(type: "timestamp with time zone", nullable: false), ReviewedAt = table.Column(type: "timestamp with time zone", nullable: true) }, constraints: table => { table.PrimaryKey("PK_ShowactApplications", x => x.Id); table.ForeignKey( name: "FK_ShowactApplications_Seasons_SeasonId", column: x => x.SeasonId, principalTable: "Seasons", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateTable( name: "Sponsors", columns: table => new { Id = table.Column(type: "integer", nullable: false) .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), SeasonId = table.Column(type: "integer", nullable: false), Name = table.Column(type: "character varying(120)", maxLength: 120, nullable: false), WebsiteUrl = table.Column(type: "character varying(500)", maxLength: 500, nullable: false), LogoUrl = table.Column(type: "character varying(500)", maxLength: 500, nullable: false), Description = table.Column(type: "character varying(500)", maxLength: 500, nullable: false), Tier = table.Column(type: "character varying(80)", maxLength: 80, nullable: false), SortOrder = table.Column(type: "integer", nullable: false), IsVisible = table.Column(type: "boolean", nullable: false), CreatedAt = table.Column(type: "timestamp with time zone", nullable: false), UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true) }, constraints: table => { table.PrimaryKey("PK_Sponsors", x => x.Id); table.ForeignKey( name: "FK_Sponsors_Seasons_SeasonId", column: x => x.SeasonId, principalTable: "Seasons", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }); migrationBuilder.UpdateData( table: "SiteSettings", keyColumn: "Id", keyValue: 1, columns: new[] { "ClipAdminMenuVisible", "ShowactApplicationDisabledMessage", "ShowactsContent", "ShowactsUrl", "SponsorsVisible", "WorkflowRulesJson" }, values: new object[] { true, "Showact-Bewerbungen sind aktuell geschlossen.", "Informationen zu Showact-Bewerbungen, Ablauf und Kontakt fuer die Award-Show.", "https://vtuber-star-awards.de/showacts", true, "[{\"key\":\"max_finalists_per_category\",\"label\":\"Finale Kandidat:innen pro Kategorie\",\"enabled\":true,\"limit\":4,\"mode\":\"block\",\"description\":\"Begrenzt, wie viele finale Kandidat:innen in einer Kategorie vorbereitet werden.\"},{\"key\":\"max_candidate_appearances\",\"label\":\"Kandidaturen pro Person\",\"enabled\":true,\"limit\":2,\"mode\":\"warn\",\"description\":\"Warnt oder blockiert, wenn dieselbe Person in zu vielen Kategorien final auftaucht.\"},{\"key\":\"max_winner_placements\",\"label\":\"Gewinnerpl\\u00E4tze pro Person\",\"enabled\":true,\"limit\":1,\"mode\":\"block\",\"description\":\"Verhindert oder warnt, wenn dieselbe Person mehrfach als Gewinner:in gesetzt wird.\"},{\"key\":\"winner_requires_clip\",\"label\":\"Gewinner braucht Clip-Link\",\"enabled\":true,\"limit\":1,\"mode\":\"block\",\"description\":\"Verhindert oder warnt, wenn ein Gewinner ohne gepflegten YouTube-/Twitch-Clip gesetzt wird.\"}]" }); migrationBuilder.CreateIndex( name: "IX_ShowactApplications_SeasonId_Status", table: "ShowactApplications", columns: new[] { "SeasonId", "Status" }); migrationBuilder.CreateIndex( name: "IX_Sponsors_SeasonId_IsVisible_SortOrder", table: "Sponsors", columns: new[] { "SeasonId", "IsVisible", "SortOrder" }); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "ShowactApplications"); migrationBuilder.DropTable( name: "Sponsors"); migrationBuilder.DropColumn( name: "ClipAdminMenuVisible", table: "SiteSettings"); migrationBuilder.DropColumn( name: "ShowactApplicationDisabledMessage", table: "SiteSettings"); migrationBuilder.DropColumn( name: "ShowactApplicationsEnabled", table: "SiteSettings"); migrationBuilder.DropColumn( name: "ShowactsContent", table: "SiteSettings"); migrationBuilder.DropColumn( name: "ShowactsUrl", table: "SiteSettings"); migrationBuilder.DropColumn( name: "SponsorsVisible", table: "SiteSettings"); migrationBuilder.UpdateData( table: "SiteSettings", keyColumn: "Id", keyValue: 1, column: "WorkflowRulesJson", value: "[{\"key\":\"max_finalists_per_category\",\"label\":\"Finale Kandidat:innen pro Kategorie\",\"enabled\":true,\"limit\":4,\"mode\":\"block\",\"description\":\"Begrenzt, wie viele finale Kandidat:innen in einer Kategorie vorbereitet werden.\"},{\"key\":\"max_candidate_appearances\",\"label\":\"Kandidaturen pro Person\",\"enabled\":true,\"limit\":2,\"mode\":\"warn\",\"description\":\"Warnt oder blockiert, wenn dieselbe Person in zu vielen Kategorien final auftaucht.\"},{\"key\":\"max_winner_placements\",\"label\":\"Gewinnerpl\\u00E4tze pro Person\",\"enabled\":true,\"limit\":1,\"mode\":\"block\",\"description\":\"Verhindert oder warnt, wenn dieselbe Person mehrfach als Gewinner:in gesetzt wird.\"}]"); } } }