mirror of
https://gitlab.com/Kwoth/nadekobot.git
synced 2025-09-11 01:38:27 -04:00
Nadeko's output will be cleaner, Reworked migrations
This commit is contained in:
2950
src/NadekoBot/Migrations/Sqlite/20240502233144_v5.Designer.cs
generated
Normal file
2950
src/NadekoBot/Migrations/Sqlite/20240502233144_v5.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
326
src/NadekoBot/Migrations/Sqlite/20240502233144_v5.cs
Normal file
326
src/NadekoBot/Migrations/Sqlite/20240502233144_v5.cs
Normal file
@@ -0,0 +1,326 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace NadekoBot.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class v5 : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "NsfwBlacklistedTags");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "PollAnswer");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "PollVote");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Poll");
|
||||
|
||||
migrationBuilder.DropUniqueConstraint(
|
||||
name: "AK_Clubs_Name",
|
||||
table: "Clubs");
|
||||
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "Command",
|
||||
table: "ShopEntry",
|
||||
type: "TEXT",
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.AddColumn<int>(
|
||||
name: "Type",
|
||||
table: "Reminders",
|
||||
type: "INTEGER",
|
||||
nullable: false,
|
||||
defaultValue: 0);
|
||||
|
||||
migrationBuilder.AddColumn<bool>(
|
||||
name: "StickyRoles",
|
||||
table: "GuildConfigs",
|
||||
type: "INTEGER",
|
||||
nullable: false,
|
||||
defaultValue: false);
|
||||
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "Name",
|
||||
table: "Clubs",
|
||||
type: "TEXT",
|
||||
maxLength: 20,
|
||||
nullable: true,
|
||||
oldClrType: typeof(string),
|
||||
oldType: "TEXT",
|
||||
oldMaxLength: 20);
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "GiveawayModel",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "INTEGER", nullable: false)
|
||||
.Annotation("Sqlite:Autoincrement", true),
|
||||
GuildId = table.Column<ulong>(type: "INTEGER", nullable: false),
|
||||
MessageId = table.Column<ulong>(type: "INTEGER", nullable: false),
|
||||
ChannelId = table.Column<ulong>(type: "INTEGER", nullable: false),
|
||||
Message = table.Column<string>(type: "TEXT", nullable: true),
|
||||
EndsAt = table.Column<DateTime>(type: "TEXT", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_GiveawayModel", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "StickyRoles",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "INTEGER", nullable: false)
|
||||
.Annotation("Sqlite:Autoincrement", true),
|
||||
GuildId = table.Column<ulong>(type: "INTEGER", nullable: false),
|
||||
RoleIds = table.Column<string>(type: "TEXT", nullable: true),
|
||||
UserId = table.Column<ulong>(type: "INTEGER", nullable: false),
|
||||
DateAdded = table.Column<DateTime>(type: "TEXT", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_StickyRoles", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "TodosArchive",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "INTEGER", nullable: false)
|
||||
.Annotation("Sqlite:Autoincrement", true),
|
||||
UserId = table.Column<ulong>(type: "INTEGER", nullable: false),
|
||||
Name = table.Column<string>(type: "TEXT", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_TodosArchive", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "GiveawayUser",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "INTEGER", nullable: false)
|
||||
.Annotation("Sqlite:Autoincrement", true),
|
||||
GiveawayId = table.Column<int>(type: "INTEGER", nullable: false),
|
||||
UserId = table.Column<ulong>(type: "INTEGER", nullable: false),
|
||||
Name = table.Column<string>(type: "TEXT", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_GiveawayUser", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_GiveawayUser_GiveawayModel_GiveawayId",
|
||||
column: x => x.GiveawayId,
|
||||
principalTable: "GiveawayModel",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Todos",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "INTEGER", nullable: false)
|
||||
.Annotation("Sqlite:Autoincrement", true),
|
||||
UserId = table.Column<ulong>(type: "INTEGER", nullable: false),
|
||||
Todo = table.Column<string>(type: "TEXT", nullable: true),
|
||||
DateAdded = table.Column<DateTime>(type: "TEXT", nullable: false),
|
||||
IsDone = table.Column<bool>(type: "INTEGER", nullable: false),
|
||||
ArchiveId = table.Column<int>(type: "INTEGER", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Todos", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_Todos_TodosArchive_ArchiveId",
|
||||
column: x => x.ArchiveId,
|
||||
principalTable: "TodosArchive",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Clubs_Name",
|
||||
table: "Clubs",
|
||||
column: "Name",
|
||||
unique: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_GiveawayUser_GiveawayId_UserId",
|
||||
table: "GiveawayUser",
|
||||
columns: new[] { "GiveawayId", "UserId" },
|
||||
unique: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_StickyRoles_GuildId_UserId",
|
||||
table: "StickyRoles",
|
||||
columns: new[] { "GuildId", "UserId" },
|
||||
unique: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Todos_ArchiveId",
|
||||
table: "Todos",
|
||||
column: "ArchiveId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Todos_UserId",
|
||||
table: "Todos",
|
||||
column: "UserId");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "GiveawayUser");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "StickyRoles");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Todos");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "GiveawayModel");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "TodosArchive");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_Clubs_Name",
|
||||
table: "Clubs");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "Command",
|
||||
table: "ShopEntry");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "Type",
|
||||
table: "Reminders");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "StickyRoles",
|
||||
table: "GuildConfigs");
|
||||
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "Name",
|
||||
table: "Clubs",
|
||||
type: "TEXT",
|
||||
maxLength: 20,
|
||||
nullable: false,
|
||||
defaultValue: "",
|
||||
oldClrType: typeof(string),
|
||||
oldType: "TEXT",
|
||||
oldMaxLength: 20,
|
||||
oldNullable: true);
|
||||
|
||||
migrationBuilder.AddUniqueConstraint(
|
||||
name: "AK_Clubs_Name",
|
||||
table: "Clubs",
|
||||
column: "Name");
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "NsfwBlacklistedTags",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "INTEGER", nullable: false)
|
||||
.Annotation("Sqlite:Autoincrement", true),
|
||||
DateAdded = table.Column<DateTime>(type: "TEXT", nullable: true),
|
||||
GuildId = table.Column<ulong>(type: "INTEGER", nullable: false),
|
||||
Tag = table.Column<string>(type: "TEXT", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_NsfwBlacklistedTags", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Poll",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "INTEGER", nullable: false)
|
||||
.Annotation("Sqlite:Autoincrement", true),
|
||||
ChannelId = table.Column<ulong>(type: "INTEGER", nullable: false),
|
||||
DateAdded = table.Column<DateTime>(type: "TEXT", nullable: true),
|
||||
GuildId = table.Column<ulong>(type: "INTEGER", nullable: false),
|
||||
Question = table.Column<string>(type: "TEXT", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Poll", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "PollAnswer",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "INTEGER", nullable: false)
|
||||
.Annotation("Sqlite:Autoincrement", true),
|
||||
DateAdded = table.Column<DateTime>(type: "TEXT", nullable: true),
|
||||
Index = table.Column<int>(type: "INTEGER", nullable: false),
|
||||
PollId = table.Column<int>(type: "INTEGER", nullable: true),
|
||||
Text = table.Column<string>(type: "TEXT", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_PollAnswer", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_PollAnswer_Poll_PollId",
|
||||
column: x => x.PollId,
|
||||
principalTable: "Poll",
|
||||
principalColumn: "Id");
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "PollVote",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "INTEGER", nullable: false)
|
||||
.Annotation("Sqlite:Autoincrement", true),
|
||||
DateAdded = table.Column<DateTime>(type: "TEXT", nullable: true),
|
||||
PollId = table.Column<int>(type: "INTEGER", nullable: true),
|
||||
UserId = table.Column<ulong>(type: "INTEGER", nullable: false),
|
||||
VoteIndex = table.Column<int>(type: "INTEGER", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_PollVote", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_PollVote_Poll_PollId",
|
||||
column: x => x.PollId,
|
||||
principalTable: "Poll",
|
||||
principalColumn: "Id");
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_NsfwBlacklistedTags_GuildId",
|
||||
table: "NsfwBlacklistedTags",
|
||||
column: "GuildId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Poll_GuildId",
|
||||
table: "Poll",
|
||||
column: "GuildId",
|
||||
unique: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_PollAnswer_PollId",
|
||||
table: "PollAnswer",
|
||||
column: "PollId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_PollVote_PollId",
|
||||
table: "PollVote",
|
||||
column: "PollId");
|
||||
}
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user