using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
#pragma warning disable CA1814 // Prefer jagged arrays over multidimensional
namespace Nuuru.Server.Migrations
{
///
public partial class InitialCreate : Migration
{
///
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "AspNetRoles",
columns: table => new
{
Id = table.Column(type: "TEXT", nullable: false),
Color = table.Column(type: "TEXT", nullable: true),
Priority = table.Column(type: "INTEGER", nullable: false),
Name = table.Column(type: "TEXT", maxLength: 256, nullable: true),
NormalizedName = table.Column(type: "TEXT", maxLength: 256, nullable: true),
ConcurrencyStamp = table.Column(type: "TEXT", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_AspNetRoles", x => x.Id);
});
migrationBuilder.CreateTable(
name: "AspNetUsers",
columns: table => new
{
Id = table.Column(type: "TEXT", nullable: false),
Status = table.Column(type: "TEXT", nullable: false),
Biography = table.Column(type: "TEXT", nullable: false),
BiographyHtml = table.Column(type: "TEXT", nullable: true),
AvatarStorageIdentifier = table.Column(type: "TEXT", nullable: true),
DateCreated = table.Column(type: "TEXT", nullable: false),
UserName = table.Column(type: "TEXT", maxLength: 256, nullable: true),
NormalizedUserName = table.Column(type: "TEXT", maxLength: 256, nullable: true),
Email = table.Column(type: "TEXT", maxLength: 256, nullable: true),
NormalizedEmail = table.Column(type: "TEXT", maxLength: 256, nullable: true),
EmailConfirmed = table.Column(type: "INTEGER", nullable: false),
PasswordHash = table.Column(type: "TEXT", nullable: true),
SecurityStamp = table.Column(type: "TEXT", nullable: true),
ConcurrencyStamp = table.Column(type: "TEXT", nullable: true),
PhoneNumber = table.Column(type: "TEXT", nullable: true),
PhoneNumberConfirmed = table.Column(type: "INTEGER", nullable: false),
TwoFactorEnabled = table.Column(type: "INTEGER", nullable: false),
LockoutEnd = table.Column(type: "TEXT", nullable: true),
LockoutEnabled = table.Column(type: "INTEGER", nullable: false),
AccessFailedCount = table.Column(type: "INTEGER", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_AspNetUsers", x => x.Id);
});
migrationBuilder.CreateTable(
name: "BooruTagCategories",
columns: table => new
{
Id = table.Column(type: "TEXT", nullable: false),
Name = table.Column(type: "TEXT", maxLength: 100, nullable: false),
Slug = table.Column(type: "TEXT", maxLength: 50, nullable: false),
ColorHex = table.Column(type: "TEXT", maxLength: 20, nullable: true),
SortOrder = table.Column(type: "INTEGER", nullable: false),
IsActive = table.Column(type: "INTEGER", nullable: false),
MaxPerPost = table.Column(type: "INTEGER", nullable: true),
ParentCategoryId = table.Column(type: "TEXT", nullable: true),
Version = table.Column(type: "INTEGER", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_BooruTagCategories", x => x.Id);
table.ForeignKey(
name: "FK_BooruTagCategories_BooruTagCategories_ParentCategoryId",
column: x => x.ParentCategoryId,
principalTable: "BooruTagCategories",
principalColumn: "Id");
});
migrationBuilder.CreateTable(
name: "ForumCategories",
columns: table => new
{
Id = table.Column(type: "TEXT", nullable: false),
Slug = table.Column(type: "TEXT", maxLength: 50, nullable: false),
Name = table.Column(type: "TEXT", maxLength: 100, nullable: false),
Description = table.Column(type: "TEXT", maxLength: 500, nullable: false),
DisplayOrder = table.Column(type: "INTEGER", nullable: false),
Color = table.Column(type: "TEXT", maxLength: 50, nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_ForumCategories", x => x.Id);
});
migrationBuilder.CreateTable(
name: "AspNetRoleClaims",
columns: table => new
{
Id = table.Column(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
RoleId = table.Column(type: "TEXT", nullable: false),
ClaimType = table.Column(type: "TEXT", nullable: true),
ClaimValue = table.Column(type: "TEXT", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_AspNetRoleClaims", x => x.Id);
table.ForeignKey(
name: "FK_AspNetRoleClaims_AspNetRoles_RoleId",
column: x => x.RoleId,
principalTable: "AspNetRoles",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "AspNetUserClaims",
columns: table => new
{
Id = table.Column(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
UserId = table.Column(type: "TEXT", nullable: false),
ClaimType = table.Column(type: "TEXT", nullable: true),
ClaimValue = table.Column(type: "TEXT", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_AspNetUserClaims", x => x.Id);
table.ForeignKey(
name: "FK_AspNetUserClaims_AspNetUsers_UserId",
column: x => x.UserId,
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "AspNetUserLogins",
columns: table => new
{
LoginProvider = table.Column(type: "TEXT", nullable: false),
ProviderKey = table.Column(type: "TEXT", nullable: false),
ProviderDisplayName = table.Column(type: "TEXT", nullable: true),
UserId = table.Column(type: "TEXT", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_AspNetUserLogins", x => new { x.LoginProvider, x.ProviderKey });
table.ForeignKey(
name: "FK_AspNetUserLogins_AspNetUsers_UserId",
column: x => x.UserId,
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "AspNetUserRoles",
columns: table => new
{
UserId = table.Column(type: "TEXT", nullable: false),
RoleId = table.Column(type: "TEXT", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_AspNetUserRoles", x => new { x.UserId, x.RoleId });
table.ForeignKey(
name: "FK_AspNetUserRoles_AspNetRoles_RoleId",
column: x => x.RoleId,
principalTable: "AspNetRoles",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_AspNetUserRoles_AspNetUsers_UserId",
column: x => x.UserId,
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "AspNetUserTokens",
columns: table => new
{
UserId = table.Column(type: "TEXT", nullable: false),
LoginProvider = table.Column(type: "TEXT", nullable: false),
Name = table.Column(type: "TEXT", nullable: false),
Value = table.Column(type: "TEXT", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_AspNetUserTokens", x => new { x.UserId, x.LoginProvider, x.Name });
table.ForeignKey(
name: "FK_AspNetUserTokens_AspNetUsers_UserId",
column: x => x.UserId,
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "Bans",
columns: table => new
{
Id = table.Column(type: "TEXT", nullable: false),
Reason = table.Column(type: "TEXT", nullable: false),
StartTime = table.Column(type: "TEXT", nullable: false),
EndTime = table.Column(type: "TEXT", nullable: false),
Zone = table.Column(type: "INTEGER", nullable: false),
UserId = table.Column(type: "TEXT", nullable: false),
Active = table.Column(type: "INTEGER", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Bans", x => x.Id);
table.ForeignKey(
name: "FK_Bans_AspNetUsers_UserId",
column: x => x.UserId,
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "BooruPosts",
columns: table => new
{
Id = table.Column(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
StorageIdentifier = table.Column(type: "TEXT", nullable: false),
ImageHash = table.Column(type: "TEXT", nullable: false),
MimeType = table.Column(type: "TEXT", nullable: false),
FileSize = table.Column(type: "INTEGER", nullable: false),
OriginalFileName = table.Column(type: "TEXT", nullable: true),
Source = table.Column(type: "TEXT", maxLength: 2000, nullable: true),
Width = table.Column(type: "INTEGER", nullable: true),
Height = table.Column(type: "INTEGER", nullable: true),
DurationSeconds = table.Column(type: "INTEGER", nullable: true),
ThumbnailPath = table.Column(type: "TEXT", nullable: true),
UploadedAt = table.Column(type: "TEXT", nullable: false),
Rating = table.Column(type: "INTEGER", nullable: false),
IsApproved = table.Column(type: "INTEGER", nullable: false),
CommentsLocked = table.Column(type: "INTEGER", nullable: false),
UploaderId = table.Column(type: "TEXT", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_BooruPosts", x => x.Id);
table.ForeignKey(
name: "FK_BooruPosts_AspNetUsers_UploaderId",
column: x => x.UploaderId,
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "Conversations",
columns: table => new
{
Id = table.Column(type: "TEXT", nullable: false),
Title = table.Column(type: "TEXT", maxLength: 200, nullable: true),
CreatedAt = table.Column(type: "TEXT", nullable: false),
LastMessageAt = table.Column(type: "TEXT", nullable: false),
MessageCount = table.Column(type: "INTEGER", nullable: false),
CreatorId = table.Column(type: "TEXT", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Conversations", x => x.Id);
table.ForeignKey(
name: "FK_Conversations_AspNetUsers_CreatorId",
column: x => x.CreatorId,
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
});
migrationBuilder.CreateTable(
name: "ModerationActions",
columns: table => new
{
Id = table.Column(type: "TEXT", nullable: false),
Action = table.Column(type: "TEXT", nullable: false),
TargetType = table.Column(type: "TEXT", nullable: false),
TargetId = table.Column(type: "TEXT", nullable: false),
Reason = table.Column(type: "TEXT", nullable: true),
Details = table.Column(type: "TEXT", nullable: true),
Timestamp = table.Column(type: "TEXT", nullable: false),
ModeratorId = table.Column(type: "TEXT", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_ModerationActions", x => x.Id);
table.ForeignKey(
name: "FK_ModerationActions_AspNetUsers_ModeratorId",
column: x => x.ModeratorId,
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "Notifications",
columns: table => new
{
Id = table.Column(type: "TEXT", nullable: false),
Type = table.Column(type: "INTEGER", nullable: false),
Message = table.Column(type: "TEXT", maxLength: 500, nullable: false),
CreatedAt = table.Column(type: "TEXT", nullable: false),
IsRead = table.Column(type: "INTEGER", nullable: false),
RelatedPostId = table.Column(type: "INTEGER", nullable: true),
RelatedCommentId = table.Column(type: "INTEGER", nullable: true),
RelatedForumPostId = table.Column(type: "INTEGER", nullable: true),
RelatedConversationId = table.Column(type: "TEXT", nullable: true),
RelatedMessageId = table.Column(type: "INTEGER", nullable: true),
TriggeredByUserId = table.Column(type: "TEXT", nullable: true),
UserId = table.Column(type: "TEXT", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Notifications", x => x.Id);
table.ForeignKey(
name: "FK_Notifications_AspNetUsers_TriggeredByUserId",
column: x => x.TriggeredByUserId,
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.SetNull);
table.ForeignKey(
name: "FK_Notifications_AspNetUsers_UserId",
column: x => x.UserId,
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "Reactions",
columns: table => new
{
Id = table.Column(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
EntityType = table.Column(type: "INTEGER", nullable: false),
EntityId = table.Column(type: "INTEGER", nullable: false),
UserId = table.Column(type: "TEXT", nullable: false),
EmoteName = table.Column(type: "TEXT", maxLength: 32, nullable: false),
CreatedAt = table.Column(type: "TEXT", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Reactions", x => x.Id);
table.ForeignKey(
name: "FK_Reactions_AspNetUsers_UserId",
column: x => x.UserId,
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "RefreshTokens",
columns: table => new
{
Id = table.Column(type: "TEXT", nullable: false),
Token = table.Column(type: "TEXT", nullable: false),
UserId = table.Column(type: "TEXT", nullable: false),
ExpiresAt = table.Column(type: "TEXT", nullable: false),
CreatedAt = table.Column(type: "TEXT", nullable: false),
IsRevoked = table.Column(type: "INTEGER", nullable: false),
RevokedAt = table.Column(type: "TEXT", nullable: true),
ReplacedByToken = table.Column(type: "TEXT", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_RefreshTokens", x => x.Id);
table.ForeignKey(
name: "FK_RefreshTokens_AspNetUsers_UserId",
column: x => x.UserId,
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "Reports",
columns: table => new
{
Id = table.Column(type: "TEXT", nullable: false),
TargetType = table.Column(type: "INTEGER", nullable: false),
TargetId = table.Column(type: "TEXT", maxLength: 100, nullable: false),
Reason = table.Column(type: "TEXT", maxLength: 2000, nullable: false),
Status = table.Column(type: "INTEGER", nullable: false),
CreatedAt = table.Column(type: "TEXT", nullable: false),
ResolvedAt = table.Column(type: "TEXT", nullable: true),
ResolutionNote = table.Column(type: "TEXT", maxLength: 2000, nullable: true),
ReporterId = table.Column(type: "TEXT", nullable: false),
ModeratorId = table.Column(type: "TEXT", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Reports", x => x.Id);
table.ForeignKey(
name: "FK_Reports_AspNetUsers_ModeratorId",
column: x => x.ModeratorId,
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.SetNull);
table.ForeignKey(
name: "FK_Reports_AspNetUsers_ReporterId",
column: x => x.ReporterId,
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "StoredFiles",
columns: table => new
{
Id = table.Column(type: "TEXT", nullable: false),
FileIdentifier = table.Column(type: "TEXT", nullable: false),
ContentType = table.Column(type: "TEXT", nullable: false),
FileSize = table.Column(type: "INTEGER", nullable: false),
OriginalFileName = table.Column(type: "TEXT", nullable: false),
Hash = table.Column(type: "TEXT", nullable: false),
CreatedAtUtc = table.Column(type: "TEXT", nullable: false),
IsPublic = table.Column(type: "INTEGER", nullable: false),
UploaderId = table.Column(type: "TEXT", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_StoredFiles", x => x.Id);
table.ForeignKey(
name: "FK_StoredFiles_AspNetUsers_UploaderId",
column: x => x.UploaderId,
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
});
migrationBuilder.CreateTable(
name: "UserIps",
columns: table => new
{
Id = table.Column(type: "TEXT", nullable: false),
IpAddress = table.Column(type: "TEXT", nullable: false),
FirstSeen = table.Column(type: "TEXT", nullable: false),
LastSeen = table.Column(type: "TEXT", nullable: false),
UserId = table.Column(type: "TEXT", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_UserIps", x => x.Id);
table.ForeignKey(
name: "FK_UserIps_AspNetUsers_UserId",
column: x => x.UserId,
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "BooruTags",
columns: table => new
{
Id = table.Column(type: "TEXT", nullable: false),
Name = table.Column(type: "TEXT", maxLength: 100, nullable: false),
CategoryId = table.Column(type: "TEXT", nullable: true),
PostCount = table.Column(type: "INTEGER", nullable: false),
CreatedAt = table.Column(type: "TEXT", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_BooruTags", x => x.Id);
table.ForeignKey(
name: "FK_BooruTags_BooruTagCategories_CategoryId",
column: x => x.CategoryId,
principalTable: "BooruTagCategories",
principalColumn: "Id");
});
migrationBuilder.CreateTable(
name: "BooruComments",
columns: table => new
{
Id = table.Column(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
ContentRaw = table.Column(type: "text", maxLength: 10000, nullable: false),
ContentHtml = table.Column(type: "text", nullable: false),
CreatedAt = table.Column(type: "TEXT", nullable: false),
EditedAt = table.Column(type: "TEXT", nullable: true),
UserId = table.Column(type: "TEXT", nullable: false),
PostId = table.Column(type: "INTEGER", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_BooruComments", x => x.Id);
table.ForeignKey(
name: "FK_BooruComments_AspNetUsers_UserId",
column: x => x.UserId,
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_BooruComments_BooruPosts_PostId",
column: x => x.PostId,
principalTable: "BooruPosts",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "BooruPostFavorites",
columns: table => new
{
PostId = table.Column(type: "INTEGER", nullable: false),
UserId = table.Column(type: "TEXT", nullable: false),
CreatedAt = table.Column(type: "TEXT", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_BooruPostFavorites", x => new { x.PostId, x.UserId });
table.ForeignKey(
name: "FK_BooruPostFavorites_AspNetUsers_UserId",
column: x => x.UserId,
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_BooruPostFavorites_BooruPosts_PostId",
column: x => x.PostId,
principalTable: "BooruPosts",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "BooruPostVotes",
columns: table => new
{
PostId = table.Column(type: "INTEGER", nullable: false),
UserId = table.Column(type: "TEXT", nullable: false),
Value = table.Column(type: "INTEGER", nullable: false),
CreatedAt = table.Column(type: "TEXT", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_BooruPostVotes", x => new { x.PostId, x.UserId });
table.ForeignKey(
name: "FK_BooruPostVotes_AspNetUsers_UserId",
column: x => x.UserId,
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_BooruPostVotes_BooruPosts_PostId",
column: x => x.PostId,
principalTable: "BooruPosts",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "SourceHistories",
columns: table => new
{
Id = table.Column(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
PostId = table.Column(type: "INTEGER", nullable: false),
UserId = table.Column(type: "TEXT", nullable: false),
UserIp = table.Column(type: "TEXT", nullable: true),
Source = table.Column(type: "TEXT", maxLength: 2000, nullable: true),
DateSet = table.Column(type: "TEXT", nullable: false),
SuppressedAt = table.Column(type: "TEXT", nullable: true),
SuppressedById = table.Column(type: "TEXT", nullable: true),
SuppressionReason = table.Column(type: "TEXT", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_SourceHistories", x => x.Id);
table.ForeignKey(
name: "FK_SourceHistories_AspNetUsers_SuppressedById",
column: x => x.SuppressedById,
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.SetNull);
table.ForeignKey(
name: "FK_SourceHistories_AspNetUsers_UserId",
column: x => x.UserId,
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_SourceHistories_BooruPosts_PostId",
column: x => x.PostId,
principalTable: "BooruPosts",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "TagHistories",
columns: table => new
{
Id = table.Column(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
PostId = table.Column(type: "INTEGER", nullable: false),
UserId = table.Column(type: "TEXT", nullable: false),
UserIp = table.Column(type: "TEXT", nullable: true),
Tags = table.Column(type: "TEXT", nullable: false),
DateSet = table.Column(type: "TEXT", nullable: false),
SuppressedAt = table.Column(type: "TEXT", nullable: true),
SuppressedById = table.Column(type: "TEXT", nullable: true),
SuppressionReason = table.Column(type: "TEXT", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_TagHistories", x => x.Id);
table.ForeignKey(
name: "FK_TagHistories_AspNetUsers_SuppressedById",
column: x => x.SuppressedById,
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.SetNull);
table.ForeignKey(
name: "FK_TagHistories_AspNetUsers_UserId",
column: x => x.UserId,
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_TagHistories_BooruPosts_PostId",
column: x => x.PostId,
principalTable: "BooruPosts",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "ConversationParticipants",
columns: table => new
{
ConversationId = table.Column(type: "TEXT", nullable: false),
UserId = table.Column(type: "TEXT", nullable: false),
JoinedAt = table.Column(type: "TEXT", nullable: false),
LastReadAt = table.Column(type: "TEXT", nullable: true),
HasLeft = table.Column(type: "INTEGER", nullable: false),
LeftAt = table.Column(type: "TEXT", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_ConversationParticipants", x => new { x.ConversationId, x.UserId });
table.ForeignKey(
name: "FK_ConversationParticipants_AspNetUsers_UserId",
column: x => x.UserId,
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_ConversationParticipants_Conversations_ConversationId",
column: x => x.ConversationId,
principalTable: "Conversations",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "Messages",
columns: table => new
{
Id = table.Column(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
ContentRaw = table.Column(type: "TEXT", maxLength: 10000, nullable: false),
ContentHtml = table.Column(type: "TEXT", nullable: false),
CreatedAt = table.Column(type: "TEXT", nullable: false),
EditedAt = table.Column(type: "TEXT", nullable: true),
ConversationId = table.Column(type: "TEXT", nullable: false),
AuthorId = table.Column(type: "TEXT", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Messages", x => x.Id);
table.ForeignKey(
name: "FK_Messages_AspNetUsers_AuthorId",
column: x => x.AuthorId,
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
table.ForeignKey(
name: "FK_Messages_Conversations_ConversationId",
column: x => x.ConversationId,
principalTable: "Conversations",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "BooruTagAliases",
columns: table => new
{
Id = table.Column(type: "TEXT", nullable: false),
AliasTagId = table.Column(type: "TEXT", nullable: false),
TargetTagId = table.Column(type: "TEXT", nullable: false),
CreatedAt = table.Column(type: "TEXT", nullable: false),
CreatedByUserId = table.Column(type: "TEXT", nullable: true),
IsActive = table.Column(type: "INTEGER", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_BooruTagAliases", x => x.Id);
table.ForeignKey(
name: "FK_BooruTagAliases_AspNetUsers_CreatedByUserId",
column: x => x.CreatedByUserId,
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.SetNull);
table.ForeignKey(
name: "FK_BooruTagAliases_BooruTags_AliasTagId",
column: x => x.AliasTagId,
principalTable: "BooruTags",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_BooruTagAliases_BooruTags_TargetTagId",
column: x => x.TargetTagId,
principalTable: "BooruTags",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "BooruTagImplications",
columns: table => new
{
Id = table.Column(type: "TEXT", nullable: false),
AntecedentTagId = table.Column(type: "TEXT", nullable: false),
ConsequentTagId = table.Column(type: "TEXT", nullable: false),
CreatedAt = table.Column(type: "TEXT", nullable: false),
CreatedByUserId = table.Column(type: "TEXT", nullable: true),
IsActive = table.Column(type: "INTEGER", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_BooruTagImplications", x => x.Id);
table.ForeignKey(
name: "FK_BooruTagImplications_AspNetUsers_CreatedByUserId",
column: x => x.CreatedByUserId,
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.SetNull);
table.ForeignKey(
name: "FK_BooruTagImplications_BooruTags_AntecedentTagId",
column: x => x.AntecedentTagId,
principalTable: "BooruTags",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_BooruTagImplications_BooruTags_ConsequentTagId",
column: x => x.ConsequentTagId,
principalTable: "BooruTags",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "PostTag",
columns: table => new
{
PostId = table.Column(type: "INTEGER", nullable: false),
TagId = table.Column(type: "TEXT", nullable: false),
AddedAt = table.Column(type: "TEXT", nullable: false),
IsLocked = table.Column(type: "INTEGER", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_PostTag", x => new { x.PostId, x.TagId });
table.ForeignKey(
name: "FK_PostTag_BooruPosts_PostId",
column: x => x.PostId,
principalTable: "BooruPosts",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_PostTag_BooruTags_TagId",
column: x => x.TagId,
principalTable: "BooruTags",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "CommentMentions",
columns: table => new
{
CommentId = table.Column(type: "INTEGER", nullable: false),
MentionedUserId = table.Column(type: "TEXT", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_CommentMentions", x => new { x.CommentId, x.MentionedUserId });
table.ForeignKey(
name: "FK_CommentMentions_AspNetUsers_MentionedUserId",
column: x => x.MentionedUserId,
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_CommentMentions_BooruComments_CommentId",
column: x => x.CommentId,
principalTable: "BooruComments",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "MessageMentions",
columns: table => new
{
MessageId = table.Column(type: "INTEGER", nullable: false),
MentionedUserId = table.Column(type: "TEXT", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_MessageMentions", x => new { x.MessageId, x.MentionedUserId });
table.ForeignKey(
name: "FK_MessageMentions_AspNetUsers_MentionedUserId",
column: x => x.MentionedUserId,
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_MessageMentions_Messages_MessageId",
column: x => x.MessageId,
principalTable: "Messages",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "ForumPostAttachments",
columns: table => new
{
Id = table.Column(type: "TEXT", nullable: false),
ForumPostId = table.Column(type: "INTEGER", nullable: true),
UploaderId = table.Column(type: "TEXT", nullable: false),
FileIdentifier = table.Column(type: "TEXT", maxLength: 255, nullable: false),
OriginalFileName = table.Column(type: "TEXT", maxLength: 255, nullable: false),
ContentType = table.Column(type: "TEXT", maxLength: 100, nullable: false),
FileSize = table.Column(type: "INTEGER", nullable: false),
Width = table.Column(type: "INTEGER", nullable: true),
Height = table.Column(type: "INTEGER", nullable: true),
ThumbnailIdentifier = table.Column(type: "TEXT", maxLength: 255, nullable: true),
CreatedAt = table.Column(type: "TEXT", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_ForumPostAttachments", x => x.Id);
table.ForeignKey(
name: "FK_ForumPostAttachments_AspNetUsers_UploaderId",
column: x => x.UploaderId,
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "ForumPostMentions",
columns: table => new
{
ForumPostId = table.Column(type: "INTEGER", nullable: false),
MentionedUserId = table.Column(type: "TEXT", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_ForumPostMentions", x => new { x.ForumPostId, x.MentionedUserId });
table.ForeignKey(
name: "FK_ForumPostMentions_AspNetUsers_MentionedUserId",
column: x => x.MentionedUserId,
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "ForumPosts",
columns: table => new
{
Id = table.Column(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
ContentRaw = table.Column(type: "text", maxLength: 50000, nullable: false),
ContentHtml = table.Column(type: "text", nullable: false),
CreatedAt = table.Column(type: "TEXT", nullable: false),
EditedAt = table.Column(type: "TEXT", nullable: true),
ThreadId = table.Column(type: "INTEGER", nullable: false),
AuthorId = table.Column(type: "TEXT", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_ForumPosts", x => x.Id);
table.ForeignKey(
name: "FK_ForumPosts_AspNetUsers_AuthorId",
column: x => x.AuthorId,
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
});
migrationBuilder.CreateTable(
name: "ForumThreads",
columns: table => new
{
Id = table.Column(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
Title = table.Column(type: "TEXT", maxLength: 200, nullable: false),
IsPinned = table.Column(type: "INTEGER", nullable: false),
IsLocked = table.Column(type: "INTEGER", nullable: false),
CreatedAt = table.Column(type: "TEXT", nullable: false),
LastPostAt = table.Column(type: "TEXT", nullable: false),
ReplyCount = table.Column(type: "INTEGER", nullable: false),
ViewCount = table.Column(type: "INTEGER", nullable: false),
CategoryId = table.Column(type: "TEXT", nullable: false),
AuthorId = table.Column(type: "TEXT", nullable: false),
FirstPostId = table.Column(type: "INTEGER", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_ForumThreads", x => x.Id);
table.ForeignKey(
name: "FK_ForumThreads_AspNetUsers_AuthorId",
column: x => x.AuthorId,
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
table.ForeignKey(
name: "FK_ForumThreads_ForumCategories_CategoryId",
column: x => x.CategoryId,
principalTable: "ForumCategories",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_ForumThreads_ForumPosts_FirstPostId",
column: x => x.FirstPostId,
principalTable: "ForumPosts",
principalColumn: "Id",
onDelete: ReferentialAction.SetNull);
});
migrationBuilder.InsertData(
table: "BooruTagCategories",
columns: new[] { "Id", "ColorHex", "IsActive", "MaxPerPost", "Name", "ParentCategoryId", "Slug", "SortOrder", "Version" },
values: new object[,]
{
{ new Guid("20000000-0000-0000-0000-000000000001"), "#ff00ae", true, null, "Artist", null, "artist", 1, 0u },
{ new Guid("20000000-0000-0000-0000-000000000002"), "#FF0000", true, null, "Character", null, "character", 2, 0u },
{ new Guid("20000000-0000-0000-0000-000000000003"), "#004000", true, null, "Flag", null, "flag", 3, 0u },
{ new Guid("20000000-0000-0000-0000-000000000004"), "#964B00", true, null, "Meta", null, "meta", 4, 0u },
{ new Guid("20000000-0000-0000-0000-000000000005"), "#26a269", true, null, "NAS", null, "nas", 5, 0u },
{ new Guid("20000000-0000-0000-0000-000000000006"), "#AA00AA", true, null, "Series", null, "series", 6, 0u },
{ new Guid("20000000-0000-0000-0000-000000000007"), "#186341", true, null, "SubNAS", null, "subnas", 7, 0u },
{ new Guid("20000000-0000-0000-0000-000000000008"), "#e57a00", true, null, "Subvariant", null, "subvariant", 8, 0u },
{ new Guid("20000000-0000-0000-0000-000000000009"), "#00ff00", true, null, "Trend", null, "trend", 9, 0u },
{ new Guid("20000000-0000-0000-0000-00000000000a"), "#FF0000", true, null, "Variant", null, "variant", 10, 0u }
});
migrationBuilder.InsertData(
table: "ForumCategories",
columns: new[] { "Id", "Color", "Description", "DisplayOrder", "Name", "Slug" },
values: new object[,]
{
{ new Guid("10000000-0000-0000-0000-000000000001"), "#22c55e", "Random discussions and off-topic conversations", 1, "General & Off-Topic", "gen" },
{ new Guid("10000000-0000-0000-0000-000000000002"), "#8b5cf6", "Personal blogs and long-form content", 2, "Blogposting", "blog" },
{ new Guid("10000000-0000-0000-0000-000000000003"), "#ef4444", "Current events and political discussion", 3, "News & Politics", "news" },
{ new Guid("10000000-0000-0000-0000-000000000004"), "#3b82f6", "Site feedback, suggestions, and meta discussion", 4, "Metadiscussion", "meta" },
{ new Guid("10000000-0000-0000-0000-000000000005"), "#ec4899", "Share and discuss music, videos, art, and other media", 5, "Multimedia", "media" },
{ new Guid("10000000-0000-0000-0000-000000000006"), "#f59e0b", "Showcase your projects and collaborate with others", 6, "Projects", "projects" }
});
migrationBuilder.CreateIndex(
name: "IX_AspNetRoleClaims_RoleId",
table: "AspNetRoleClaims",
column: "RoleId");
migrationBuilder.CreateIndex(
name: "RoleNameIndex",
table: "AspNetRoles",
column: "NormalizedName",
unique: true);
migrationBuilder.CreateIndex(
name: "IX_AspNetUserClaims_UserId",
table: "AspNetUserClaims",
column: "UserId");
migrationBuilder.CreateIndex(
name: "IX_AspNetUserLogins_UserId",
table: "AspNetUserLogins",
column: "UserId");
migrationBuilder.CreateIndex(
name: "IX_AspNetUserRoles_RoleId",
table: "AspNetUserRoles",
column: "RoleId");
migrationBuilder.CreateIndex(
name: "EmailIndex",
table: "AspNetUsers",
column: "NormalizedEmail");
migrationBuilder.CreateIndex(
name: "UserNameIndex",
table: "AspNetUsers",
column: "NormalizedUserName",
unique: true);
migrationBuilder.CreateIndex(
name: "IX_Bans_UserId",
table: "Bans",
column: "UserId");
migrationBuilder.CreateIndex(
name: "IX_BooruComments_CreatedAt",
table: "BooruComments",
column: "CreatedAt");
migrationBuilder.CreateIndex(
name: "IX_BooruComments_PostId",
table: "BooruComments",
column: "PostId");
migrationBuilder.CreateIndex(
name: "IX_BooruComments_PostId_CreatedAt",
table: "BooruComments",
columns: new[] { "PostId", "CreatedAt" });
migrationBuilder.CreateIndex(
name: "IX_BooruComments_UserId",
table: "BooruComments",
column: "UserId");
migrationBuilder.CreateIndex(
name: "IX_BooruComments_UserId_CreatedAt",
table: "BooruComments",
columns: new[] { "UserId", "CreatedAt" });
migrationBuilder.CreateIndex(
name: "IX_BooruPostFavorites_CreatedAt",
table: "BooruPostFavorites",
column: "CreatedAt");
migrationBuilder.CreateIndex(
name: "IX_BooruPostFavorites_PostId_CreatedAt",
table: "BooruPostFavorites",
columns: new[] { "PostId", "CreatedAt" });
migrationBuilder.CreateIndex(
name: "IX_BooruPostFavorites_UserId",
table: "BooruPostFavorites",
column: "UserId");
migrationBuilder.CreateIndex(
name: "IX_BooruPosts_ImageHash",
table: "BooruPosts",
column: "ImageHash",
unique: true);
migrationBuilder.CreateIndex(
name: "IX_BooruPosts_IsApproved",
table: "BooruPosts",
column: "IsApproved");
migrationBuilder.CreateIndex(
name: "IX_BooruPosts_IsApproved_UploadedAt",
table: "BooruPosts",
columns: new[] { "IsApproved", "UploadedAt" });
migrationBuilder.CreateIndex(
name: "IX_BooruPosts_MimeType",
table: "BooruPosts",
column: "MimeType");
migrationBuilder.CreateIndex(
name: "IX_BooruPosts_Rating",
table: "BooruPosts",
column: "Rating");
migrationBuilder.CreateIndex(
name: "IX_BooruPosts_Rating_UploadedAt",
table: "BooruPosts",
columns: new[] { "Rating", "UploadedAt" });
migrationBuilder.CreateIndex(
name: "IX_BooruPosts_UploadedAt",
table: "BooruPosts",
column: "UploadedAt");
migrationBuilder.CreateIndex(
name: "IX_BooruPosts_UploaderId",
table: "BooruPosts",
column: "UploaderId");
migrationBuilder.CreateIndex(
name: "IX_BooruPosts_UploaderId_UploadedAt",
table: "BooruPosts",
columns: new[] { "UploaderId", "UploadedAt" });
migrationBuilder.CreateIndex(
name: "IX_BooruPostVotes_CreatedAt",
table: "BooruPostVotes",
column: "CreatedAt");
migrationBuilder.CreateIndex(
name: "IX_BooruPostVotes_PostId_CreatedAt",
table: "BooruPostVotes",
columns: new[] { "PostId", "CreatedAt" });
migrationBuilder.CreateIndex(
name: "IX_BooruPostVotes_UserId",
table: "BooruPostVotes",
column: "UserId");
migrationBuilder.CreateIndex(
name: "IX_BooruTagAliases_AliasTagId",
table: "BooruTagAliases",
column: "AliasTagId",
unique: true);
migrationBuilder.CreateIndex(
name: "IX_BooruTagAliases_CreatedAt",
table: "BooruTagAliases",
column: "CreatedAt");
migrationBuilder.CreateIndex(
name: "IX_BooruTagAliases_CreatedByUserId",
table: "BooruTagAliases",
column: "CreatedByUserId");
migrationBuilder.CreateIndex(
name: "IX_BooruTagAliases_IsActive",
table: "BooruTagAliases",
column: "IsActive");
migrationBuilder.CreateIndex(
name: "IX_BooruTagAliases_TargetTagId",
table: "BooruTagAliases",
column: "TargetTagId");
migrationBuilder.CreateIndex(
name: "IX_BooruTagCategories_ParentCategoryId",
table: "BooruTagCategories",
column: "ParentCategoryId");
migrationBuilder.CreateIndex(
name: "IX_BooruTagCategories_Slug",
table: "BooruTagCategories",
column: "Slug",
unique: true);
migrationBuilder.CreateIndex(
name: "IX_BooruTagImplications_AntecedentTagId_ConsequentTagId",
table: "BooruTagImplications",
columns: new[] { "AntecedentTagId", "ConsequentTagId" },
unique: true);
migrationBuilder.CreateIndex(
name: "IX_BooruTagImplications_ConsequentTagId",
table: "BooruTagImplications",
column: "ConsequentTagId");
migrationBuilder.CreateIndex(
name: "IX_BooruTagImplications_CreatedAt",
table: "BooruTagImplications",
column: "CreatedAt");
migrationBuilder.CreateIndex(
name: "IX_BooruTagImplications_CreatedByUserId",
table: "BooruTagImplications",
column: "CreatedByUserId");
migrationBuilder.CreateIndex(
name: "IX_BooruTagImplications_IsActive",
table: "BooruTagImplications",
column: "IsActive");
migrationBuilder.CreateIndex(
name: "IX_BooruTags_CategoryId",
table: "BooruTags",
column: "CategoryId");
migrationBuilder.CreateIndex(
name: "IX_BooruTags_Name",
table: "BooruTags",
column: "Name");
migrationBuilder.CreateIndex(
name: "IX_BooruTags_Name_CategoryId",
table: "BooruTags",
columns: new[] { "Name", "CategoryId" },
unique: true);
migrationBuilder.CreateIndex(
name: "IX_BooruTags_PostCount",
table: "BooruTags",
column: "PostCount");
migrationBuilder.CreateIndex(
name: "IX_CommentMentions_MentionedUserId",
table: "CommentMentions",
column: "MentionedUserId");
migrationBuilder.CreateIndex(
name: "IX_ConversationParticipants_UserId",
table: "ConversationParticipants",
column: "UserId");
migrationBuilder.CreateIndex(
name: "IX_ConversationParticipants_UserId_HasLeft",
table: "ConversationParticipants",
columns: new[] { "UserId", "HasLeft" });
migrationBuilder.CreateIndex(
name: "IX_Conversations_CreatorId",
table: "Conversations",
column: "CreatorId");
migrationBuilder.CreateIndex(
name: "IX_Conversations_LastMessageAt",
table: "Conversations",
column: "LastMessageAt");
migrationBuilder.CreateIndex(
name: "IX_ForumCategories_Slug",
table: "ForumCategories",
column: "Slug",
unique: true);
migrationBuilder.CreateIndex(
name: "IX_ForumPostAttachments_ForumPostId_CreatedAt",
table: "ForumPostAttachments",
columns: new[] { "ForumPostId", "CreatedAt" });
migrationBuilder.CreateIndex(
name: "IX_ForumPostAttachments_UploaderId",
table: "ForumPostAttachments",
column: "UploaderId");
migrationBuilder.CreateIndex(
name: "IX_ForumPostMentions_MentionedUserId",
table: "ForumPostMentions",
column: "MentionedUserId");
migrationBuilder.CreateIndex(
name: "IX_ForumPosts_AuthorId_CreatedAt",
table: "ForumPosts",
columns: new[] { "AuthorId", "CreatedAt" });
migrationBuilder.CreateIndex(
name: "IX_ForumPosts_CreatedAt",
table: "ForumPosts",
column: "CreatedAt");
migrationBuilder.CreateIndex(
name: "IX_ForumPosts_ThreadId_CreatedAt",
table: "ForumPosts",
columns: new[] { "ThreadId", "CreatedAt" });
migrationBuilder.CreateIndex(
name: "IX_ForumThreads_AuthorId_CreatedAt",
table: "ForumThreads",
columns: new[] { "AuthorId", "CreatedAt" });
migrationBuilder.CreateIndex(
name: "IX_ForumThreads_CategoryId_IsPinned_LastPostAt",
table: "ForumThreads",
columns: new[] { "CategoryId", "IsPinned", "LastPostAt" });
migrationBuilder.CreateIndex(
name: "IX_ForumThreads_CreatedAt",
table: "ForumThreads",
column: "CreatedAt");
migrationBuilder.CreateIndex(
name: "IX_ForumThreads_FirstPostId",
table: "ForumThreads",
column: "FirstPostId",
unique: true);
migrationBuilder.CreateIndex(
name: "IX_MessageMentions_MentionedUserId",
table: "MessageMentions",
column: "MentionedUserId");
migrationBuilder.CreateIndex(
name: "IX_Messages_AuthorId",
table: "Messages",
column: "AuthorId");
migrationBuilder.CreateIndex(
name: "IX_Messages_ConversationId",
table: "Messages",
column: "ConversationId");
migrationBuilder.CreateIndex(
name: "IX_Messages_ConversationId_CreatedAt",
table: "Messages",
columns: new[] { "ConversationId", "CreatedAt" });
migrationBuilder.CreateIndex(
name: "IX_ModerationActions_ModeratorId",
table: "ModerationActions",
column: "ModeratorId");
migrationBuilder.CreateIndex(
name: "IX_Notifications_TriggeredByUserId",
table: "Notifications",
column: "TriggeredByUserId");
migrationBuilder.CreateIndex(
name: "IX_Notifications_UserId_IsRead",
table: "Notifications",
columns: new[] { "UserId", "IsRead" });
migrationBuilder.CreateIndex(
name: "IX_Notifications_UserId_IsRead_CreatedAt",
table: "Notifications",
columns: new[] { "UserId", "IsRead", "CreatedAt" });
migrationBuilder.CreateIndex(
name: "IX_PostTag_AddedAt",
table: "PostTag",
column: "AddedAt");
migrationBuilder.CreateIndex(
name: "IX_PostTag_IsLocked",
table: "PostTag",
column: "IsLocked");
migrationBuilder.CreateIndex(
name: "IX_PostTag_TagId",
table: "PostTag",
column: "TagId");
migrationBuilder.CreateIndex(
name: "IX_Reactions_EntityType_EntityId",
table: "Reactions",
columns: new[] { "EntityType", "EntityId" });
migrationBuilder.CreateIndex(
name: "IX_Reactions_EntityType_EntityId_UserId_EmoteName",
table: "Reactions",
columns: new[] { "EntityType", "EntityId", "UserId", "EmoteName" },
unique: true);
migrationBuilder.CreateIndex(
name: "IX_Reactions_UserId",
table: "Reactions",
column: "UserId");
migrationBuilder.CreateIndex(
name: "IX_RefreshTokens_UserId",
table: "RefreshTokens",
column: "UserId");
migrationBuilder.CreateIndex(
name: "IX_Reports_CreatedAt",
table: "Reports",
column: "CreatedAt");
migrationBuilder.CreateIndex(
name: "IX_Reports_ModeratorId",
table: "Reports",
column: "ModeratorId");
migrationBuilder.CreateIndex(
name: "IX_Reports_ReporterId",
table: "Reports",
column: "ReporterId");
migrationBuilder.CreateIndex(
name: "IX_Reports_Status",
table: "Reports",
column: "Status");
migrationBuilder.CreateIndex(
name: "IX_Reports_TargetType_TargetId_ReporterId",
table: "Reports",
columns: new[] { "TargetType", "TargetId", "ReporterId" },
unique: true,
filter: "\"Status\" = 0");
migrationBuilder.CreateIndex(
name: "IX_SourceHistories_PostId",
table: "SourceHistories",
column: "PostId");
migrationBuilder.CreateIndex(
name: "IX_SourceHistories_PostId_DateSet",
table: "SourceHistories",
columns: new[] { "PostId", "DateSet" });
migrationBuilder.CreateIndex(
name: "IX_SourceHistories_SuppressedById",
table: "SourceHistories",
column: "SuppressedById");
migrationBuilder.CreateIndex(
name: "IX_SourceHistories_UserId",
table: "SourceHistories",
column: "UserId");
migrationBuilder.CreateIndex(
name: "IX_StoredFiles_FileIdentifier",
table: "StoredFiles",
column: "FileIdentifier",
unique: true);
migrationBuilder.CreateIndex(
name: "IX_StoredFiles_Hash",
table: "StoredFiles",
column: "Hash");
migrationBuilder.CreateIndex(
name: "IX_StoredFiles_UploaderId",
table: "StoredFiles",
column: "UploaderId");
migrationBuilder.CreateIndex(
name: "IX_TagHistories_PostId",
table: "TagHistories",
column: "PostId");
migrationBuilder.CreateIndex(
name: "IX_TagHistories_PostId_DateSet",
table: "TagHistories",
columns: new[] { "PostId", "DateSet" });
migrationBuilder.CreateIndex(
name: "IX_TagHistories_SuppressedById",
table: "TagHistories",
column: "SuppressedById");
migrationBuilder.CreateIndex(
name: "IX_TagHistories_UserId",
table: "TagHistories",
column: "UserId");
migrationBuilder.CreateIndex(
name: "IX_UserIps_UserId",
table: "UserIps",
column: "UserId");
migrationBuilder.AddForeignKey(
name: "FK_ForumPostAttachments_ForumPosts_ForumPostId",
table: "ForumPostAttachments",
column: "ForumPostId",
principalTable: "ForumPosts",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_ForumPostMentions_ForumPosts_ForumPostId",
table: "ForumPostMentions",
column: "ForumPostId",
principalTable: "ForumPosts",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_ForumPosts_ForumThreads_ThreadId",
table: "ForumPosts",
column: "ThreadId",
principalTable: "ForumThreads",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
}
///
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_ForumPosts_AspNetUsers_AuthorId",
table: "ForumPosts");
migrationBuilder.DropForeignKey(
name: "FK_ForumThreads_AspNetUsers_AuthorId",
table: "ForumThreads");
migrationBuilder.DropForeignKey(
name: "FK_ForumThreads_ForumPosts_FirstPostId",
table: "ForumThreads");
migrationBuilder.DropTable(
name: "AspNetRoleClaims");
migrationBuilder.DropTable(
name: "AspNetUserClaims");
migrationBuilder.DropTable(
name: "AspNetUserLogins");
migrationBuilder.DropTable(
name: "AspNetUserRoles");
migrationBuilder.DropTable(
name: "AspNetUserTokens");
migrationBuilder.DropTable(
name: "Bans");
migrationBuilder.DropTable(
name: "BooruPostFavorites");
migrationBuilder.DropTable(
name: "BooruPostVotes");
migrationBuilder.DropTable(
name: "BooruTagAliases");
migrationBuilder.DropTable(
name: "BooruTagImplications");
migrationBuilder.DropTable(
name: "CommentMentions");
migrationBuilder.DropTable(
name: "ConversationParticipants");
migrationBuilder.DropTable(
name: "ForumPostAttachments");
migrationBuilder.DropTable(
name: "ForumPostMentions");
migrationBuilder.DropTable(
name: "MessageMentions");
migrationBuilder.DropTable(
name: "ModerationActions");
migrationBuilder.DropTable(
name: "Notifications");
migrationBuilder.DropTable(
name: "PostTag");
migrationBuilder.DropTable(
name: "Reactions");
migrationBuilder.DropTable(
name: "RefreshTokens");
migrationBuilder.DropTable(
name: "Reports");
migrationBuilder.DropTable(
name: "SourceHistories");
migrationBuilder.DropTable(
name: "StoredFiles");
migrationBuilder.DropTable(
name: "TagHistories");
migrationBuilder.DropTable(
name: "UserIps");
migrationBuilder.DropTable(
name: "AspNetRoles");
migrationBuilder.DropTable(
name: "BooruComments");
migrationBuilder.DropTable(
name: "Messages");
migrationBuilder.DropTable(
name: "BooruTags");
migrationBuilder.DropTable(
name: "BooruPosts");
migrationBuilder.DropTable(
name: "Conversations");
migrationBuilder.DropTable(
name: "BooruTagCategories");
migrationBuilder.DropTable(
name: "AspNetUsers");
migrationBuilder.DropTable(
name: "ForumPosts");
migrationBuilder.DropTable(
name: "ForumThreads");
migrationBuilder.DropTable(
name: "ForumCategories");
}
}
}