mirror of
https://gitlab.com/Kwoth/nadekobot.git
synced 2025-09-11 09:48:26 -04:00
Hi
This commit is contained in:
48
src/NadekoBot/Migrations/MigrationQueries.cs
Normal file
48
src/NadekoBot/Migrations/MigrationQueries.cs
Normal file
@@ -0,0 +1,48 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
namespace NadekoBot.Migrations;
|
||||
|
||||
public static class MigrationQueries
|
||||
{
|
||||
public static void MigrateRero(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
if (migrationBuilder.IsMySql())
|
||||
{
|
||||
migrationBuilder.Sql(
|
||||
"""
|
||||
INSERT IGNORE into reactionroles(guildid, channelid, messageid, emote, roleid, `group`, levelreq, dateadded)
|
||||
select guildid, channelid, messageid, emotename, roleid, exclusive, 0, reactionrolemessage.dateadded
|
||||
from reactionrole
|
||||
left join reactionrolemessage on reactionrolemessage.id = reactionrole.reactionrolemessageid
|
||||
left join guildconfigs on reactionrolemessage.guildconfigid = guildconfigs.id;
|
||||
""");
|
||||
}
|
||||
else if (migrationBuilder.IsSqlite())
|
||||
{
|
||||
migrationBuilder.Sql(
|
||||
"""
|
||||
insert or ignore into reactionroles(guildid, channelid, messageid, emote, roleid, 'group', levelreq, dateadded)
|
||||
select guildid, channelid, messageid, emotename, roleid, exclusive, 0, reactionrolemessage.dateadded
|
||||
from reactionrole
|
||||
left join reactionrolemessage on reactionrolemessage.id = reactionrole.reactionrolemessageid
|
||||
left join guildconfigs on reactionrolemessage.guildconfigid = guildconfigs.id;
|
||||
""");
|
||||
}
|
||||
else if (migrationBuilder.IsNpgsql())
|
||||
{
|
||||
migrationBuilder.Sql("""
|
||||
insert into reactionroles(guildid, channelid, messageid, emote, roleid, "group", levelreq, dateadded)
|
||||
select guildid, channelid, messageid, emotename, roleid, exclusive::int, 0, reactionrolemessage.dateadded
|
||||
from reactionrole
|
||||
left join reactionrolemessage on reactionrolemessage.id = reactionrole.reactionrolemessageid
|
||||
left join guildconfigs on reactionrolemessage.guildconfigid = guildconfigs.id
|
||||
ON CONFLICT DO NOTHING;
|
||||
""");
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new NotSupportedException("This database provider doesn't have an implementation for MigrateRero");
|
||||
}
|
||||
}
|
||||
}
|
3629
src/NadekoBot/Migrations/Mysql/20221122204432_feed-text.Designer.cs
generated
Normal file
3629
src/NadekoBot/Migrations/Mysql/20221122204432_feed-text.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
2504
src/NadekoBot/Migrations/Mysql/20221122204432_feed-text.cs
Normal file
2504
src/NadekoBot/Migrations/Mysql/20221122204432_feed-text.cs
Normal file
File diff suppressed because it is too large
Load Diff
3626
src/NadekoBot/Migrations/Mysql/MysqlContextModelSnapshot.cs
Normal file
3626
src/NadekoBot/Migrations/Mysql/MysqlContextModelSnapshot.cs
Normal file
File diff suppressed because it is too large
Load Diff
3776
src/NadekoBot/Migrations/Postgresql/20221122204423_feed-text.Designer.cs
generated
Normal file
3776
src/NadekoBot/Migrations/Postgresql/20221122204423_feed-text.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
2349
src/NadekoBot/Migrations/Postgresql/20221122204423_feed-text.cs
Normal file
2349
src/NadekoBot/Migrations/Postgresql/20221122204423_feed-text.cs
Normal file
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
2911
src/NadekoBot/Migrations/Sqlite/20221122204324_feed-text.Designer.cs
generated
Normal file
2911
src/NadekoBot/Migrations/Sqlite/20221122204324_feed-text.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
2349
src/NadekoBot/Migrations/Sqlite/20221122204324_feed-text.cs
Normal file
2349
src/NadekoBot/Migrations/Sqlite/20221122204324_feed-text.cs
Normal file
File diff suppressed because it is too large
Load Diff
2908
src/NadekoBot/Migrations/Sqlite/SqliteContextModelSnapshot.cs
Normal file
2908
src/NadekoBot/Migrations/Sqlite/SqliteContextModelSnapshot.cs
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user