using System;
using Microsoft.EntityFrameworkCore.Migrations;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
#nullable disable
namespace Backend.Migrations
{
///
public partial class InitialCleanBaseline : Migration
{
///
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "AdminAuditEntries",
columns: table => new
{
Id = table.Column(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
AdminTwitchUserId = table.Column(type: "character varying(120)", maxLength: 120, nullable: false),
ActionType = table.Column(type: "character varying(80)", maxLength: 80, nullable: false),
EntityType = table.Column(type: "character varying(80)", maxLength: 80, nullable: false),
EntityId = table.Column(type: "character varying(120)", maxLength: 120, nullable: false),
Summary = table.Column(type: "character varying(240)", maxLength: 240, nullable: false),
MetadataJson = table.Column(type: "text", nullable: false),
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)
},
constraints: table =>
{
table.PrimaryKey("PK_AdminAuditEntries", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Seasons",
columns: table => new
{
Id = table.Column(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
Year = table.Column(type: "integer", nullable: false),
Name = table.Column(type: "character varying(160)", maxLength: 160, nullable: false),
IsDemo = table.Column(type: "boolean", nullable: false, defaultValue: false),
IsCurrent = table.Column(type: "boolean", nullable: false),
IsCommunityOnly = table.Column(type: "boolean", nullable: false),
CurrentPhase = table.Column(type: "character varying(60)", maxLength: 60, nullable: false),
NominationStartsAt = table.Column(type: "date", nullable: false),
NominationEndsAt = table.Column(type: "date", nullable: false),
VotingStartsAt = table.Column(type: "date", nullable: false),
VotingEndsAt = table.Column(type: "date", nullable: false),
ReviewStartsAt = table.Column(type: "date", nullable: false),
ReviewEndsAt = table.Column(type: "date", nullable: false),
ShowDate = table.Column(type: "date", nullable: false),
ShowStartsAt = table.Column(type: "time without time zone", nullable: false),
WinnersPublishedAt = table.Column(type: "timestamp with time zone", nullable: true),
WinnersPublishedByTwitchId = table.Column(type: "character varying(120)", maxLength: 120, nullable: true),
SubcategoryTemplatesJson = table.Column(type: "text", nullable: false, defaultValue: "[]"),
WorkflowRulesJson = table.Column(type: "text", nullable: false, defaultValue: "[]")
},
constraints: table =>
{
table.PrimaryKey("PK_Seasons", x => x.Id);
});
migrationBuilder.CreateTable(
name: "SiteSettings",
columns: table => new
{
Id = table.Column(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
HostDisplayName = table.Column(type: "character varying(120)", maxLength: 120, nullable: false),
HostTagline = table.Column(type: "character varying(160)", maxLength: 160, nullable: false),
NewsletterUrl = table.Column(type: "character varying(400)", maxLength: 400, nullable: false),
ShareXUrl = table.Column(type: "text", nullable: false),
ShareDiscordUrl = table.Column(type: "text", nullable: false),
PrivacyEmail = table.Column(type: "character varying(160)", maxLength: 160, nullable: false),
PrivacyPolicyContent = table.Column(type: "text", nullable: false),
PrivacyPolicyUpdatedBy = table.Column(type: "character varying(120)", maxLength: 120, nullable: true),
PrivacyPolicyUpdatedAt = table.Column(type: "timestamp with time zone", nullable: true),
ImprintUrl = table.Column(type: "character varying(400)", maxLength: 400, nullable: false),
ImprintContent = table.Column(type: "text", nullable: false),
ContactUrl = table.Column(type: "character varying(400)", maxLength: 400, nullable: false),
ContactContent = table.Column(type: "text", nullable: false),
SponsorsUrl = table.Column(type: "character varying(400)", maxLength: 400, nullable: false),
SponsorsContent = table.Column(type: "text", nullable: false),
ShowactsUrl = table.Column(type: "character varying(400)", maxLength: 400, nullable: false),
ShowactsContent = table.Column(type: "text", nullable: false, defaultValue: ""),
StreamBannerEyebrow = table.Column(type: "character varying(120)", maxLength: 120, nullable: false),
StreamBannerTitle = table.Column(type: "character varying(160)", maxLength: 160, nullable: false),
StreamBannerText = table.Column(type: "text", nullable: false),
StreamBannerLiveButtonLabel = table.Column(type: "character varying(120)", maxLength: 120, nullable: false),
StreamBannerLiveButtonUrl = table.Column(type: "character varying(400)", maxLength: 400, nullable: false),
StreamBannerLockedButtonLabel = table.Column(type: "character varying(120)", maxLength: 120, nullable: false),
StreamBannerUseCompletedContent = table.Column(type: "boolean", nullable: false),
StreamBannerCompletedEyebrow = table.Column(type: "character varying(120)", maxLength: 120, nullable: false),
StreamBannerCompletedTitle = table.Column(type: "character varying(160)", maxLength: 160, nullable: false),
StreamBannerCompletedText = table.Column(type: "text", nullable: false),
StreamBannerCompletedButtonLabel = table.Column(type: "character varying(120)", maxLength: 120, nullable: false),
StreamBannerCompletedButtonUrl = table.Column(type: "character varying(400)", maxLength: 400, nullable: false),
AwardsSectionTitle = table.Column(type: "text", nullable: false),
AwardsSectionDescription = table.Column(type: "text", nullable: false),
SubcategoriesSectionTitle = table.Column(type: "text", nullable: false),
SubcategoriesSectionDescription = table.Column(type: "text", nullable: false),
SocialLinksJson = table.Column(type: "text", nullable: false),
FaqJson = table.Column(type: "text", nullable: false),
RiskRulesJson = table.Column(type: "text", nullable: false),
WorkflowRulesJson = table.Column(type: "text", nullable: false, defaultValue: "[]"),
TrackingRulesJson = table.Column(type: "text", nullable: false, defaultValue: "[]"),
ViewerStatsProviderBaseUrl = table.Column(type: "character varying(400)", maxLength: 400, nullable: false),
TrackingReviewNotes = table.Column(type: "text", nullable: false),
NominationLinkBlacklistJson = table.Column(type: "text", nullable: false, defaultValue: "[]"),
ClipSubmissionsEnabled = table.Column(type: "boolean", nullable: false, defaultValue: false),
ClipReviewEnabled = table.Column(type: "boolean", nullable: false, defaultValue: true),
ClipAdminMenuVisible = table.Column(type: "boolean", nullable: false),
ClipSubmissionDisabledMessage = table.Column(type: "character varying(240)", maxLength: 240, nullable: false),
ShowactApplicationsEnabled = table.Column(type: "boolean", nullable: false, defaultValue: false),
ShowactApplicationStartsAt = table.Column(type: "date", nullable: true),
ShowactApplicationEndsAt = table.Column(type: "date", nullable: true),
ShowactApplicationDisabledMessage = table.Column(type: "character varying(240)", maxLength: 240, nullable: false),
ShowactFormSchemaJson = table.Column(type: "text", nullable: false),
SponsorsVisible = table.Column(type: "boolean", nullable: false, defaultValue: true),
DemoLoginManagedByDatabase = table.Column(type: "boolean", nullable: false),
DemoLoginEnabled = table.Column(type: "boolean", nullable: false),
DemoLoginEmail = table.Column(type: "character varying(180)", maxLength: 180, nullable: false),
DemoLoginPasswordHash = table.Column(type: "character varying(120)", maxLength: 120, nullable: false),
DemoLoginPasswordSalt = table.Column(type: "character varying(80)", maxLength: 80, nullable: false),
DemoLoginTwitchUserId = table.Column(type: "character varying(120)", maxLength: 120, nullable: false),
DemoLoginDisplayName = table.Column(type: "character varying(120)", maxLength: 120, nullable: false),
TwitchAuthManagedByDatabase = table.Column(type: "boolean", nullable: false),
TwitchClientId = table.Column(type: "character varying(120)", maxLength: 120, nullable: false),
TwitchClientSecret = table.Column(type: "character varying(180)", maxLength: 180, nullable: false),
TwitchRedirectUri = table.Column(type: "character varying(400)", maxLength: 400, nullable: false),
TwitchScope = table.Column(type: "character varying(300)", maxLength: 300, nullable: false),
SessionIdleTimeoutHours = table.Column(type: "integer", nullable: false, defaultValue: 3),
MaintenanceModeEnabled = table.Column(type: "boolean", nullable: false),
MaintenanceTitle = table.Column(type: "character varying(120)", maxLength: 120, nullable: false),
MaintenanceMessage = table.Column(type: "character varying(600)", maxLength: 600, nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_SiteSettings", x => x.Id);
});
migrationBuilder.CreateTable(
name: "StreamerIdentities",
columns: table => new
{
Id = table.Column(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
Platform = table.Column(type: "character varying(40)", maxLength: 40, nullable: false),
Login = table.Column(type: "character varying(120)", maxLength: 120, nullable: false),
NormalizedKey = table.Column(type: "character varying(180)", maxLength: 180, nullable: false),
DisplayName = table.Column(type: "character varying(120)", maxLength: 120, nullable: false),
ProfileUrl = table.Column(type: "character varying(500)", maxLength: 500, nullable: true),
LastResolvedAt = table.Column(type: "timestamp with time zone", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_StreamerIdentities", x => x.Id);
});
migrationBuilder.CreateTable(
name: "TeamMembers",
columns: table => new
{
Id = table.Column(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
Login = table.Column(type: "character varying(80)", maxLength: 80, nullable: false),
DisplayName = table.Column(type: "character varying(120)", maxLength: 120, nullable: false),
Role = table.Column(type: "character varying(40)", maxLength: 40, nullable: false),
PasswordHash = table.Column(type: "character varying(120)", maxLength: 120, nullable: false),
PasswordSalt = table.Column(type: "character varying(80)", maxLength: 80, nullable: false),
BoundTwitchUserId = table.Column(type: "character varying(120)", maxLength: 120, nullable: true),
BoundTwitchDisplayName = table.Column(type: "character varying(120)", maxLength: 120, nullable: true),
MustChangePassword = table.Column(type: "boolean", nullable: false),
IsActive = table.Column(type: "boolean", nullable: false),
CreatedByTwitchId = table.Column(type: "character varying(120)", maxLength: 120, nullable: false),
UpdatedByTwitchId = table.Column(type: "character varying(120)", maxLength: 120, nullable: true),
CreatedAt = table.Column(type: "timestamp with time zone", nullable: false),
UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true),
LastLoginAt = table.Column(type: "timestamp with time zone", nullable: true),
TwitchBoundAt = table.Column(type: "timestamp with time zone", nullable: true),
PasswordResetAt = table.Column(type: "timestamp with time zone", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_TeamMembers", x => x.Id);
});
migrationBuilder.CreateTable(
name: "TeamRolePermissions",
columns: table => new
{
Id = table.Column(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
Role = table.Column(type: "character varying(40)", maxLength: 40, nullable: false),
PermissionsJson = table.Column(type: "text", nullable: false),
UpdatedByTwitchId = table.Column(type: "character varying(120)", maxLength: 120, nullable: false),
UpdatedAt = table.Column(type: "timestamp with time zone", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_TeamRolePermissions", x => x.Id);
});
migrationBuilder.CreateTable(
name: "UserSessions",
columns: table => new
{
Id = table.Column(type: "uuid", nullable: false),
SessionToken = table.Column(type: "character varying(120)", maxLength: 120, nullable: false),
TwitchUserId = table.Column(type: "character varying(120)", maxLength: 120, nullable: false),
DisplayName = table.Column(type: "character varying(120)", maxLength: 120, nullable: false),
Role = table.Column(type: "character varying(40)", maxLength: 40, nullable: false),
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),
LastSeenAt = table.Column(type: "timestamp with time zone", nullable: false),
IsActive = table.Column(type: "boolean", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_UserSessions", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Categories",
columns: table => new
{
Id = table.Column(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
SeasonId = table.Column(type: "integer", nullable: false),
GroupName = table.Column(type: "character varying(80)", maxLength: 80, nullable: false),
Name = table.Column(type: "character varying(120)", maxLength: 120, nullable: false),
Slug = table.Column(type: "text", nullable: false),
Description = table.Column(type: "character varying(400)", maxLength: 400, nullable: false),
SortOrder = table.Column(type: "integer", nullable: false),
MaxNomineesPerUser = table.Column(type: "integer", nullable: false),
ViewerRangeMin = table.Column(type: "integer", nullable: true),
ViewerRangeMax = table.Column(type: "integer", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Categories", x => x.Id);
table.ForeignKey(
name: "FK_Categories_Seasons_SeasonId",
column: x => x.SeasonId,
principalTable: "Seasons",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "RiskFlags",
columns: table => new
{
Id = table.Column(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
SeasonId = table.Column(type: "integer", nullable: true),
TwitchUserId = table.Column(type: "character varying(120)", maxLength: 120, nullable: true),
Source = table.Column(type: "character varying(80)", maxLength: 80, nullable: false),
Type = table.Column(type: "character varying(80)", maxLength: 80, nullable: false),
Severity = table.Column(type: "character varying(20)", maxLength: 20, nullable: false),
Status = table.Column(type: "character varying(20)", maxLength: 20, nullable: false),
Summary = table.Column(type: "character varying(240)", maxLength: 240, nullable: false),
CreatedFromIp = table.Column(type: "character varying(80)", maxLength: 80, nullable: false),
UserAgent = table.Column(type: "character varying(400)", maxLength: 400, nullable: false),
MetadataJson = table.Column(type: "text", nullable: false),
ReviewNote = table.Column(type: "character varying(500)", maxLength: 500, nullable: true),
ReviewedByTwitchId = table.Column(type: "character varying(120)", maxLength: 120, nullable: true),
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_RiskFlags", x => x.Id);
table.ForeignKey(
name: "FK_RiskFlags_Seasons_SeasonId",
column: x => x.SeasonId,
principalTable: "Seasons",
principalColumn: "Id");
});
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),
FieldResponsesJson = table.Column(type: "text", 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.CreateTable(
name: "VoteBallots",
columns: table => new
{
Id = table.Column(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
SeasonId = table.Column(type: "integer", nullable: false),
SubmittedByTwitchId = table.Column(type: "character varying(120)", maxLength: 120, nullable: false),
Status = table.Column(type: "character varying(30)", maxLength: 30, nullable: false),
SubmittedAt = table.Column(type: "timestamp with time zone", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_VoteBallots", x => x.Id);
table.ForeignKey(
name: "FK_VoteBallots_Seasons_SeasonId",
column: x => x.SeasonId,
principalTable: "Seasons",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "Candidates",
columns: table => new
{
Id = table.Column(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
SeasonId = table.Column(type: "integer", nullable: false),
CategoryId = table.Column(type: "integer", nullable: false),
StreamerIdentityId = table.Column(type: "integer", nullable: true),
DisplayName = table.Column(type: "character varying(120)", maxLength: 120, nullable: false),
ChannelSlug = table.Column(type: "character varying(120)", maxLength: 120, nullable: false),
Platform = table.Column(type: "character varying(40)", maxLength: 40, nullable: false),
NominationTally = table.Column(type: "integer", nullable: false, defaultValue: 0),
AcceptanceStatus = table.Column(type: "character varying(30)", maxLength: 30, nullable: false, defaultValue: "open"),
AcceptanceNote = table.Column(type: "character varying(500)", maxLength: 500, nullable: true),
ClipCompilationUrl = table.Column(type: "character varying(500)", maxLength: 500, nullable: true),
ClipCompilationTitle = table.Column(type: "character varying(200)", maxLength: 200, nullable: true),
ClipCompilationPlatform = table.Column(type: "character varying(40)", maxLength: 40, nullable: true),
ClipEmbedStatus = table.Column(type: "character varying(30)", maxLength: 30, nullable: false, defaultValue: "unchecked")
},
constraints: table =>
{
table.PrimaryKey("PK_Candidates", x => x.Id);
table.ForeignKey(
name: "FK_Candidates_Categories_CategoryId",
column: x => x.CategoryId,
principalTable: "Categories",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_Candidates_Seasons_SeasonId",
column: x => x.SeasonId,
principalTable: "Seasons",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_Candidates_StreamerIdentities_StreamerIdentityId",
column: x => x.StreamerIdentityId,
principalTable: "StreamerIdentities",
principalColumn: "Id");
});
migrationBuilder.CreateTable(
name: "ClipSubmissions",
columns: table => new
{
Id = table.Column(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
SeasonId = table.Column(type: "integer", nullable: false),
CategoryId = table.Column(type: "integer", nullable: true),
CandidateId = table.Column(type: "integer", nullable: true),
SubmittedByTwitchId = table.Column(type: "character varying(120)", maxLength: 120, nullable: false),
ClipUrl = table.Column(type: "character varying(500)", maxLength: 500, nullable: false),
Title = table.Column(type: "character varying(200)", maxLength: 200, nullable: false),
Creator = table.Column(type: "character varying(120)", maxLength: 120, nullable: false),
Platform = table.Column(type: "character varying(40)", maxLength: 40, 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),
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_ClipSubmissions", x => x.Id);
table.ForeignKey(
name: "FK_ClipSubmissions_Candidates_CandidateId",
column: x => x.CandidateId,
principalTable: "Candidates",
principalColumn: "Id",
onDelete: ReferentialAction.SetNull);
table.ForeignKey(
name: "FK_ClipSubmissions_Seasons_SeasonId",
column: x => x.SeasonId,
principalTable: "Seasons",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "Nominations",
columns: table => new
{
Id = table.Column(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
SeasonId = table.Column(type: "integer", nullable: false),
CategoryId = table.Column(type: "integer", nullable: true),
CategoryGroupName = table.Column(type: "character varying(80)", maxLength: 80, nullable: false, defaultValue: ""),
SubmittedByTwitchId = table.Column(type: "character varying(120)", maxLength: 120, nullable: false),
CandidateId = table.Column(type: "integer", nullable: true),
StreamerIdentityId = table.Column(type: "integer", nullable: true),
SuggestedCategoryId = table.Column(type: "integer", nullable: true),
CandidateText = table.Column(type: "character varying(120)", maxLength: 120, nullable: true),
StreamUrl = table.Column(type: "character varying(300)", maxLength: 300, nullable: true),
ResolvedChannel = table.Column(type: "character varying(120)", maxLength: 120, nullable: true),
ResolvedPlatform = table.Column(type: "character varying(40)", maxLength: 40, nullable: true),
AvgViewers = table.Column(type: "integer", nullable: true),
HoursStreamed = table.Column(type: "integer", nullable: true),
HoursWatched = table.Column(type: "integer", nullable: true),
PeakViewers = table.Column(type: "integer", nullable: true),
FollowersGained = table.Column(type: "integer", nullable: true),
TrackerStatus = table.Column(type: "character varying(40)", maxLength: 40, nullable: false, defaultValue: "pending"),
TrackerCheckedAt = table.Column(type: "timestamp with time zone", nullable: true),
TrackingReviewStatus = table.Column(type: "character varying(30)", maxLength: 30, nullable: false, defaultValue: "clear"),
TrackingFlagsJson = table.Column(type: "text", nullable: false, defaultValue: "[]"),
TrackingReviewNote = table.Column(type: "character varying(1000)", maxLength: 1000, nullable: true),
TrackingReviewedByTwitchId = table.Column(type: "character varying(120)", maxLength: 120, nullable: true),
TrackingReviewedAt = table.Column(type: "timestamp with time zone", nullable: true),
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),
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_Nominations", x => x.Id);
table.ForeignKey(
name: "FK_Nominations_Candidates_CandidateId",
column: x => x.CandidateId,
principalTable: "Candidates",
principalColumn: "Id");
table.ForeignKey(
name: "FK_Nominations_Categories_CategoryId",
column: x => x.CategoryId,
principalTable: "Categories",
principalColumn: "Id",
onDelete: ReferentialAction.SetNull);
table.ForeignKey(
name: "FK_Nominations_Categories_SuggestedCategoryId",
column: x => x.SuggestedCategoryId,
principalTable: "Categories",
principalColumn: "Id",
onDelete: ReferentialAction.SetNull);
table.ForeignKey(
name: "FK_Nominations_Seasons_SeasonId",
column: x => x.SeasonId,
principalTable: "Seasons",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_Nominations_StreamerIdentities_StreamerIdentityId",
column: x => x.StreamerIdentityId,
principalTable: "StreamerIdentities",
principalColumn: "Id");
});
migrationBuilder.CreateTable(
name: "Results",
columns: table => new
{
Id = table.Column(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
SeasonId = table.Column