forked from EllieBotDevs/elliebot
I really hate database migrations
Also fixed tests
This commit is contained in:
parent
e1cc500a3a
commit
d743bd563b
12 changed files with 12562 additions and 12400 deletions
4117
src/EllieBot/Migrations/PostgreSql/20241207150050_awardedxp-temprole-notify.Designer.cs
generated
Normal file
4117
src/EllieBot/Migrations/PostgreSql/20241207150050_awardedxp-temprole-notify.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load diff
|
@ -0,0 +1,109 @@
|
|||
using System;
|
||||
using EllieBot.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace EllieBot.Migrations.PostgreSql
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class awardedxptemprolenotify : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropIndex(
|
||||
name: "ix_userxpstats_awardedxp",
|
||||
table: "userxpstats");
|
||||
|
||||
MigrationQueries.MergeAwardedXp(migrationBuilder);
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "awardedxp",
|
||||
table: "userxpstats");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "notifyonlevelup",
|
||||
table: "userxpstats");
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "notify",
|
||||
columns: table => new
|
||||
{
|
||||
id = table.Column<int>(type: "integer", nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
guildid = table.Column<decimal>(type: "numeric(20,0)", nullable: false),
|
||||
channelid = table.Column<decimal>(type: "numeric(20,0)", nullable: false),
|
||||
type = table.Column<int>(type: "integer", nullable: false),
|
||||
message = table.Column<string>(type: "character varying(10000)", maxLength: 10000, nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("pk_notify", x => x.id);
|
||||
table.UniqueConstraint("ak_notify_guildid_type", x => new { x.guildid, x.type });
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "temprole",
|
||||
columns: table => new
|
||||
{
|
||||
id = table.Column<int>(type: "integer", nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
guildid = table.Column<decimal>(type: "numeric(20,0)", nullable: false),
|
||||
remove = table.Column<bool>(type: "boolean", nullable: false),
|
||||
roleid = table.Column<decimal>(type: "numeric(20,0)", nullable: false),
|
||||
userid = table.Column<decimal>(type: "numeric(20,0)", nullable: false),
|
||||
expiresat = table.Column<DateTime>(type: "timestamp without time zone", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("pk_temprole", x => x.id);
|
||||
table.UniqueConstraint("ak_temprole_guildid_userid_roleid", x => new { x.guildid, x.userid, x.roleid });
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "ix_userbetstats_maxwin",
|
||||
table: "userbetstats",
|
||||
column: "maxwin");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "ix_temprole_expiresat",
|
||||
table: "temprole",
|
||||
column: "expiresat");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "notify");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "temprole");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "ix_userbetstats_maxwin",
|
||||
table: "userbetstats");
|
||||
|
||||
migrationBuilder.AddColumn<long>(
|
||||
name: "awardedxp",
|
||||
table: "userxpstats",
|
||||
type: "bigint",
|
||||
nullable: false,
|
||||
defaultValue: 0L);
|
||||
|
||||
migrationBuilder.AddColumn<int>(
|
||||
name: "notifyonlevelup",
|
||||
table: "userxpstats",
|
||||
type: "integer",
|
||||
nullable: false,
|
||||
defaultValue: 0);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "ix_userxpstats_awardedxp",
|
||||
table: "userxpstats",
|
||||
column: "awardedxp");
|
||||
}
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load diff
|
@ -1,27 +0,0 @@
|
|||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace EllieBot.Migrations.PostgreSql
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class awardedxptemprolenotify : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "ix_userbetstats_maxwin",
|
||||
table: "userbetstats",
|
||||
column: "maxwin");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropIndex(
|
||||
name: "ix_userbetstats_maxwin",
|
||||
table: "userbetstats");
|
||||
}
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load diff
3173
src/EllieBot/Migrations/Sqlite/20241207150041_awardedxp-temprole-notify.Designer.cs
generated
Normal file
3173
src/EllieBot/Migrations/Sqlite/20241207150041_awardedxp-temprole-notify.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load diff
|
@ -0,0 +1,107 @@
|
|||
using System;
|
||||
using EllieBot.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace EllieBot.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class awardedxptemprolenotify : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_UserXpStats_AwardedXp",
|
||||
table: "UserXpStats");
|
||||
|
||||
MigrationQueries.MergeAwardedXp(migrationBuilder);
|
||||
migrationBuilder.DropColumn(
|
||||
name: "AwardedXp",
|
||||
table: "UserXpStats");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "NotifyOnLevelUp",
|
||||
table: "UserXpStats");
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Notify",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "INTEGER", nullable: false)
|
||||
.Annotation("Sqlite:Autoincrement", true),
|
||||
GuildId = table.Column<ulong>(type: "INTEGER", nullable: false),
|
||||
ChannelId = table.Column<ulong>(type: "INTEGER", nullable: false),
|
||||
Type = table.Column<int>(type: "INTEGER", nullable: false),
|
||||
Message = table.Column<string>(type: "TEXT", maxLength: 10000, nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Notify", x => x.Id);
|
||||
table.UniqueConstraint("AK_Notify_GuildId_Type", x => new { x.GuildId, x.Type });
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "TempRole",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "INTEGER", nullable: false)
|
||||
.Annotation("Sqlite:Autoincrement", true),
|
||||
GuildId = table.Column<ulong>(type: "INTEGER", nullable: false),
|
||||
Remove = table.Column<bool>(type: "INTEGER", nullable: false),
|
||||
RoleId = table.Column<ulong>(type: "INTEGER", nullable: false),
|
||||
UserId = table.Column<ulong>(type: "INTEGER", nullable: false),
|
||||
ExpiresAt = table.Column<DateTime>(type: "TEXT", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_TempRole", x => x.Id);
|
||||
table.UniqueConstraint("AK_TempRole_GuildId_UserId_RoleId", x => new { x.GuildId, x.UserId, x.RoleId });
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_UserBetStats_MaxWin",
|
||||
table: "UserBetStats",
|
||||
column: "MaxWin");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_TempRole_ExpiresAt",
|
||||
table: "TempRole",
|
||||
column: "ExpiresAt");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "Notify");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "TempRole");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_UserBetStats_MaxWin",
|
||||
table: "UserBetStats");
|
||||
|
||||
migrationBuilder.AddColumn<long>(
|
||||
name: "AwardedXp",
|
||||
table: "UserXpStats",
|
||||
type: "INTEGER",
|
||||
nullable: false,
|
||||
defaultValue: 0L);
|
||||
|
||||
migrationBuilder.AddColumn<int>(
|
||||
name: "NotifyOnLevelUp",
|
||||
table: "UserXpStats",
|
||||
type: "INTEGER",
|
||||
nullable: false,
|
||||
defaultValue: 0);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_UserXpStats_AwardedXp",
|
||||
table: "UserXpStats",
|
||||
column: "AwardedXp");
|
||||
}
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load diff
|
@ -1,27 +0,0 @@
|
|||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace EllieBot.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class awardedxptemprolenotify : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_UserBetStats_MaxWin",
|
||||
table: "UserBetStats",
|
||||
column: "MaxWin");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_UserBetStats_MaxWin",
|
||||
table: "UserBetStats");
|
||||
}
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load diff
|
@ -1097,9 +1097,6 @@ xpexclusionlist:
|
|||
xpexclude:
|
||||
- xpexclude
|
||||
- xpex
|
||||
xpnotify:
|
||||
- xpnotify
|
||||
- xpn
|
||||
xpleveluprewards:
|
||||
- xplvluprewards
|
||||
- xprews
|
||||
|
|
|
@ -3384,14 +3384,28 @@ globalcommand:
|
|||
- '{0}stats'
|
||||
params:
|
||||
- cmd:
|
||||
desc: "The type of command or expression being toggled."
|
||||
desc: "The command or expression being toggled."
|
||||
globalmodule:
|
||||
desc: Toggles whether a module can be used on any server.
|
||||
ex:
|
||||
- 'Gambling'
|
||||
params:
|
||||
- module:
|
||||
desc: "The type of module or configuration information being toggled."
|
||||
desc: "The module being toggled."
|
||||
dmcommand:
|
||||
desc: Toggles whether a command can be used in DMs.
|
||||
ex:
|
||||
- '{0}stats'
|
||||
params:
|
||||
- cmd:
|
||||
desc: "The command or expression being toggled."
|
||||
dmmodule:
|
||||
desc: Toggles whether a module can be used in DMs.
|
||||
ex:
|
||||
- 'Gambling'
|
||||
params:
|
||||
- module:
|
||||
desc: "The module being toggled."
|
||||
globalpermlist:
|
||||
desc: Lists global permissions set by the bot owner.
|
||||
ex:
|
||||
|
@ -3522,17 +3536,6 @@ xpexclude:
|
|||
desc: "The ID of the channel to exclude from XP tracking."
|
||||
channel:
|
||||
desc: "The ID of the channel to exclude from XP tracking."
|
||||
xpnotify:
|
||||
desc: Sets how the bot should notify you when you get a `server` or `global` level. This is a personal setting and affects only how you receive Global or Server level-up notifications. You can set `dm` (for the bot to send you a direct message), `channel` (to get notified in the channel you sent the last message in) or `none` to disable.
|
||||
ex:
|
||||
- global dm
|
||||
- server channel
|
||||
params:
|
||||
- { }
|
||||
- place:
|
||||
desc: "The location where notifications should be sent, such as a specific channel or DM."
|
||||
type:
|
||||
desc: "The location where notifications for server and global level-ups should be sent."
|
||||
xpleveluprewards:
|
||||
desc: Shows currently set level up rewards.
|
||||
ex:
|
||||
|
|
Reference in a new issue