796 lines
49 KiB
C#
796 lines
49 KiB
C#
using System;
|
|
using Microsoft.EntityFrameworkCore.Migrations;
|
|
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
|
|
|
#nullable disable
|
|
|
|
namespace Backend.Migrations
|
|
{
|
|
/// <inheritdoc />
|
|
public partial class InitialCleanBaseline : Migration
|
|
{
|
|
/// <inheritdoc />
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.CreateTable(
|
|
name: "AdminAuditEntries",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<int>(type: "integer", nullable: false)
|
|
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
|
AdminTwitchUserId = table.Column<string>(type: "character varying(120)", maxLength: 120, nullable: false),
|
|
ActionType = table.Column<string>(type: "character varying(80)", maxLength: 80, nullable: false),
|
|
EntityType = table.Column<string>(type: "character varying(80)", maxLength: 80, nullable: false),
|
|
EntityId = table.Column<string>(type: "character varying(120)", maxLength: 120, nullable: false),
|
|
Summary = table.Column<string>(type: "character varying(240)", maxLength: 240, nullable: false),
|
|
MetadataJson = table.Column<string>(type: "text", nullable: false),
|
|
CreatedFromIp = table.Column<string>(type: "character varying(80)", maxLength: 80, nullable: false),
|
|
UserAgent = table.Column<string>(type: "character varying(400)", maxLength: 400, nullable: false),
|
|
CreatedAt = table.Column<DateTimeOffset>(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<int>(type: "integer", nullable: false)
|
|
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
|
Year = table.Column<int>(type: "integer", nullable: false),
|
|
Name = table.Column<string>(type: "character varying(160)", maxLength: 160, nullable: false),
|
|
IsDemo = table.Column<bool>(type: "boolean", nullable: false, defaultValue: false),
|
|
IsCurrent = table.Column<bool>(type: "boolean", nullable: false),
|
|
IsCommunityOnly = table.Column<bool>(type: "boolean", nullable: false),
|
|
CurrentPhase = table.Column<string>(type: "character varying(60)", maxLength: 60, nullable: false),
|
|
NominationStartsAt = table.Column<DateOnly>(type: "date", nullable: false),
|
|
NominationEndsAt = table.Column<DateOnly>(type: "date", nullable: false),
|
|
VotingStartsAt = table.Column<DateOnly>(type: "date", nullable: false),
|
|
VotingEndsAt = table.Column<DateOnly>(type: "date", nullable: false),
|
|
ReviewStartsAt = table.Column<DateOnly>(type: "date", nullable: false),
|
|
ReviewEndsAt = table.Column<DateOnly>(type: "date", nullable: false),
|
|
ShowDate = table.Column<DateOnly>(type: "date", nullable: false),
|
|
ShowStartsAt = table.Column<TimeOnly>(type: "time without time zone", nullable: false),
|
|
WinnersPublishedAt = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: true),
|
|
WinnersPublishedByTwitchId = table.Column<string>(type: "character varying(120)", maxLength: 120, nullable: true),
|
|
SubcategoryTemplatesJson = table.Column<string>(type: "text", nullable: false, defaultValue: "[]"),
|
|
WorkflowRulesJson = table.Column<string>(type: "text", nullable: false, defaultValue: "[]")
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_Seasons", x => x.Id);
|
|
});
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "SiteSettings",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<int>(type: "integer", nullable: false)
|
|
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
|
HostDisplayName = table.Column<string>(type: "character varying(120)", maxLength: 120, nullable: false),
|
|
HostTagline = table.Column<string>(type: "character varying(160)", maxLength: 160, nullable: false),
|
|
NewsletterUrl = table.Column<string>(type: "character varying(400)", maxLength: 400, nullable: false),
|
|
ShareXUrl = table.Column<string>(type: "text", nullable: false),
|
|
ShareDiscordUrl = table.Column<string>(type: "text", nullable: false),
|
|
PrivacyEmail = table.Column<string>(type: "character varying(160)", maxLength: 160, nullable: false),
|
|
PrivacyPolicyContent = table.Column<string>(type: "text", nullable: false),
|
|
PrivacyPolicyUpdatedBy = table.Column<string>(type: "character varying(120)", maxLength: 120, nullable: true),
|
|
PrivacyPolicyUpdatedAt = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: true),
|
|
ImprintUrl = table.Column<string>(type: "character varying(400)", maxLength: 400, nullable: false),
|
|
ImprintContent = table.Column<string>(type: "text", nullable: false),
|
|
ContactUrl = table.Column<string>(type: "character varying(400)", maxLength: 400, nullable: false),
|
|
ContactContent = table.Column<string>(type: "text", nullable: false),
|
|
SponsorsUrl = table.Column<string>(type: "character varying(400)", maxLength: 400, nullable: false),
|
|
SponsorsContent = table.Column<string>(type: "text", nullable: false),
|
|
ShowactsUrl = table.Column<string>(type: "character varying(400)", maxLength: 400, nullable: false),
|
|
ShowactsContent = table.Column<string>(type: "text", nullable: false, defaultValue: ""),
|
|
StreamBannerEyebrow = table.Column<string>(type: "character varying(120)", maxLength: 120, nullable: false),
|
|
StreamBannerTitle = table.Column<string>(type: "character varying(160)", maxLength: 160, nullable: false),
|
|
StreamBannerText = table.Column<string>(type: "text", nullable: false),
|
|
StreamBannerLiveButtonLabel = table.Column<string>(type: "character varying(120)", maxLength: 120, nullable: false),
|
|
StreamBannerLiveButtonUrl = table.Column<string>(type: "character varying(400)", maxLength: 400, nullable: false),
|
|
StreamBannerLockedButtonLabel = table.Column<string>(type: "character varying(120)", maxLength: 120, nullable: false),
|
|
StreamBannerUseCompletedContent = table.Column<bool>(type: "boolean", nullable: false),
|
|
StreamBannerCompletedEyebrow = table.Column<string>(type: "character varying(120)", maxLength: 120, nullable: false),
|
|
StreamBannerCompletedTitle = table.Column<string>(type: "character varying(160)", maxLength: 160, nullable: false),
|
|
StreamBannerCompletedText = table.Column<string>(type: "text", nullable: false),
|
|
StreamBannerCompletedButtonLabel = table.Column<string>(type: "character varying(120)", maxLength: 120, nullable: false),
|
|
StreamBannerCompletedButtonUrl = table.Column<string>(type: "character varying(400)", maxLength: 400, nullable: false),
|
|
AwardsSectionTitle = table.Column<string>(type: "text", nullable: false),
|
|
AwardsSectionDescription = table.Column<string>(type: "text", nullable: false),
|
|
SubcategoriesSectionTitle = table.Column<string>(type: "text", nullable: false),
|
|
SubcategoriesSectionDescription = table.Column<string>(type: "text", nullable: false),
|
|
SocialLinksJson = table.Column<string>(type: "text", nullable: false),
|
|
FaqJson = table.Column<string>(type: "text", nullable: false),
|
|
RiskRulesJson = table.Column<string>(type: "text", nullable: false),
|
|
WorkflowRulesJson = table.Column<string>(type: "text", nullable: false, defaultValue: "[]"),
|
|
TrackingRulesJson = table.Column<string>(type: "text", nullable: false, defaultValue: "[]"),
|
|
ViewerStatsProviderBaseUrl = table.Column<string>(type: "character varying(400)", maxLength: 400, nullable: false),
|
|
TrackingReviewNotes = table.Column<string>(type: "text", nullable: false),
|
|
NominationLinkBlacklistJson = table.Column<string>(type: "text", nullable: false, defaultValue: "[]"),
|
|
ClipSubmissionsEnabled = table.Column<bool>(type: "boolean", nullable: false, defaultValue: false),
|
|
ClipReviewEnabled = table.Column<bool>(type: "boolean", nullable: false, defaultValue: true),
|
|
ClipAdminMenuVisible = table.Column<bool>(type: "boolean", nullable: false),
|
|
ClipSubmissionDisabledMessage = table.Column<string>(type: "character varying(240)", maxLength: 240, nullable: false),
|
|
ShowactApplicationsEnabled = table.Column<bool>(type: "boolean", nullable: false, defaultValue: false),
|
|
ShowactApplicationStartsAt = table.Column<DateOnly>(type: "date", nullable: true),
|
|
ShowactApplicationEndsAt = table.Column<DateOnly>(type: "date", nullable: true),
|
|
ShowactApplicationDisabledMessage = table.Column<string>(type: "character varying(240)", maxLength: 240, nullable: false),
|
|
ShowactFormSchemaJson = table.Column<string>(type: "text", nullable: false),
|
|
SponsorsVisible = table.Column<bool>(type: "boolean", nullable: false, defaultValue: true),
|
|
DemoLoginManagedByDatabase = table.Column<bool>(type: "boolean", nullable: false),
|
|
DemoLoginEnabled = table.Column<bool>(type: "boolean", nullable: false),
|
|
DemoLoginEmail = table.Column<string>(type: "character varying(180)", maxLength: 180, nullable: false),
|
|
DemoLoginPasswordHash = table.Column<string>(type: "character varying(120)", maxLength: 120, nullable: false),
|
|
DemoLoginPasswordSalt = table.Column<string>(type: "character varying(80)", maxLength: 80, nullable: false),
|
|
DemoLoginTwitchUserId = table.Column<string>(type: "character varying(120)", maxLength: 120, nullable: false),
|
|
DemoLoginDisplayName = table.Column<string>(type: "character varying(120)", maxLength: 120, nullable: false),
|
|
TwitchAuthManagedByDatabase = table.Column<bool>(type: "boolean", nullable: false),
|
|
TwitchClientId = table.Column<string>(type: "character varying(120)", maxLength: 120, nullable: false),
|
|
TwitchClientSecret = table.Column<string>(type: "character varying(180)", maxLength: 180, nullable: false),
|
|
TwitchRedirectUri = table.Column<string>(type: "character varying(400)", maxLength: 400, nullable: false),
|
|
TwitchScope = table.Column<string>(type: "character varying(300)", maxLength: 300, nullable: false),
|
|
SessionIdleTimeoutHours = table.Column<int>(type: "integer", nullable: false, defaultValue: 3),
|
|
MaintenanceModeEnabled = table.Column<bool>(type: "boolean", nullable: false),
|
|
MaintenanceTitle = table.Column<string>(type: "character varying(120)", maxLength: 120, nullable: false),
|
|
MaintenanceMessage = table.Column<string>(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<int>(type: "integer", nullable: false)
|
|
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
|
Platform = table.Column<string>(type: "character varying(40)", maxLength: 40, nullable: false),
|
|
Login = table.Column<string>(type: "character varying(120)", maxLength: 120, nullable: false),
|
|
NormalizedKey = table.Column<string>(type: "character varying(180)", maxLength: 180, nullable: false),
|
|
DisplayName = table.Column<string>(type: "character varying(120)", maxLength: 120, nullable: false),
|
|
ProfileUrl = table.Column<string>(type: "character varying(500)", maxLength: 500, nullable: true),
|
|
LastResolvedAt = table.Column<DateTimeOffset>(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<int>(type: "integer", nullable: false)
|
|
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
|
Login = table.Column<string>(type: "character varying(80)", maxLength: 80, nullable: false),
|
|
DisplayName = table.Column<string>(type: "character varying(120)", maxLength: 120, nullable: false),
|
|
Role = table.Column<string>(type: "character varying(40)", maxLength: 40, nullable: false),
|
|
PasswordHash = table.Column<string>(type: "character varying(120)", maxLength: 120, nullable: false),
|
|
PasswordSalt = table.Column<string>(type: "character varying(80)", maxLength: 80, nullable: false),
|
|
BoundTwitchUserId = table.Column<string>(type: "character varying(120)", maxLength: 120, nullable: true),
|
|
BoundTwitchDisplayName = table.Column<string>(type: "character varying(120)", maxLength: 120, nullable: true),
|
|
MustChangePassword = table.Column<bool>(type: "boolean", nullable: false),
|
|
IsActive = table.Column<bool>(type: "boolean", nullable: false),
|
|
CreatedByTwitchId = table.Column<string>(type: "character varying(120)", maxLength: 120, nullable: false),
|
|
UpdatedByTwitchId = table.Column<string>(type: "character varying(120)", maxLength: 120, nullable: true),
|
|
CreatedAt = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
|
|
UpdatedAt = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: true),
|
|
LastLoginAt = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: true),
|
|
TwitchBoundAt = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: true),
|
|
PasswordResetAt = table.Column<DateTimeOffset>(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<int>(type: "integer", nullable: false)
|
|
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
|
Role = table.Column<string>(type: "character varying(40)", maxLength: 40, nullable: false),
|
|
PermissionsJson = table.Column<string>(type: "text", nullable: false),
|
|
UpdatedByTwitchId = table.Column<string>(type: "character varying(120)", maxLength: 120, nullable: false),
|
|
UpdatedAt = table.Column<DateTimeOffset>(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<Guid>(type: "uuid", nullable: false),
|
|
SessionToken = table.Column<string>(type: "character varying(120)", maxLength: 120, nullable: false),
|
|
TwitchUserId = table.Column<string>(type: "character varying(120)", maxLength: 120, nullable: false),
|
|
DisplayName = table.Column<string>(type: "character varying(120)", maxLength: 120, nullable: false),
|
|
Role = table.Column<string>(type: "character varying(40)", maxLength: 40, nullable: false),
|
|
CreatedFromIp = table.Column<string>(type: "character varying(80)", maxLength: 80, nullable: false),
|
|
UserAgent = table.Column<string>(type: "character varying(400)", maxLength: 400, nullable: false),
|
|
CreatedAt = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
|
|
LastSeenAt = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
|
|
IsActive = table.Column<bool>(type: "boolean", nullable: false)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_UserSessions", x => x.Id);
|
|
});
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "Categories",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<int>(type: "integer", nullable: false)
|
|
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
|
SeasonId = table.Column<int>(type: "integer", nullable: false),
|
|
GroupName = table.Column<string>(type: "character varying(80)", maxLength: 80, nullable: false),
|
|
Name = table.Column<string>(type: "character varying(120)", maxLength: 120, nullable: false),
|
|
Slug = table.Column<string>(type: "text", nullable: false),
|
|
Description = table.Column<string>(type: "character varying(400)", maxLength: 400, nullable: false),
|
|
SortOrder = table.Column<int>(type: "integer", nullable: false),
|
|
MaxNomineesPerUser = table.Column<int>(type: "integer", nullable: false),
|
|
ViewerRangeMin = table.Column<int>(type: "integer", nullable: true),
|
|
ViewerRangeMax = table.Column<int>(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<int>(type: "integer", nullable: false)
|
|
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
|
SeasonId = table.Column<int>(type: "integer", nullable: true),
|
|
TwitchUserId = table.Column<string>(type: "character varying(120)", maxLength: 120, nullable: true),
|
|
Source = table.Column<string>(type: "character varying(80)", maxLength: 80, nullable: false),
|
|
Type = table.Column<string>(type: "character varying(80)", maxLength: 80, nullable: false),
|
|
Severity = table.Column<string>(type: "character varying(20)", maxLength: 20, nullable: false),
|
|
Status = table.Column<string>(type: "character varying(20)", maxLength: 20, nullable: false),
|
|
Summary = table.Column<string>(type: "character varying(240)", maxLength: 240, nullable: false),
|
|
CreatedFromIp = table.Column<string>(type: "character varying(80)", maxLength: 80, nullable: false),
|
|
UserAgent = table.Column<string>(type: "character varying(400)", maxLength: 400, nullable: false),
|
|
MetadataJson = table.Column<string>(type: "text", nullable: false),
|
|
ReviewNote = table.Column<string>(type: "character varying(500)", maxLength: 500, nullable: true),
|
|
ReviewedByTwitchId = table.Column<string>(type: "character varying(120)", maxLength: 120, nullable: true),
|
|
CreatedAt = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
|
|
ReviewedAt = table.Column<DateTimeOffset>(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<int>(type: "integer", nullable: false)
|
|
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
|
SeasonId = table.Column<int>(type: "integer", nullable: false),
|
|
ArtistName = table.Column<string>(type: "character varying(120)", maxLength: 120, nullable: false),
|
|
ContactEmail = table.Column<string>(type: "character varying(180)", maxLength: 180, nullable: false),
|
|
ContactDiscord = table.Column<string>(type: "character varying(120)", maxLength: 120, nullable: false),
|
|
PlatformUrl = table.Column<string>(type: "character varying(500)", maxLength: 500, nullable: false),
|
|
PerformanceType = table.Column<string>(type: "character varying(80)", maxLength: 80, nullable: false),
|
|
Description = table.Column<string>(type: "character varying(1000)", maxLength: 1000, nullable: false),
|
|
TechnicalNotes = table.Column<string>(type: "character varying(1000)", maxLength: 1000, nullable: false),
|
|
ReferenceUrl = table.Column<string>(type: "character varying(500)", maxLength: 500, nullable: false),
|
|
FieldResponsesJson = table.Column<string>(type: "text", nullable: false),
|
|
Status = table.Column<string>(type: "character varying(20)", maxLength: 20, nullable: false),
|
|
ReviewNote = table.Column<string>(type: "character varying(500)", maxLength: 500, nullable: true),
|
|
ReviewedByTwitchId = table.Column<string>(type: "character varying(120)", maxLength: 120, nullable: true),
|
|
CreatedFromIp = table.Column<string>(type: "character varying(80)", maxLength: 80, nullable: false),
|
|
UserAgent = table.Column<string>(type: "character varying(400)", maxLength: 400, nullable: false),
|
|
CreatedAt = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
|
|
ReviewedAt = table.Column<DateTimeOffset>(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<int>(type: "integer", nullable: false)
|
|
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
|
SeasonId = table.Column<int>(type: "integer", nullable: false),
|
|
Name = table.Column<string>(type: "character varying(120)", maxLength: 120, nullable: false),
|
|
WebsiteUrl = table.Column<string>(type: "character varying(500)", maxLength: 500, nullable: false),
|
|
LogoUrl = table.Column<string>(type: "character varying(500)", maxLength: 500, nullable: false),
|
|
Description = table.Column<string>(type: "character varying(500)", maxLength: 500, nullable: false),
|
|
Tier = table.Column<string>(type: "character varying(80)", maxLength: 80, nullable: false),
|
|
SortOrder = table.Column<int>(type: "integer", nullable: false),
|
|
IsVisible = table.Column<bool>(type: "boolean", nullable: false),
|
|
CreatedAt = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
|
|
UpdatedAt = table.Column<DateTimeOffset>(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<int>(type: "integer", nullable: false)
|
|
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
|
SeasonId = table.Column<int>(type: "integer", nullable: false),
|
|
SubmittedByTwitchId = table.Column<string>(type: "character varying(120)", maxLength: 120, nullable: false),
|
|
Status = table.Column<string>(type: "character varying(30)", maxLength: 30, nullable: false),
|
|
SubmittedAt = table.Column<DateTimeOffset>(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<int>(type: "integer", nullable: false)
|
|
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
|
SeasonId = table.Column<int>(type: "integer", nullable: false),
|
|
CategoryId = table.Column<int>(type: "integer", nullable: false),
|
|
StreamerIdentityId = table.Column<int>(type: "integer", nullable: true),
|
|
DisplayName = table.Column<string>(type: "character varying(120)", maxLength: 120, nullable: false),
|
|
ChannelSlug = table.Column<string>(type: "character varying(120)", maxLength: 120, nullable: false),
|
|
Platform = table.Column<string>(type: "character varying(40)", maxLength: 40, nullable: false),
|
|
NominationTally = table.Column<int>(type: "integer", nullable: false, defaultValue: 0),
|
|
AcceptanceStatus = table.Column<string>(type: "character varying(30)", maxLength: 30, nullable: false, defaultValue: "open"),
|
|
AcceptanceNote = table.Column<string>(type: "character varying(500)", maxLength: 500, nullable: true),
|
|
ClipCompilationUrl = table.Column<string>(type: "character varying(500)", maxLength: 500, nullable: true),
|
|
ClipCompilationTitle = table.Column<string>(type: "character varying(200)", maxLength: 200, nullable: true),
|
|
ClipCompilationPlatform = table.Column<string>(type: "character varying(40)", maxLength: 40, nullable: true),
|
|
ClipEmbedStatus = table.Column<string>(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<int>(type: "integer", nullable: false)
|
|
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
|
SeasonId = table.Column<int>(type: "integer", nullable: false),
|
|
CategoryId = table.Column<int>(type: "integer", nullable: true),
|
|
CandidateId = table.Column<int>(type: "integer", nullable: true),
|
|
SubmittedByTwitchId = table.Column<string>(type: "character varying(120)", maxLength: 120, nullable: false),
|
|
ClipUrl = table.Column<string>(type: "character varying(500)", maxLength: 500, nullable: false),
|
|
Title = table.Column<string>(type: "character varying(200)", maxLength: 200, nullable: false),
|
|
Creator = table.Column<string>(type: "character varying(120)", maxLength: 120, nullable: false),
|
|
Platform = table.Column<string>(type: "character varying(40)", maxLength: 40, nullable: false),
|
|
Status = table.Column<string>(type: "character varying(20)", maxLength: 20, nullable: false),
|
|
ReviewNote = table.Column<string>(type: "character varying(500)", maxLength: 500, nullable: true),
|
|
ReviewedByTwitchId = table.Column<string>(type: "character varying(120)", maxLength: 120, nullable: true),
|
|
CreatedFromIp = table.Column<string>(type: "character varying(80)", maxLength: 80, nullable: false),
|
|
CreatedAt = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
|
|
ReviewedAt = table.Column<DateTimeOffset>(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<int>(type: "integer", nullable: false)
|
|
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
|
SeasonId = table.Column<int>(type: "integer", nullable: false),
|
|
CategoryId = table.Column<int>(type: "integer", nullable: true),
|
|
CategoryGroupName = table.Column<string>(type: "character varying(80)", maxLength: 80, nullable: false, defaultValue: ""),
|
|
SubmittedByTwitchId = table.Column<string>(type: "character varying(120)", maxLength: 120, nullable: false),
|
|
CandidateId = table.Column<int>(type: "integer", nullable: true),
|
|
StreamerIdentityId = table.Column<int>(type: "integer", nullable: true),
|
|
SuggestedCategoryId = table.Column<int>(type: "integer", nullable: true),
|
|
CandidateText = table.Column<string>(type: "character varying(120)", maxLength: 120, nullable: true),
|
|
StreamUrl = table.Column<string>(type: "character varying(300)", maxLength: 300, nullable: true),
|
|
ResolvedChannel = table.Column<string>(type: "character varying(120)", maxLength: 120, nullable: true),
|
|
ResolvedPlatform = table.Column<string>(type: "character varying(40)", maxLength: 40, nullable: true),
|
|
AvgViewers = table.Column<int>(type: "integer", nullable: true),
|
|
HoursStreamed = table.Column<int>(type: "integer", nullable: true),
|
|
HoursWatched = table.Column<int>(type: "integer", nullable: true),
|
|
PeakViewers = table.Column<int>(type: "integer", nullable: true),
|
|
FollowersGained = table.Column<int>(type: "integer", nullable: true),
|
|
TrackerStatus = table.Column<string>(type: "character varying(40)", maxLength: 40, nullable: false, defaultValue: "pending"),
|
|
TrackerCheckedAt = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: true),
|
|
TrackingReviewStatus = table.Column<string>(type: "character varying(30)", maxLength: 30, nullable: false, defaultValue: "clear"),
|
|
TrackingFlagsJson = table.Column<string>(type: "text", nullable: false, defaultValue: "[]"),
|
|
TrackingReviewNote = table.Column<string>(type: "character varying(1000)", maxLength: 1000, nullable: true),
|
|
TrackingReviewedByTwitchId = table.Column<string>(type: "character varying(120)", maxLength: 120, nullable: true),
|
|
TrackingReviewedAt = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: true),
|
|
Status = table.Column<string>(type: "character varying(20)", maxLength: 20, nullable: false),
|
|
ReviewNote = table.Column<string>(type: "character varying(500)", maxLength: 500, nullable: true),
|
|
ReviewedByTwitchId = table.Column<string>(type: "character varying(120)", maxLength: 120, nullable: true),
|
|
CreatedAt = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
|
|
ReviewedAt = table.Column<DateTimeOffset>(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<int>(type: "integer", nullable: false)
|
|
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
|
SeasonId = table.Column<int>(type: "integer", nullable: false),
|
|
CategoryId = table.Column<int>(type: "integer", nullable: false),
|
|
CandidateId = table.Column<int>(type: "integer", nullable: false),
|
|
CategoryName = table.Column<string>(type: "character varying(120)", maxLength: 120, nullable: false)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_Results", x => x.Id);
|
|
table.ForeignKey(
|
|
name: "FK_Results_Candidates_CandidateId",
|
|
column: x => x.CandidateId,
|
|
principalTable: "Candidates",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
table.ForeignKey(
|
|
name: "FK_Results_Categories_CategoryId",
|
|
column: x => x.CategoryId,
|
|
principalTable: "Categories",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
table.ForeignKey(
|
|
name: "FK_Results_Seasons_SeasonId",
|
|
column: x => x.SeasonId,
|
|
principalTable: "Seasons",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
});
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "VoteEntries",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<int>(type: "integer", nullable: false)
|
|
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
|
BallotId = table.Column<int>(type: "integer", nullable: false),
|
|
CategoryId = table.Column<int>(type: "integer", nullable: false),
|
|
CandidateId = table.Column<int>(type: "integer", nullable: false)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_VoteEntries", x => x.Id);
|
|
table.ForeignKey(
|
|
name: "FK_VoteEntries_Candidates_CandidateId",
|
|
column: x => x.CandidateId,
|
|
principalTable: "Candidates",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
table.ForeignKey(
|
|
name: "FK_VoteEntries_Categories_CategoryId",
|
|
column: x => x.CategoryId,
|
|
principalTable: "Categories",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
table.ForeignKey(
|
|
name: "FK_VoteEntries_VoteBallots_BallotId",
|
|
column: x => x.BallotId,
|
|
principalTable: "VoteBallots",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
});
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_Candidates_CategoryId",
|
|
table: "Candidates",
|
|
column: "CategoryId");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_Candidates_SeasonId",
|
|
table: "Candidates",
|
|
column: "SeasonId");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_Candidates_StreamerIdentityId",
|
|
table: "Candidates",
|
|
column: "StreamerIdentityId");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_Categories_SeasonId_Slug",
|
|
table: "Categories",
|
|
columns: new[] { "SeasonId", "Slug" },
|
|
unique: true);
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_ClipSubmissions_CandidateId",
|
|
table: "ClipSubmissions",
|
|
column: "CandidateId");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_ClipSubmissions_SeasonId_Status",
|
|
table: "ClipSubmissions",
|
|
columns: new[] { "SeasonId", "Status" });
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_Nominations_CandidateId",
|
|
table: "Nominations",
|
|
column: "CandidateId");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_Nominations_CategoryId",
|
|
table: "Nominations",
|
|
column: "CategoryId");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_Nominations_SeasonId_CategoryGroupName_Status",
|
|
table: "Nominations",
|
|
columns: new[] { "SeasonId", "CategoryGroupName", "Status" });
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_Nominations_SeasonId_Status",
|
|
table: "Nominations",
|
|
columns: new[] { "SeasonId", "Status" });
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_Nominations_SeasonId_StreamerIdentityId_CategoryGroupName",
|
|
table: "Nominations",
|
|
columns: new[] { "SeasonId", "StreamerIdentityId", "CategoryGroupName" });
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_Nominations_StreamerIdentityId",
|
|
table: "Nominations",
|
|
column: "StreamerIdentityId");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_Nominations_SuggestedCategoryId",
|
|
table: "Nominations",
|
|
column: "SuggestedCategoryId");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_Results_CandidateId",
|
|
table: "Results",
|
|
column: "CandidateId");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_Results_CategoryId",
|
|
table: "Results",
|
|
column: "CategoryId");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_Results_SeasonId_CategoryId",
|
|
table: "Results",
|
|
columns: new[] { "SeasonId", "CategoryId" },
|
|
unique: true);
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_RiskFlags_SeasonId",
|
|
table: "RiskFlags",
|
|
column: "SeasonId");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_Seasons_Year",
|
|
table: "Seasons",
|
|
column: "Year",
|
|
unique: true);
|
|
|
|
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" });
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_StreamerIdentities_NormalizedKey",
|
|
table: "StreamerIdentities",
|
|
column: "NormalizedKey",
|
|
unique: true);
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_TeamMembers_BoundTwitchUserId",
|
|
table: "TeamMembers",
|
|
column: "BoundTwitchUserId",
|
|
unique: true);
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_TeamMembers_Login",
|
|
table: "TeamMembers",
|
|
column: "Login",
|
|
unique: true);
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_TeamRolePermissions_Role",
|
|
table: "TeamRolePermissions",
|
|
column: "Role",
|
|
unique: true);
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_UserSessions_SessionToken",
|
|
table: "UserSessions",
|
|
column: "SessionToken",
|
|
unique: true);
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_VoteBallots_SeasonId_SubmittedByTwitchId",
|
|
table: "VoteBallots",
|
|
columns: new[] { "SeasonId", "SubmittedByTwitchId" },
|
|
unique: true);
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_VoteEntries_BallotId",
|
|
table: "VoteEntries",
|
|
column: "BallotId");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_VoteEntries_CandidateId",
|
|
table: "VoteEntries",
|
|
column: "CandidateId");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_VoteEntries_CategoryId",
|
|
table: "VoteEntries",
|
|
column: "CategoryId");
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DropTable(
|
|
name: "AdminAuditEntries");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "ClipSubmissions");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "Nominations");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "Results");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "RiskFlags");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "ShowactApplications");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "SiteSettings");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "Sponsors");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "TeamMembers");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "TeamRolePermissions");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "UserSessions");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "VoteEntries");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "Candidates");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "VoteBallots");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "Categories");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "StreamerIdentities");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "Seasons");
|
|
}
|
|
}
|
|
}
|