using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Nuuru.Server.Migrations
{
///
public partial class AddBointsAndClans : Migration
{
///
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn(
name: "BoostedUntil",
table: "BooruPosts",
type: "TEXT",
nullable: true);
migrationBuilder.AddColumn(
name: "HasGoldenFrame",
table: "BooruPosts",
type: "INTEGER",
nullable: false,
defaultValue: false);
migrationBuilder.AddColumn(
name: "Boints",
table: "AspNetUsers",
type: "INTEGER",
nullable: false,
defaultValue: 0);
migrationBuilder.AddColumn(
name: "ForcedDisplayName",
table: "AspNetUsers",
type: "TEXT",
maxLength: 30,
nullable: true);
migrationBuilder.AddColumn(
name: "ForcedDisplayNameUntil",
table: "AspNetUsers",
type: "TEXT",
nullable: true);
migrationBuilder.AddColumn(
name: "HasProfileBorder",
table: "AspNetUsers",
type: "INTEGER",
maxLength: 50,
nullable: false,
defaultValue: false);
migrationBuilder.AddColumn(
name: "HasRenameImmunity",
table: "AspNetUsers",
type: "INTEGER",
nullable: false,
defaultValue: false);
migrationBuilder.AddColumn(
name: "RenameImmunityUntil",
table: "AspNetUsers",
type: "TEXT",
nullable: true);
migrationBuilder.CreateTable(
name: "BointsLedger",
columns: table => new
{
Id = table.Column(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
UserId = table.Column(type: "TEXT", nullable: false),
Amount = table.Column(type: "INTEGER", nullable: false),
Reason = table.Column(type: "INTEGER", nullable: false),
SourcePostId = table.Column(type: "INTEGER", nullable: true),
SourceCommentId = table.Column(type: "INTEGER", nullable: true),
SourceForumPostId = table.Column(type: "INTEGER", nullable: true),
SourceUserId = table.Column(type: "TEXT", nullable: true),
CreatedAt = table.Column(type: "TEXT", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_BointsLedger", x => x.Id);
table.ForeignKey(
name: "FK_BointsLedger_AspNetUsers_UserId",
column: x => x.UserId,
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "Clans",
columns: table => new
{
Id = table.Column(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
Name = table.Column(type: "TEXT", maxLength: 30, nullable: false),
Tag = table.Column(type: "TEXT", maxLength: 5, nullable: false),
Color = table.Column(type: "TEXT", maxLength: 7, nullable: false),
LeaderId = table.Column(type: "TEXT", nullable: false),
Treasury = table.Column(type: "INTEGER", nullable: false),
MaxMembers = table.Column(type: "INTEGER", nullable: false),
TaxRate = table.Column(type: "INTEGER", nullable: false),
BannerStorageIdentifier = table.Column(type: "TEXT", nullable: true),
BadgeStorageIdentifier = table.Column(type: "TEXT", nullable: true),
CreatedAt = table.Column(type: "TEXT", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Clans", x => x.Id);
table.ForeignKey(
name: "FK_Clans_AspNetUsers_LeaderId",
column: x => x.LeaderId,
principalTable: "AspNetUsers",
principalColumn: "Id");
});
migrationBuilder.CreateTable(
name: "SiteEffects",
columns: table => new
{
Id = table.Column(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
Type = table.Column(type: "INTEGER", nullable: false),
Content = table.Column(type: "TEXT", maxLength: 500, nullable: false),
UserId = table.Column(type: "TEXT", nullable: false),
CreatedAt = table.Column(type: "TEXT", nullable: false),
ExpiresAt = table.Column(type: "TEXT", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_SiteEffects", x => x.Id);
table.ForeignKey(
name: "FK_SiteEffects_AspNetUsers_UserId",
column: x => x.UserId,
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "UserInventoryItems",
columns: table => new
{
Id = table.Column(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
UserId = table.Column(type: "TEXT", nullable: false),
ItemId = table.Column(type: "TEXT", maxLength: 50, nullable: false),
Quantity = table.Column(type: "INTEGER", nullable: false),
AcquiredAt = table.Column(type: "TEXT", nullable: false),
UpdatedAt = table.Column(type: "TEXT", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_UserInventoryItems", x => x.Id);
table.ForeignKey(
name: "FK_UserInventoryItems_AspNetUsers_UserId",
column: x => x.UserId,
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "ClanEmotes",
columns: table => new
{
Id = table.Column(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
ClanId = table.Column(type: "INTEGER", nullable: false),
Name = table.Column(type: "TEXT", maxLength: 30, nullable: false),
StorageIdentifier = table.Column(type: "TEXT", nullable: false),
CreatedAt = table.Column(type: "TEXT", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_ClanEmotes", x => x.Id);
table.ForeignKey(
name: "FK_ClanEmotes_Clans_ClanId",
column: x => x.ClanId,
principalTable: "Clans",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "ClanForumCategories",
columns: table => new
{
ClanId = table.Column(type: "INTEGER", nullable: false),
ForumCategoryId = table.Column(type: "TEXT", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_ClanForumCategories", x => x.ClanId);
table.ForeignKey(
name: "FK_ClanForumCategories_Clans_ClanId",
column: x => x.ClanId,
principalTable: "Clans",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_ClanForumCategories_ForumCategories_ForumCategoryId",
column: x => x.ForumCategoryId,
principalTable: "ForumCategories",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "ClanInvites",
columns: table => new
{
Id = table.Column(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
ClanId = table.Column(type: "INTEGER", nullable: false),
InvitedUserId = table.Column(type: "TEXT", nullable: false),
InvitedByUserId = table.Column(type: "TEXT", nullable: false),
IsApplication = table.Column(type: "INTEGER", nullable: false),
CreatedAt = table.Column(type: "TEXT", nullable: false),
ExpiresAt = table.Column(type: "TEXT", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_ClanInvites", x => x.Id);
table.ForeignKey(
name: "FK_ClanInvites_AspNetUsers_InvitedByUserId",
column: x => x.InvitedByUserId,
principalTable: "AspNetUsers",
principalColumn: "Id");
table.ForeignKey(
name: "FK_ClanInvites_AspNetUsers_InvitedUserId",
column: x => x.InvitedUserId,
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_ClanInvites_Clans_ClanId",
column: x => x.ClanId,
principalTable: "Clans",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "ClanMembers",
columns: table => new
{
Id = table.Column(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
ClanId = table.Column(type: "INTEGER", nullable: false),
UserId = table.Column(type: "TEXT", nullable: false),
JoinedAt = table.Column(type: "TEXT", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_ClanMembers", x => x.Id);
table.ForeignKey(
name: "FK_ClanMembers_AspNetUsers_UserId",
column: x => x.UserId,
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_ClanMembers_Clans_ClanId",
column: x => x.ClanId,
principalTable: "Clans",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_BointsLedger_SourcePostId",
table: "BointsLedger",
column: "SourcePostId");
migrationBuilder.CreateIndex(
name: "IX_BointsLedger_UserId_CreatedAt",
table: "BointsLedger",
columns: new[] { "UserId", "CreatedAt" });
migrationBuilder.CreateIndex(
name: "IX_BointsLedger_UserId_Reason_CreatedAt",
table: "BointsLedger",
columns: new[] { "UserId", "Reason", "CreatedAt" });
migrationBuilder.CreateIndex(
name: "IX_BointsLedger_UserId_Reason_SourceCommentId_SourceUserId",
table: "BointsLedger",
columns: new[] { "UserId", "Reason", "SourceCommentId", "SourceUserId" });
migrationBuilder.CreateIndex(
name: "IX_BointsLedger_UserId_Reason_SourceForumPostId_SourceUserId",
table: "BointsLedger",
columns: new[] { "UserId", "Reason", "SourceForumPostId", "SourceUserId" });
migrationBuilder.CreateIndex(
name: "IX_BointsLedger_UserId_Reason_SourcePostId_SourceUserId",
table: "BointsLedger",
columns: new[] { "UserId", "Reason", "SourcePostId", "SourceUserId" });
migrationBuilder.CreateIndex(
name: "IX_ClanEmotes_ClanId_Name",
table: "ClanEmotes",
columns: new[] { "ClanId", "Name" },
unique: true);
migrationBuilder.CreateIndex(
name: "IX_ClanEmotes_Name",
table: "ClanEmotes",
column: "Name",
unique: true);
migrationBuilder.CreateIndex(
name: "IX_ClanForumCategories_ForumCategoryId",
table: "ClanForumCategories",
column: "ForumCategoryId",
unique: true);
migrationBuilder.CreateIndex(
name: "IX_ClanInvites_ClanId_InvitedUserId",
table: "ClanInvites",
columns: new[] { "ClanId", "InvitedUserId" },
unique: true);
migrationBuilder.CreateIndex(
name: "IX_ClanInvites_ExpiresAt",
table: "ClanInvites",
column: "ExpiresAt");
migrationBuilder.CreateIndex(
name: "IX_ClanInvites_InvitedByUserId",
table: "ClanInvites",
column: "InvitedByUserId");
migrationBuilder.CreateIndex(
name: "IX_ClanInvites_InvitedUserId",
table: "ClanInvites",
column: "InvitedUserId");
migrationBuilder.CreateIndex(
name: "IX_ClanMembers_ClanId",
table: "ClanMembers",
column: "ClanId");
migrationBuilder.CreateIndex(
name: "IX_ClanMembers_UserId",
table: "ClanMembers",
column: "UserId",
unique: true);
migrationBuilder.CreateIndex(
name: "IX_Clans_LeaderId",
table: "Clans",
column: "LeaderId");
migrationBuilder.CreateIndex(
name: "IX_Clans_Name",
table: "Clans",
column: "Name",
unique: true);
migrationBuilder.CreateIndex(
name: "IX_Clans_Tag",
table: "Clans",
column: "Tag",
unique: true);
migrationBuilder.CreateIndex(
name: "IX_SiteEffects_ExpiresAt",
table: "SiteEffects",
column: "ExpiresAt");
migrationBuilder.CreateIndex(
name: "IX_SiteEffects_Type_ExpiresAt",
table: "SiteEffects",
columns: new[] { "Type", "ExpiresAt" });
migrationBuilder.CreateIndex(
name: "IX_SiteEffects_UserId",
table: "SiteEffects",
column: "UserId");
migrationBuilder.CreateIndex(
name: "IX_UserInventoryItems_UserId",
table: "UserInventoryItems",
column: "UserId");
migrationBuilder.CreateIndex(
name: "IX_UserInventoryItems_UserId_ItemId",
table: "UserInventoryItems",
columns: new[] { "UserId", "ItemId" },
unique: true);
}
///
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "BointsLedger");
migrationBuilder.DropTable(
name: "ClanEmotes");
migrationBuilder.DropTable(
name: "ClanForumCategories");
migrationBuilder.DropTable(
name: "ClanInvites");
migrationBuilder.DropTable(
name: "ClanMembers");
migrationBuilder.DropTable(
name: "SiteEffects");
migrationBuilder.DropTable(
name: "UserInventoryItems");
migrationBuilder.DropTable(
name: "Clans");
migrationBuilder.DropColumn(
name: "BoostedUntil",
table: "BooruPosts");
migrationBuilder.DropColumn(
name: "HasGoldenFrame",
table: "BooruPosts");
migrationBuilder.DropColumn(
name: "Boints",
table: "AspNetUsers");
migrationBuilder.DropColumn(
name: "ForcedDisplayName",
table: "AspNetUsers");
migrationBuilder.DropColumn(
name: "ForcedDisplayNameUntil",
table: "AspNetUsers");
migrationBuilder.DropColumn(
name: "HasProfileBorder",
table: "AspNetUsers");
migrationBuilder.DropColumn(
name: "HasRenameImmunity",
table: "AspNetUsers");
migrationBuilder.DropColumn(
name: "RenameImmunityUntil",
table: "AspNetUsers");
}
}
}