From 338c3590220c06d9c2891b05ca8d90042beab057 Mon Sep 17 00:00:00 2001 From: "Restyled.io" Date: Fri, 21 Oct 2022 18:01:59 +0000 Subject: [PATCH] Restyled by pg_format --- .../20221019063840_init/migration.sql | 1 + .../20221019064232_init/migration.sql | 1 + .../20221019081114_modules/migration.sql | 1 + .../20221019081816_modules/migration.sql | 1 + .../20221019113258_modules/migration.sql | 1 + .../20221019114543_modules/migration.sql | 1 + .../20221019142757_modules/migration.sql | 1 + .../20221019153247_cooldowns/migration.sql | 1 + .../20221019153652_audit_dates/migration.sql | 1 + .../20221019172846_embedconfig/migration.sql | 1 + .../20221020081238_cpgg_api/migration.sql | 1 + .../migration.sql | 1 + .../20221020084922_cooldown_int/migration.sql | 1 + .../migration.sql | 1 + .../20221020113312_shop_module/migration.sql | 1 + .../migration.sql | 1 + .../migration.sql | 1 + .../migration.sql | 1 + .../migration.sql | 4 +- .../migration.sql | 34 ++- .../migration.sql | 30 ++- .../migration.sql | 30 ++- .../migration.sql | 195 ++++++++++++++---- .../migration.sql | 195 ++++++++++++++---- 24 files changed, 407 insertions(+), 99 deletions(-) diff --git a/prisma/migrations/20221019063840_init/migration.sql b/prisma/migrations/20221019063840_init/migration.sql index d7577f0..d69499d 100644 --- a/prisma/migrations/20221019063840_init/migration.sql +++ b/prisma/migrations/20221019063840_init/migration.sql @@ -27,3 +27,4 @@ CREATE UNIQUE INDEX "User_id_key" ON "User" ("id"); -- CreateIndex CREATE UNIQUE INDEX "GuildMember_userId_guildId_key" ON "GuildMember" ("userId", "guildId"); + diff --git a/prisma/migrations/20221019064232_init/migration.sql b/prisma/migrations/20221019064232_init/migration.sql index 2028506..27ed6aa 100644 --- a/prisma/migrations/20221019064232_init/migration.sql +++ b/prisma/migrations/20221019064232_init/migration.sql @@ -24,3 +24,4 @@ CREATE UNIQUE INDEX "GuildMember_userId_guildId_key" ON "GuildMember" ("userId", PRAGMA foreign_key_check; PRAGMA foreign_keys = ON; + diff --git a/prisma/migrations/20221019081114_modules/migration.sql b/prisma/migrations/20221019081114_modules/migration.sql index d20c517..9ebd925 100644 --- a/prisma/migrations/20221019081114_modules/migration.sql +++ b/prisma/migrations/20221019081114_modules/migration.sql @@ -69,3 +69,4 @@ PRAGMA foreign_keys = ON; -- CreateIndex CREATE UNIQUE INDEX "GuildCounter_guildId_channelId_key" ON "GuildCounter" ("guildId", "channelId"); + diff --git a/prisma/migrations/20221019081816_modules/migration.sql b/prisma/migrations/20221019081816_modules/migration.sql index d2fcde5..4cba8c4 100644 --- a/prisma/migrations/20221019081816_modules/migration.sql +++ b/prisma/migrations/20221019081816_modules/migration.sql @@ -33,3 +33,4 @@ CREATE UNIQUE INDEX "GuildCounter_guildId_channelId_key" ON "GuildCounter" ("gui PRAGMA foreign_key_check; PRAGMA foreign_keys = ON; + diff --git a/prisma/migrations/20221019113258_modules/migration.sql b/prisma/migrations/20221019113258_modules/migration.sql index a22b2a3..d88a0fb 100644 --- a/prisma/migrations/20221019113258_modules/migration.sql +++ b/prisma/migrations/20221019113258_modules/migration.sql @@ -41,3 +41,4 @@ CREATE UNIQUE INDEX "Guild_id_key" ON "Guild" ("id"); PRAGMA foreign_key_check; PRAGMA foreign_keys = ON; + diff --git a/prisma/migrations/20221019114543_modules/migration.sql b/prisma/migrations/20221019114543_modules/migration.sql index 0d89d31..d15916d 100644 --- a/prisma/migrations/20221019114543_modules/migration.sql +++ b/prisma/migrations/20221019114543_modules/migration.sql @@ -43,3 +43,4 @@ CREATE UNIQUE INDEX "Guild_id_key" ON "Guild" ("id"); PRAGMA foreign_key_check; PRAGMA foreign_keys = ON; + diff --git a/prisma/migrations/20221019142757_modules/migration.sql b/prisma/migrations/20221019142757_modules/migration.sql index 387fb6e..e4bccc3 100644 --- a/prisma/migrations/20221019142757_modules/migration.sql +++ b/prisma/migrations/20221019142757_modules/migration.sql @@ -28,3 +28,4 @@ CREATE UNIQUE INDEX "GuildMember_userId_guildId_key" ON "GuildMember" ("userId", PRAGMA foreign_key_check; PRAGMA foreign_keys = ON; + diff --git a/prisma/migrations/20221019153247_cooldowns/migration.sql b/prisma/migrations/20221019153247_cooldowns/migration.sql index b85f815..58b4dff 100644 --- a/prisma/migrations/20221019153247_cooldowns/migration.sql +++ b/prisma/migrations/20221019153247_cooldowns/migration.sql @@ -11,3 +11,4 @@ CREATE TABLE "Cooldown" ( -- CreateIndex CREATE UNIQUE INDEX "Cooldown_guildId_userId_timeoutId_key" ON "Cooldown" ("guildId", "userId", "timeoutId"); + diff --git a/prisma/migrations/20221019153652_audit_dates/migration.sql b/prisma/migrations/20221019153652_audit_dates/migration.sql index fd40071..0171217 100644 --- a/prisma/migrations/20221019153652_audit_dates/migration.sql +++ b/prisma/migrations/20221019153652_audit_dates/migration.sql @@ -153,3 +153,4 @@ CREATE UNIQUE INDEX "GuildMember_userId_guildId_key" ON "GuildMember" ("userId", PRAGMA foreign_key_check; PRAGMA foreign_keys = ON; + diff --git a/prisma/migrations/20221019172846_embedconfig/migration.sql b/prisma/migrations/20221019172846_embedconfig/migration.sql index f404f36..aeea219 100644 --- a/prisma/migrations/20221019172846_embedconfig/migration.sql +++ b/prisma/migrations/20221019172846_embedconfig/migration.sql @@ -53,3 +53,4 @@ CREATE UNIQUE INDEX "Guild_id_key" ON "Guild" ("id"); PRAGMA foreign_key_check; PRAGMA foreign_keys = ON; + diff --git a/prisma/migrations/20221020081238_cpgg_api/migration.sql b/prisma/migrations/20221020081238_cpgg_api/migration.sql index 6b056d0..c69d565 100644 --- a/prisma/migrations/20221020081238_cpgg_api/migration.sql +++ b/prisma/migrations/20221020081238_cpgg_api/migration.sql @@ -10,3 +10,4 @@ ALTER TABLE "Guild" ALTER TABLE "Guild" ADD COLUMN "apiCpggUrlIv" TEXT; + diff --git a/prisma/migrations/20221020084750_cooldown_string/migration.sql b/prisma/migrations/20221020084750_cooldown_string/migration.sql index a9521a5..20f0bf5 100644 --- a/prisma/migrations/20221020084750_cooldown_string/migration.sql +++ b/prisma/migrations/20221020084750_cooldown_string/migration.sql @@ -32,3 +32,4 @@ CREATE UNIQUE INDEX "Cooldown_guildId_userId_timeoutId_key" ON "Cooldown" ("guil PRAGMA foreign_key_check; PRAGMA foreign_keys = ON; + diff --git a/prisma/migrations/20221020084922_cooldown_int/migration.sql b/prisma/migrations/20221020084922_cooldown_int/migration.sql index 822d410..282e7d1 100644 --- a/prisma/migrations/20221020084922_cooldown_int/migration.sql +++ b/prisma/migrations/20221020084922_cooldown_int/migration.sql @@ -38,3 +38,4 @@ CREATE UNIQUE INDEX "Cooldown_guildId_userId_timeoutId_key" ON "Cooldown" ("guil PRAGMA foreign_key_check; PRAGMA foreign_keys = ON; + diff --git a/prisma/migrations/20221020111948_audits_module/migration.sql b/prisma/migrations/20221020111948_audits_module/migration.sql index c44d8b6..b1b6293 100644 --- a/prisma/migrations/20221020111948_audits_module/migration.sql +++ b/prisma/migrations/20221020111948_audits_module/migration.sql @@ -68,3 +68,4 @@ CREATE UNIQUE INDEX "Guild_id_key" ON "Guild" ("id"); PRAGMA foreign_key_check; PRAGMA foreign_keys = ON; + diff --git a/prisma/migrations/20221020113312_shop_module/migration.sql b/prisma/migrations/20221020113312_shop_module/migration.sql index 8cdbd73..14cd966 100644 --- a/prisma/migrations/20221020113312_shop_module/migration.sql +++ b/prisma/migrations/20221020113312_shop_module/migration.sql @@ -72,3 +72,4 @@ CREATE UNIQUE INDEX "Guild_id_key" ON "Guild" ("id"); PRAGMA foreign_key_check; PRAGMA foreign_keys = ON; + diff --git a/prisma/migrations/20221020113704_welcome_module/migration.sql b/prisma/migrations/20221020113704_welcome_module/migration.sql index 7d5c6c5..0c55776 100644 --- a/prisma/migrations/20221020113704_welcome_module/migration.sql +++ b/prisma/migrations/20221020113704_welcome_module/migration.sql @@ -77,3 +77,4 @@ CREATE UNIQUE INDEX "Guild_id_key" ON "Guild" ("id"); PRAGMA foreign_key_check; PRAGMA foreign_keys = ON; + diff --git a/prisma/migrations/20221020113756_welcome_module_correction/migration.sql b/prisma/migrations/20221020113756_welcome_module_correction/migration.sql index 1035421..d2e95ac 100644 --- a/prisma/migrations/20221020113756_welcome_module_correction/migration.sql +++ b/prisma/migrations/20221020113756_welcome_module_correction/migration.sql @@ -87,3 +87,4 @@ CREATE UNIQUE INDEX "Guild_id_key" ON "Guild" ("id"); PRAGMA foreign_key_check; PRAGMA foreign_keys = ON; + diff --git a/prisma/migrations/20221020113831_welcome_module_correction/migration.sql b/prisma/migrations/20221020113831_welcome_module_correction/migration.sql index 0c05518..191112f 100644 --- a/prisma/migrations/20221020113831_welcome_module_correction/migration.sql +++ b/prisma/migrations/20221020113831_welcome_module_correction/migration.sql @@ -89,3 +89,4 @@ CREATE UNIQUE INDEX "Guild_id_key" ON "Guild" ("id"); PRAGMA foreign_key_check; PRAGMA foreign_keys = ON; + diff --git a/prisma/migrations/20221021150615_shoproles_model/migration.sql b/prisma/migrations/20221021150615_shoproles_model/migration.sql index 1859cc1..545a454 100644 --- a/prisma/migrations/20221021150615_shoproles_model/migration.sql +++ b/prisma/migrations/20221021150615_shoproles_model/migration.sql @@ -13,4 +13,6 @@ CREATE TABLE "GuildShopRoles" ( ); -- CreateIndex -CREATE UNIQUE INDEX "GuildShopRoles_guildId_channelId_key" ON "GuildShopRoles"("guildId", "channelId"); + +CREATE UNIQUE INDEX "GuildShopRoles_guildId_channelId_key" ON "GuildShopRoles" ("guildId", "channelId"); + diff --git a/prisma/migrations/20221021151136_shoproles_model_correction/migration.sql b/prisma/migrations/20221021151136_shoproles_model_correction/migration.sql index 5631656..970dead 100644 --- a/prisma/migrations/20221021151136_shoproles_model_correction/migration.sql +++ b/prisma/migrations/20221021151136_shoproles_model_correction/migration.sql @@ -1,11 +1,12 @@ /* - Warnings: + Warnings: - - You are about to drop the column `channelId` on the `GuildShopRoles` table. All the data in the column will be lost. - -*/ + - You are about to drop the column `channelId` on the `GuildShopRoles` table. All the data in the column will be lost. + */ -- RedefineTables -PRAGMA foreign_keys=OFF; + +PRAGMA foreign_keys = OFF; + CREATE TABLE "new_GuildShopRoles" ( "guildId" TEXT NOT NULL, "roleId" TEXT NOT NULL, @@ -17,9 +18,26 @@ CREATE TABLE "new_GuildShopRoles" ( CONSTRAINT "GuildShopRoles_guildId_fkey" FOREIGN KEY ("guildId") REFERENCES "Guild" ("id") ON DELETE RESTRICT ON UPDATE CASCADE, CONSTRAINT "GuildShopRoles_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User" ("id") ON DELETE RESTRICT ON UPDATE CASCADE ); -INSERT INTO "new_GuildShopRoles" ("createdAt", "guildId", "lastPayed", "pricePerHour", "roleId", "updatedAt", "userId") SELECT "createdAt", "guildId", "lastPayed", "pricePerHour", "roleId", "updatedAt", "userId" FROM "GuildShopRoles"; + +INSERT INTO "new_GuildShopRoles" ("createdAt", "guildId", "lastPayed", "pricePerHour", "roleId", "updatedAt", "userId") +SELECT + "createdAt", + "guildId", + "lastPayed", + "pricePerHour", + "roleId", + "updatedAt", + "userId" +FROM + "GuildShopRoles"; + DROP TABLE "GuildShopRoles"; + ALTER TABLE "new_GuildShopRoles" RENAME TO "GuildShopRoles"; -CREATE UNIQUE INDEX "GuildShopRoles_guildId_userId_roleId_key" ON "GuildShopRoles"("guildId", "userId", "roleId"); + +CREATE UNIQUE INDEX "GuildShopRoles_guildId_userId_roleId_key" ON "GuildShopRoles" ("guildId", "userId", "roleId"); + PRAGMA foreign_key_check; -PRAGMA foreign_keys=ON; + +PRAGMA foreign_keys = ON; + diff --git a/prisma/migrations/20221021151337_shoproles_model_correction/migration.sql b/prisma/migrations/20221021151337_shoproles_model_correction/migration.sql index 8a3fe75..35824ff 100644 --- a/prisma/migrations/20221021151337_shoproles_model_correction/migration.sql +++ b/prisma/migrations/20221021151337_shoproles_model_correction/migration.sql @@ -1,5 +1,6 @@ -- RedefineTables -PRAGMA foreign_keys=OFF; +PRAGMA foreign_keys = OFF; + CREATE TABLE "new_GuildShopRoles" ( "guildId" TEXT NOT NULL, "roleId" TEXT NOT NULL, @@ -10,11 +11,30 @@ CREATE TABLE "new_GuildShopRoles" ( "updatedAt" DATETIME NOT NULL, CONSTRAINT "GuildShopRoles_guildId_fkey" FOREIGN KEY ("guildId") REFERENCES "Guild" ("id") ON DELETE RESTRICT ON UPDATE CASCADE, CONSTRAINT "GuildShopRoles_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User" ("id") ON DELETE RESTRICT ON UPDATE CASCADE, - CONSTRAINT "GuildShopRoles_guildId_userId_fkey" FOREIGN KEY ("guildId", "userId") REFERENCES "GuildMember" ("guildId", "userId") ON DELETE RESTRICT ON UPDATE CASCADE + CONSTRAINT "GuildShopRoles_guildId_userId_fkey" FOREIGN KEY ("guildId", + "userId") REFERENCES "GuildMember" ("guildId", + "userId") ON DELETE RESTRICT ON UPDATE CASCADE ); -INSERT INTO "new_GuildShopRoles" ("createdAt", "guildId", "lastPayed", "pricePerHour", "roleId", "updatedAt", "userId") SELECT "createdAt", "guildId", "lastPayed", "pricePerHour", "roleId", "updatedAt", "userId" FROM "GuildShopRoles"; + +INSERT INTO "new_GuildShopRoles" ("createdAt", "guildId", "lastPayed", "pricePerHour", "roleId", "updatedAt", "userId") +SELECT + "createdAt", + "guildId", + "lastPayed", + "pricePerHour", + "roleId", + "updatedAt", + "userId" +FROM + "GuildShopRoles"; + DROP TABLE "GuildShopRoles"; + ALTER TABLE "new_GuildShopRoles" RENAME TO "GuildShopRoles"; -CREATE UNIQUE INDEX "GuildShopRoles_guildId_userId_roleId_key" ON "GuildShopRoles"("guildId", "userId", "roleId"); + +CREATE UNIQUE INDEX "GuildShopRoles_guildId_userId_roleId_key" ON "GuildShopRoles" ("guildId", "userId", "roleId"); + PRAGMA foreign_key_check; -PRAGMA foreign_keys=ON; + +PRAGMA foreign_keys = ON; + diff --git a/prisma/migrations/20221021153546_shoproles_model_correction/migration.sql b/prisma/migrations/20221021153546_shoproles_model_correction/migration.sql index 88d1d66..f7d31ff 100644 --- a/prisma/migrations/20221021153546_shoproles_model_correction/migration.sql +++ b/prisma/migrations/20221021153546_shoproles_model_correction/migration.sql @@ -1,5 +1,6 @@ -- RedefineTables -PRAGMA foreign_keys=OFF; +PRAGMA foreign_keys = OFF; + CREATE TABLE "new_GuildShopRoles" ( "guildId" TEXT NOT NULL, "roleId" TEXT NOT NULL, @@ -10,11 +11,30 @@ CREATE TABLE "new_GuildShopRoles" ( "updatedAt" DATETIME NOT NULL, CONSTRAINT "GuildShopRoles_guildId_fkey" FOREIGN KEY ("guildId") REFERENCES "Guild" ("id") ON DELETE RESTRICT ON UPDATE CASCADE, CONSTRAINT "GuildShopRoles_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User" ("id") ON DELETE RESTRICT ON UPDATE CASCADE, - CONSTRAINT "GuildShopRoles_userId_guildId_fkey" FOREIGN KEY ("userId", "guildId") REFERENCES "GuildMember" ("userId", "guildId") ON DELETE RESTRICT ON UPDATE CASCADE + CONSTRAINT "GuildShopRoles_userId_guildId_fkey" FOREIGN KEY ("userId", + "guildId") REFERENCES "GuildMember" ("userId", + "guildId") ON DELETE RESTRICT ON UPDATE CASCADE ); -INSERT INTO "new_GuildShopRoles" ("createdAt", "guildId", "lastPayed", "pricePerHour", "roleId", "updatedAt", "userId") SELECT "createdAt", "guildId", "lastPayed", "pricePerHour", "roleId", "updatedAt", "userId" FROM "GuildShopRoles"; + +INSERT INTO "new_GuildShopRoles" ("createdAt", "guildId", "lastPayed", "pricePerHour", "roleId", "updatedAt", "userId") +SELECT + "createdAt", + "guildId", + "lastPayed", + "pricePerHour", + "roleId", + "updatedAt", + "userId" +FROM + "GuildShopRoles"; + DROP TABLE "GuildShopRoles"; + ALTER TABLE "new_GuildShopRoles" RENAME TO "GuildShopRoles"; -CREATE UNIQUE INDEX "GuildShopRoles_guildId_userId_roleId_key" ON "GuildShopRoles"("guildId", "userId", "roleId"); + +CREATE UNIQUE INDEX "GuildShopRoles_guildId_userId_roleId_key" ON "GuildShopRoles" ("guildId", "userId", "roleId"); + PRAGMA foreign_key_check; -PRAGMA foreign_keys=ON; + +PRAGMA foreign_keys = ON; + diff --git a/prisma/migrations/20221021172156_int_to_bigint/migration.sql b/prisma/migrations/20221021172156_int_to_bigint/migration.sql index 187923d..aee4d93 100644 --- a/prisma/migrations/20221021172156_int_to_bigint/migration.sql +++ b/prisma/migrations/20221021172156_int_to_bigint/migration.sql @@ -1,25 +1,26 @@ /* - Warnings: + Warnings: - - You are about to alter the column `count` on the `GuildCounter` table. The data in that column could be lost. The data in that column will be cast from `Int` to `BigInt`. - - You are about to alter the column `creditsEarned` on the `GuildMember` table. The data in that column could be lost. The data in that column will be cast from `Int` to `BigInt`. - - You are about to alter the column `pointsEarned` on the `GuildMember` table. The data in that column could be lost. The data in that column will be cast from `Int` to `BigInt`. - - You are about to alter the column `pricePerHour` on the `GuildShopRoles` table. The data in that column could be lost. The data in that column will be cast from `Int` to `BigInt`. - - You are about to alter the column `cooldown` on the `Cooldown` table. The data in that column could be lost. The data in that column will be cast from `Int` to `BigInt`. - - You are about to alter the column `creditsMinimumLength` on the `Guild` table. The data in that column could be lost. The data in that column will be cast from `Int` to `BigInt`. - - You are about to alter the column `creditsRate` on the `Guild` table. The data in that column could be lost. The data in that column will be cast from `Int` to `BigInt`. - - You are about to alter the column `creditsTimeout` on the `Guild` table. The data in that column could be lost. The data in that column will be cast from `Int` to `BigInt`. - - You are about to alter the column `creditsWorkRate` on the `Guild` table. The data in that column could be lost. The data in that column will be cast from `Int` to `BigInt`. - - You are about to alter the column `creditsWorkTimeout` on the `Guild` table. The data in that column could be lost. The data in that column will be cast from `Int` to `BigInt`. - - You are about to alter the column `pointsMinimumLength` on the `Guild` table. The data in that column could be lost. The data in that column will be cast from `Int` to `BigInt`. - - You are about to alter the column `pointsRate` on the `Guild` table. The data in that column could be lost. The data in that column will be cast from `Int` to `BigInt`. - - You are about to alter the column `pointsTimeout` on the `Guild` table. The data in that column could be lost. The data in that column will be cast from `Int` to `BigInt`. - - You are about to alter the column `shopRolesPricePerHour` on the `Guild` table. The data in that column could be lost. The data in that column will be cast from `Int` to `BigInt`. - - You are about to alter the column `reputationsEarned` on the `User` table. The data in that column could be lost. The data in that column will be cast from `Int` to `BigInt`. - -*/ + - You are about to alter the column `count` on the `GuildCounter` table. The data in that column could be lost. The data in that column will be cast from `Int` to `BigInt`. + - You are about to alter the column `creditsEarned` on the `GuildMember` table. The data in that column could be lost. The data in that column will be cast from `Int` to `BigInt`. + - You are about to alter the column `pointsEarned` on the `GuildMember` table. The data in that column could be lost. The data in that column will be cast from `Int` to `BigInt`. + - You are about to alter the column `pricePerHour` on the `GuildShopRoles` table. The data in that column could be lost. The data in that column will be cast from `Int` to `BigInt`. + - You are about to alter the column `cooldown` on the `Cooldown` table. The data in that column could be lost. The data in that column will be cast from `Int` to `BigInt`. + - You are about to alter the column `creditsMinimumLength` on the `Guild` table. The data in that column could be lost. The data in that column will be cast from `Int` to `BigInt`. + - You are about to alter the column `creditsRate` on the `Guild` table. The data in that column could be lost. The data in that column will be cast from `Int` to `BigInt`. + - You are about to alter the column `creditsTimeout` on the `Guild` table. The data in that column could be lost. The data in that column will be cast from `Int` to `BigInt`. + - You are about to alter the column `creditsWorkRate` on the `Guild` table. The data in that column could be lost. The data in that column will be cast from `Int` to `BigInt`. + - You are about to alter the column `creditsWorkTimeout` on the `Guild` table. The data in that column could be lost. The data in that column will be cast from `Int` to `BigInt`. + - You are about to alter the column `pointsMinimumLength` on the `Guild` table. The data in that column could be lost. The data in that column will be cast from `Int` to `BigInt`. + - You are about to alter the column `pointsRate` on the `Guild` table. The data in that column could be lost. The data in that column will be cast from `Int` to `BigInt`. + - You are about to alter the column `pointsTimeout` on the `Guild` table. The data in that column could be lost. The data in that column will be cast from `Int` to `BigInt`. + - You are about to alter the column `shopRolesPricePerHour` on the `Guild` table. The data in that column could be lost. The data in that column will be cast from `Int` to `BigInt`. + - You are about to alter the column `reputationsEarned` on the `User` table. The data in that column could be lost. The data in that column will be cast from `Int` to `BigInt`. + */ -- RedefineTables -PRAGMA foreign_keys=OFF; + +PRAGMA foreign_keys = OFF; + CREATE TABLE "new_GuildCounter" ( "guildId" TEXT NOT NULL, "channelId" TEXT NOT NULL, @@ -29,10 +30,24 @@ CREATE TABLE "new_GuildCounter" ( "updatedAt" DATETIME NOT NULL, CONSTRAINT "GuildCounter_guildId_fkey" FOREIGN KEY ("guildId") REFERENCES "Guild" ("id") ON DELETE RESTRICT ON UPDATE CASCADE ); -INSERT INTO "new_GuildCounter" ("channelId", "count", "createdAt", "guildId", "triggerWord", "updatedAt") SELECT "channelId", "count", "createdAt", "guildId", "triggerWord", "updatedAt" FROM "GuildCounter"; + +INSERT INTO "new_GuildCounter" ("channelId", "count", "createdAt", "guildId", "triggerWord", "updatedAt") +SELECT + "channelId", + "count", + "createdAt", + "guildId", + "triggerWord", + "updatedAt" +FROM + "GuildCounter"; + DROP TABLE "GuildCounter"; + ALTER TABLE "new_GuildCounter" RENAME TO "GuildCounter"; -CREATE UNIQUE INDEX "GuildCounter_guildId_channelId_key" ON "GuildCounter"("guildId", "channelId"); + +CREATE UNIQUE INDEX "GuildCounter_guildId_channelId_key" ON "GuildCounter" ("guildId", "channelId"); + CREATE TABLE "new_GuildMember" ( "userId" TEXT NOT NULL, "guildId" TEXT NOT NULL, @@ -43,10 +58,24 @@ CREATE TABLE "new_GuildMember" ( CONSTRAINT "GuildMember_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User" ("id") ON DELETE RESTRICT ON UPDATE CASCADE, CONSTRAINT "GuildMember_guildId_fkey" FOREIGN KEY ("guildId") REFERENCES "Guild" ("id") ON DELETE RESTRICT ON UPDATE CASCADE ); -INSERT INTO "new_GuildMember" ("createdAt", "creditsEarned", "guildId", "pointsEarned", "updatedAt", "userId") SELECT "createdAt", "creditsEarned", "guildId", "pointsEarned", "updatedAt", "userId" FROM "GuildMember"; + +INSERT INTO "new_GuildMember" ("createdAt", "creditsEarned", "guildId", "pointsEarned", "updatedAt", "userId") +SELECT + "createdAt", + "creditsEarned", + "guildId", + "pointsEarned", + "updatedAt", + "userId" +FROM + "GuildMember"; + DROP TABLE "GuildMember"; + ALTER TABLE "new_GuildMember" RENAME TO "GuildMember"; -CREATE UNIQUE INDEX "GuildMember_userId_guildId_key" ON "GuildMember"("userId", "guildId"); + +CREATE UNIQUE INDEX "GuildMember_userId_guildId_key" ON "GuildMember" ("userId", "guildId"); + CREATE TABLE "new_GuildShopRoles" ( "guildId" TEXT NOT NULL, "roleId" TEXT NOT NULL, @@ -57,12 +86,29 @@ CREATE TABLE "new_GuildShopRoles" ( "updatedAt" DATETIME NOT NULL, CONSTRAINT "GuildShopRoles_guildId_fkey" FOREIGN KEY ("guildId") REFERENCES "Guild" ("id") ON DELETE RESTRICT ON UPDATE CASCADE, CONSTRAINT "GuildShopRoles_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User" ("id") ON DELETE RESTRICT ON UPDATE CASCADE, - CONSTRAINT "GuildShopRoles_userId_guildId_fkey" FOREIGN KEY ("userId", "guildId") REFERENCES "GuildMember" ("userId", "guildId") ON DELETE RESTRICT ON UPDATE CASCADE + CONSTRAINT "GuildShopRoles_userId_guildId_fkey" FOREIGN KEY ("userId", + "guildId") REFERENCES "GuildMember" ("userId", + "guildId") ON DELETE RESTRICT ON UPDATE CASCADE ); -INSERT INTO "new_GuildShopRoles" ("createdAt", "guildId", "lastPayed", "pricePerHour", "roleId", "updatedAt", "userId") SELECT "createdAt", "guildId", "lastPayed", "pricePerHour", "roleId", "updatedAt", "userId" FROM "GuildShopRoles"; + +INSERT INTO "new_GuildShopRoles" ("createdAt", "guildId", "lastPayed", "pricePerHour", "roleId", "updatedAt", "userId") +SELECT + "createdAt", + "guildId", + "lastPayed", + "pricePerHour", + "roleId", + "updatedAt", + "userId" +FROM + "GuildShopRoles"; + DROP TABLE "GuildShopRoles"; + ALTER TABLE "new_GuildShopRoles" RENAME TO "GuildShopRoles"; -CREATE UNIQUE INDEX "GuildShopRoles_guildId_userId_roleId_key" ON "GuildShopRoles"("guildId", "userId", "roleId"); + +CREATE UNIQUE INDEX "GuildShopRoles_guildId_userId_roleId_key" ON "GuildShopRoles" ("guildId", "userId", "roleId"); + CREATE TABLE "new_Cooldown" ( "guildId" TEXT NOT NULL, "userId" TEXT NOT NULL, @@ -73,10 +119,24 @@ CREATE TABLE "new_Cooldown" ( CONSTRAINT "Cooldown_guildId_fkey" FOREIGN KEY ("guildId") REFERENCES "Guild" ("id") ON DELETE RESTRICT ON UPDATE CASCADE, CONSTRAINT "Cooldown_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User" ("id") ON DELETE RESTRICT ON UPDATE CASCADE ); -INSERT INTO "new_Cooldown" ("cooldown", "createdAt", "guildId", "timeoutId", "updatedAt", "userId") SELECT "cooldown", "createdAt", "guildId", "timeoutId", "updatedAt", "userId" FROM "Cooldown"; + +INSERT INTO "new_Cooldown" ("cooldown", "createdAt", "guildId", "timeoutId", "updatedAt", "userId") +SELECT + "cooldown", + "createdAt", + "guildId", + "timeoutId", + "updatedAt", + "userId" +FROM + "Cooldown"; + DROP TABLE "Cooldown"; + ALTER TABLE "new_Cooldown" RENAME TO "Cooldown"; -CREATE UNIQUE INDEX "Cooldown_guildId_userId_timeoutId_key" ON "Cooldown"("guildId", "userId", "timeoutId"); + +CREATE UNIQUE INDEX "Cooldown_guildId_userId_timeoutId_key" ON "Cooldown" ("guildId", "userId", "timeoutId"); + CREATE TABLE "new_Guild" ( "id" TEXT NOT NULL, "embedColorSuccess" TEXT NOT NULL DEFAULT '#22bb33', @@ -84,27 +144,27 @@ CREATE TABLE "new_Guild" ( "embedColorError" TEXT NOT NULL DEFAULT '#bb2124', "embedFooterText" TEXT NOT NULL DEFAULT 'https://github.com/ZynerOrg/xyter', "embedFooterIcon" TEXT NOT NULL DEFAULT 'https://github.com/ZynerOrg.png', - "creditsEnabled" BOOLEAN NOT NULL DEFAULT false, + "creditsEnabled" BOOLEAN NOT NULL DEFAULT FALSE, "creditsRate" BIGINT NOT NULL DEFAULT 1, "creditsTimeout" BIGINT NOT NULL DEFAULT 5, "creditsWorkRate" BIGINT NOT NULL DEFAULT 25, "creditsWorkTimeout" BIGINT NOT NULL DEFAULT 86400, "creditsMinimumLength" BIGINT NOT NULL DEFAULT 5, - "pointsEnabled" BOOLEAN NOT NULL DEFAULT false, + "pointsEnabled" BOOLEAN NOT NULL DEFAULT FALSE, "pointsRate" BIGINT NOT NULL DEFAULT 1, "pointsTimeout" BIGINT NOT NULL DEFAULT 5, "pointsMinimumLength" BIGINT NOT NULL DEFAULT 5, - "reputationsEnabled" BOOLEAN NOT NULL DEFAULT false, - "countersEnabled" BOOLEAN NOT NULL DEFAULT false, + "reputationsEnabled" BOOLEAN NOT NULL DEFAULT FALSE, + "countersEnabled" BOOLEAN NOT NULL DEFAULT FALSE, "apiCpggUrlIv" TEXT, "apiCpggUrlContent" TEXT, "apiCpggTokenIv" TEXT, "apiCpggTokenContent" TEXT, - "auditsEnabled" BOOLEAN NOT NULL DEFAULT false, + "auditsEnabled" BOOLEAN NOT NULL DEFAULT FALSE, "auditsChannelId" TEXT, - "shopRolesEnabled" BOOLEAN NOT NULL DEFAULT false, + "shopRolesEnabled" BOOLEAN NOT NULL DEFAULT FALSE, "shopRolesPricePerHour" BIGINT NOT NULL DEFAULT 5, - "welcomeEnabled" BOOLEAN NOT NULL DEFAULT false, + "welcomeEnabled" BOOLEAN NOT NULL DEFAULT FALSE, "welcomeJoinChannelId" TEXT, "welcomeJoinChannelMessage" TEXT, "welcomeLeaveChannelId" TEXT, @@ -112,19 +172,74 @@ CREATE TABLE "new_Guild" ( "createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, "updatedAt" DATETIME NOT NULL ); -INSERT INTO "new_Guild" ("apiCpggTokenContent", "apiCpggTokenIv", "apiCpggUrlContent", "apiCpggUrlIv", "auditsChannelId", "auditsEnabled", "countersEnabled", "createdAt", "creditsEnabled", "creditsMinimumLength", "creditsRate", "creditsTimeout", "creditsWorkRate", "creditsWorkTimeout", "embedColorError", "embedColorSuccess", "embedColorWait", "embedFooterIcon", "embedFooterText", "id", "pointsEnabled", "pointsMinimumLength", "pointsRate", "pointsTimeout", "reputationsEnabled", "shopRolesEnabled", "shopRolesPricePerHour", "updatedAt", "welcomeEnabled", "welcomeJoinChannelId", "welcomeJoinChannelMessage", "welcomeLeaveChannelId", "welcomeLeaveChannelMessage") SELECT "apiCpggTokenContent", "apiCpggTokenIv", "apiCpggUrlContent", "apiCpggUrlIv", "auditsChannelId", "auditsEnabled", "countersEnabled", "createdAt", "creditsEnabled", "creditsMinimumLength", "creditsRate", "creditsTimeout", "creditsWorkRate", "creditsWorkTimeout", "embedColorError", "embedColorSuccess", "embedColorWait", "embedFooterIcon", "embedFooterText", "id", "pointsEnabled", "pointsMinimumLength", "pointsRate", "pointsTimeout", "reputationsEnabled", "shopRolesEnabled", "shopRolesPricePerHour", "updatedAt", "welcomeEnabled", "welcomeJoinChannelId", "welcomeJoinChannelMessage", "welcomeLeaveChannelId", "welcomeLeaveChannelMessage" FROM "Guild"; + +INSERT INTO "new_Guild" ("apiCpggTokenContent", "apiCpggTokenIv", "apiCpggUrlContent", "apiCpggUrlIv", "auditsChannelId", "auditsEnabled", "countersEnabled", "createdAt", "creditsEnabled", "creditsMinimumLength", "creditsRate", "creditsTimeout", "creditsWorkRate", "creditsWorkTimeout", "embedColorError", "embedColorSuccess", "embedColorWait", "embedFooterIcon", "embedFooterText", "id", "pointsEnabled", "pointsMinimumLength", "pointsRate", "pointsTimeout", "reputationsEnabled", "shopRolesEnabled", "shopRolesPricePerHour", "updatedAt", "welcomeEnabled", "welcomeJoinChannelId", "welcomeJoinChannelMessage", "welcomeLeaveChannelId", "welcomeLeaveChannelMessage") +SELECT + "apiCpggTokenContent", + "apiCpggTokenIv", + "apiCpggUrlContent", + "apiCpggUrlIv", + "auditsChannelId", + "auditsEnabled", + "countersEnabled", + "createdAt", + "creditsEnabled", + "creditsMinimumLength", + "creditsRate", + "creditsTimeout", + "creditsWorkRate", + "creditsWorkTimeout", + "embedColorError", + "embedColorSuccess", + "embedColorWait", + "embedFooterIcon", + "embedFooterText", + "id", + "pointsEnabled", + "pointsMinimumLength", + "pointsRate", + "pointsTimeout", + "reputationsEnabled", + "shopRolesEnabled", + "shopRolesPricePerHour", + "updatedAt", + "welcomeEnabled", + "welcomeJoinChannelId", + "welcomeJoinChannelMessage", + "welcomeLeaveChannelId", + "welcomeLeaveChannelMessage" +FROM + "Guild"; + DROP TABLE "Guild"; + ALTER TABLE "new_Guild" RENAME TO "Guild"; -CREATE UNIQUE INDEX "Guild_id_key" ON "Guild"("id"); + +CREATE UNIQUE INDEX "Guild_id_key" ON "Guild" ("id"); + CREATE TABLE "new_User" ( "id" TEXT NOT NULL, "reputationsEarned" BIGINT NOT NULL DEFAULT 0, "createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, "updatedAt" DATETIME NOT NULL ); -INSERT INTO "new_User" ("createdAt", "id", "reputationsEarned", "updatedAt") SELECT "createdAt", "id", "reputationsEarned", "updatedAt" FROM "User"; + +INSERT INTO "new_User" ("createdAt", "id", "reputationsEarned", "updatedAt") +SELECT + "createdAt", + "id", + "reputationsEarned", + "updatedAt" +FROM + "User"; + DROP TABLE "User"; + ALTER TABLE "new_User" RENAME TO "User"; -CREATE UNIQUE INDEX "User_id_key" ON "User"("id"); + +CREATE UNIQUE INDEX "User_id_key" ON "User" ("id"); + PRAGMA foreign_key_check; -PRAGMA foreign_keys=ON; + +PRAGMA foreign_keys = ON; + diff --git a/prisma/migrations/20221021172345_bigint_to_int/migration.sql b/prisma/migrations/20221021172345_bigint_to_int/migration.sql index 978ac5c..8779a17 100644 --- a/prisma/migrations/20221021172345_bigint_to_int/migration.sql +++ b/prisma/migrations/20221021172345_bigint_to_int/migration.sql @@ -1,35 +1,48 @@ /* - Warnings: + Warnings: - - You are about to alter the column `reputationsEarned` on the `User` table. The data in that column could be lost. The data in that column will be cast from `BigInt` to `Int`. - - You are about to alter the column `count` on the `GuildCounter` table. The data in that column could be lost. The data in that column will be cast from `BigInt` to `Int`. - - You are about to alter the column `creditsEarned` on the `GuildMember` table. The data in that column could be lost. The data in that column will be cast from `BigInt` to `Int`. - - You are about to alter the column `pointsEarned` on the `GuildMember` table. The data in that column could be lost. The data in that column will be cast from `BigInt` to `Int`. - - You are about to alter the column `pricePerHour` on the `GuildShopRoles` table. The data in that column could be lost. The data in that column will be cast from `BigInt` to `Int`. - - You are about to alter the column `creditsMinimumLength` on the `Guild` table. The data in that column could be lost. The data in that column will be cast from `BigInt` to `Int`. - - You are about to alter the column `creditsRate` on the `Guild` table. The data in that column could be lost. The data in that column will be cast from `BigInt` to `Int`. - - You are about to alter the column `creditsTimeout` on the `Guild` table. The data in that column could be lost. The data in that column will be cast from `BigInt` to `Int`. - - You are about to alter the column `creditsWorkRate` on the `Guild` table. The data in that column could be lost. The data in that column will be cast from `BigInt` to `Int`. - - You are about to alter the column `creditsWorkTimeout` on the `Guild` table. The data in that column could be lost. The data in that column will be cast from `BigInt` to `Int`. - - You are about to alter the column `pointsMinimumLength` on the `Guild` table. The data in that column could be lost. The data in that column will be cast from `BigInt` to `Int`. - - You are about to alter the column `pointsRate` on the `Guild` table. The data in that column could be lost. The data in that column will be cast from `BigInt` to `Int`. - - You are about to alter the column `pointsTimeout` on the `Guild` table. The data in that column could be lost. The data in that column will be cast from `BigInt` to `Int`. - - You are about to alter the column `shopRolesPricePerHour` on the `Guild` table. The data in that column could be lost. The data in that column will be cast from `BigInt` to `Int`. - - You are about to alter the column `cooldown` on the `Cooldown` table. The data in that column could be lost. The data in that column will be cast from `BigInt` to `Int`. - -*/ + - You are about to alter the column `reputationsEarned` on the `User` table. The data in that column could be lost. The data in that column will be cast from `BigInt` to `Int`. + - You are about to alter the column `count` on the `GuildCounter` table. The data in that column could be lost. The data in that column will be cast from `BigInt` to `Int`. + - You are about to alter the column `creditsEarned` on the `GuildMember` table. The data in that column could be lost. The data in that column will be cast from `BigInt` to `Int`. + - You are about to alter the column `pointsEarned` on the `GuildMember` table. The data in that column could be lost. The data in that column will be cast from `BigInt` to `Int`. + - You are about to alter the column `pricePerHour` on the `GuildShopRoles` table. The data in that column could be lost. The data in that column will be cast from `BigInt` to `Int`. + - You are about to alter the column `creditsMinimumLength` on the `Guild` table. The data in that column could be lost. The data in that column will be cast from `BigInt` to `Int`. + - You are about to alter the column `creditsRate` on the `Guild` table. The data in that column could be lost. The data in that column will be cast from `BigInt` to `Int`. + - You are about to alter the column `creditsTimeout` on the `Guild` table. The data in that column could be lost. The data in that column will be cast from `BigInt` to `Int`. + - You are about to alter the column `creditsWorkRate` on the `Guild` table. The data in that column could be lost. The data in that column will be cast from `BigInt` to `Int`. + - You are about to alter the column `creditsWorkTimeout` on the `Guild` table. The data in that column could be lost. The data in that column will be cast from `BigInt` to `Int`. + - You are about to alter the column `pointsMinimumLength` on the `Guild` table. The data in that column could be lost. The data in that column will be cast from `BigInt` to `Int`. + - You are about to alter the column `pointsRate` on the `Guild` table. The data in that column could be lost. The data in that column will be cast from `BigInt` to `Int`. + - You are about to alter the column `pointsTimeout` on the `Guild` table. The data in that column could be lost. The data in that column will be cast from `BigInt` to `Int`. + - You are about to alter the column `shopRolesPricePerHour` on the `Guild` table. The data in that column could be lost. The data in that column will be cast from `BigInt` to `Int`. + - You are about to alter the column `cooldown` on the `Cooldown` table. The data in that column could be lost. The data in that column will be cast from `BigInt` to `Int`. + */ -- RedefineTables -PRAGMA foreign_keys=OFF; + +PRAGMA foreign_keys = OFF; + CREATE TABLE "new_User" ( "id" TEXT NOT NULL, "reputationsEarned" INTEGER NOT NULL DEFAULT 0, "createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, "updatedAt" DATETIME NOT NULL ); -INSERT INTO "new_User" ("createdAt", "id", "reputationsEarned", "updatedAt") SELECT "createdAt", "id", "reputationsEarned", "updatedAt" FROM "User"; + +INSERT INTO "new_User" ("createdAt", "id", "reputationsEarned", "updatedAt") +SELECT + "createdAt", + "id", + "reputationsEarned", + "updatedAt" +FROM + "User"; + DROP TABLE "User"; + ALTER TABLE "new_User" RENAME TO "User"; -CREATE UNIQUE INDEX "User_id_key" ON "User"("id"); + +CREATE UNIQUE INDEX "User_id_key" ON "User" ("id"); + CREATE TABLE "new_GuildCounter" ( "guildId" TEXT NOT NULL, "channelId" TEXT NOT NULL, @@ -39,10 +52,24 @@ CREATE TABLE "new_GuildCounter" ( "updatedAt" DATETIME NOT NULL, CONSTRAINT "GuildCounter_guildId_fkey" FOREIGN KEY ("guildId") REFERENCES "Guild" ("id") ON DELETE RESTRICT ON UPDATE CASCADE ); -INSERT INTO "new_GuildCounter" ("channelId", "count", "createdAt", "guildId", "triggerWord", "updatedAt") SELECT "channelId", "count", "createdAt", "guildId", "triggerWord", "updatedAt" FROM "GuildCounter"; + +INSERT INTO "new_GuildCounter" ("channelId", "count", "createdAt", "guildId", "triggerWord", "updatedAt") +SELECT + "channelId", + "count", + "createdAt", + "guildId", + "triggerWord", + "updatedAt" +FROM + "GuildCounter"; + DROP TABLE "GuildCounter"; + ALTER TABLE "new_GuildCounter" RENAME TO "GuildCounter"; -CREATE UNIQUE INDEX "GuildCounter_guildId_channelId_key" ON "GuildCounter"("guildId", "channelId"); + +CREATE UNIQUE INDEX "GuildCounter_guildId_channelId_key" ON "GuildCounter" ("guildId", "channelId"); + CREATE TABLE "new_GuildMember" ( "userId" TEXT NOT NULL, "guildId" TEXT NOT NULL, @@ -53,10 +80,24 @@ CREATE TABLE "new_GuildMember" ( CONSTRAINT "GuildMember_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User" ("id") ON DELETE RESTRICT ON UPDATE CASCADE, CONSTRAINT "GuildMember_guildId_fkey" FOREIGN KEY ("guildId") REFERENCES "Guild" ("id") ON DELETE RESTRICT ON UPDATE CASCADE ); -INSERT INTO "new_GuildMember" ("createdAt", "creditsEarned", "guildId", "pointsEarned", "updatedAt", "userId") SELECT "createdAt", "creditsEarned", "guildId", "pointsEarned", "updatedAt", "userId" FROM "GuildMember"; + +INSERT INTO "new_GuildMember" ("createdAt", "creditsEarned", "guildId", "pointsEarned", "updatedAt", "userId") +SELECT + "createdAt", + "creditsEarned", + "guildId", + "pointsEarned", + "updatedAt", + "userId" +FROM + "GuildMember"; + DROP TABLE "GuildMember"; + ALTER TABLE "new_GuildMember" RENAME TO "GuildMember"; -CREATE UNIQUE INDEX "GuildMember_userId_guildId_key" ON "GuildMember"("userId", "guildId"); + +CREATE UNIQUE INDEX "GuildMember_userId_guildId_key" ON "GuildMember" ("userId", "guildId"); + CREATE TABLE "new_GuildShopRoles" ( "guildId" TEXT NOT NULL, "roleId" TEXT NOT NULL, @@ -67,12 +108,29 @@ CREATE TABLE "new_GuildShopRoles" ( "updatedAt" DATETIME NOT NULL, CONSTRAINT "GuildShopRoles_guildId_fkey" FOREIGN KEY ("guildId") REFERENCES "Guild" ("id") ON DELETE RESTRICT ON UPDATE CASCADE, CONSTRAINT "GuildShopRoles_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User" ("id") ON DELETE RESTRICT ON UPDATE CASCADE, - CONSTRAINT "GuildShopRoles_userId_guildId_fkey" FOREIGN KEY ("userId", "guildId") REFERENCES "GuildMember" ("userId", "guildId") ON DELETE RESTRICT ON UPDATE CASCADE + CONSTRAINT "GuildShopRoles_userId_guildId_fkey" FOREIGN KEY ("userId", + "guildId") REFERENCES "GuildMember" ("userId", + "guildId") ON DELETE RESTRICT ON UPDATE CASCADE ); -INSERT INTO "new_GuildShopRoles" ("createdAt", "guildId", "lastPayed", "pricePerHour", "roleId", "updatedAt", "userId") SELECT "createdAt", "guildId", "lastPayed", "pricePerHour", "roleId", "updatedAt", "userId" FROM "GuildShopRoles"; + +INSERT INTO "new_GuildShopRoles" ("createdAt", "guildId", "lastPayed", "pricePerHour", "roleId", "updatedAt", "userId") +SELECT + "createdAt", + "guildId", + "lastPayed", + "pricePerHour", + "roleId", + "updatedAt", + "userId" +FROM + "GuildShopRoles"; + DROP TABLE "GuildShopRoles"; + ALTER TABLE "new_GuildShopRoles" RENAME TO "GuildShopRoles"; -CREATE UNIQUE INDEX "GuildShopRoles_guildId_userId_roleId_key" ON "GuildShopRoles"("guildId", "userId", "roleId"); + +CREATE UNIQUE INDEX "GuildShopRoles_guildId_userId_roleId_key" ON "GuildShopRoles" ("guildId", "userId", "roleId"); + CREATE TABLE "new_Guild" ( "id" TEXT NOT NULL, "embedColorSuccess" TEXT NOT NULL DEFAULT '#22bb33', @@ -80,27 +138,27 @@ CREATE TABLE "new_Guild" ( "embedColorError" TEXT NOT NULL DEFAULT '#bb2124', "embedFooterText" TEXT NOT NULL DEFAULT 'https://github.com/ZynerOrg/xyter', "embedFooterIcon" TEXT NOT NULL DEFAULT 'https://github.com/ZynerOrg.png', - "creditsEnabled" BOOLEAN NOT NULL DEFAULT false, + "creditsEnabled" BOOLEAN NOT NULL DEFAULT FALSE, "creditsRate" INTEGER NOT NULL DEFAULT 1, "creditsTimeout" INTEGER NOT NULL DEFAULT 5, "creditsWorkRate" INTEGER NOT NULL DEFAULT 25, "creditsWorkTimeout" INTEGER NOT NULL DEFAULT 86400, "creditsMinimumLength" INTEGER NOT NULL DEFAULT 5, - "pointsEnabled" BOOLEAN NOT NULL DEFAULT false, + "pointsEnabled" BOOLEAN NOT NULL DEFAULT FALSE, "pointsRate" INTEGER NOT NULL DEFAULT 1, "pointsTimeout" INTEGER NOT NULL DEFAULT 5, "pointsMinimumLength" INTEGER NOT NULL DEFAULT 5, - "reputationsEnabled" BOOLEAN NOT NULL DEFAULT false, - "countersEnabled" BOOLEAN NOT NULL DEFAULT false, + "reputationsEnabled" BOOLEAN NOT NULL DEFAULT FALSE, + "countersEnabled" BOOLEAN NOT NULL DEFAULT FALSE, "apiCpggUrlIv" TEXT, "apiCpggUrlContent" TEXT, "apiCpggTokenIv" TEXT, "apiCpggTokenContent" TEXT, - "auditsEnabled" BOOLEAN NOT NULL DEFAULT false, + "auditsEnabled" BOOLEAN NOT NULL DEFAULT FALSE, "auditsChannelId" TEXT, - "shopRolesEnabled" BOOLEAN NOT NULL DEFAULT false, + "shopRolesEnabled" BOOLEAN NOT NULL DEFAULT FALSE, "shopRolesPricePerHour" INTEGER NOT NULL DEFAULT 5, - "welcomeEnabled" BOOLEAN NOT NULL DEFAULT false, + "welcomeEnabled" BOOLEAN NOT NULL DEFAULT FALSE, "welcomeJoinChannelId" TEXT, "welcomeJoinChannelMessage" TEXT, "welcomeLeaveChannelId" TEXT, @@ -108,10 +166,51 @@ CREATE TABLE "new_Guild" ( "createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, "updatedAt" DATETIME NOT NULL ); -INSERT INTO "new_Guild" ("apiCpggTokenContent", "apiCpggTokenIv", "apiCpggUrlContent", "apiCpggUrlIv", "auditsChannelId", "auditsEnabled", "countersEnabled", "createdAt", "creditsEnabled", "creditsMinimumLength", "creditsRate", "creditsTimeout", "creditsWorkRate", "creditsWorkTimeout", "embedColorError", "embedColorSuccess", "embedColorWait", "embedFooterIcon", "embedFooterText", "id", "pointsEnabled", "pointsMinimumLength", "pointsRate", "pointsTimeout", "reputationsEnabled", "shopRolesEnabled", "shopRolesPricePerHour", "updatedAt", "welcomeEnabled", "welcomeJoinChannelId", "welcomeJoinChannelMessage", "welcomeLeaveChannelId", "welcomeLeaveChannelMessage") SELECT "apiCpggTokenContent", "apiCpggTokenIv", "apiCpggUrlContent", "apiCpggUrlIv", "auditsChannelId", "auditsEnabled", "countersEnabled", "createdAt", "creditsEnabled", "creditsMinimumLength", "creditsRate", "creditsTimeout", "creditsWorkRate", "creditsWorkTimeout", "embedColorError", "embedColorSuccess", "embedColorWait", "embedFooterIcon", "embedFooterText", "id", "pointsEnabled", "pointsMinimumLength", "pointsRate", "pointsTimeout", "reputationsEnabled", "shopRolesEnabled", "shopRolesPricePerHour", "updatedAt", "welcomeEnabled", "welcomeJoinChannelId", "welcomeJoinChannelMessage", "welcomeLeaveChannelId", "welcomeLeaveChannelMessage" FROM "Guild"; + +INSERT INTO "new_Guild" ("apiCpggTokenContent", "apiCpggTokenIv", "apiCpggUrlContent", "apiCpggUrlIv", "auditsChannelId", "auditsEnabled", "countersEnabled", "createdAt", "creditsEnabled", "creditsMinimumLength", "creditsRate", "creditsTimeout", "creditsWorkRate", "creditsWorkTimeout", "embedColorError", "embedColorSuccess", "embedColorWait", "embedFooterIcon", "embedFooterText", "id", "pointsEnabled", "pointsMinimumLength", "pointsRate", "pointsTimeout", "reputationsEnabled", "shopRolesEnabled", "shopRolesPricePerHour", "updatedAt", "welcomeEnabled", "welcomeJoinChannelId", "welcomeJoinChannelMessage", "welcomeLeaveChannelId", "welcomeLeaveChannelMessage") +SELECT + "apiCpggTokenContent", + "apiCpggTokenIv", + "apiCpggUrlContent", + "apiCpggUrlIv", + "auditsChannelId", + "auditsEnabled", + "countersEnabled", + "createdAt", + "creditsEnabled", + "creditsMinimumLength", + "creditsRate", + "creditsTimeout", + "creditsWorkRate", + "creditsWorkTimeout", + "embedColorError", + "embedColorSuccess", + "embedColorWait", + "embedFooterIcon", + "embedFooterText", + "id", + "pointsEnabled", + "pointsMinimumLength", + "pointsRate", + "pointsTimeout", + "reputationsEnabled", + "shopRolesEnabled", + "shopRolesPricePerHour", + "updatedAt", + "welcomeEnabled", + "welcomeJoinChannelId", + "welcomeJoinChannelMessage", + "welcomeLeaveChannelId", + "welcomeLeaveChannelMessage" +FROM + "Guild"; + DROP TABLE "Guild"; + ALTER TABLE "new_Guild" RENAME TO "Guild"; -CREATE UNIQUE INDEX "Guild_id_key" ON "Guild"("id"); + +CREATE UNIQUE INDEX "Guild_id_key" ON "Guild" ("id"); + CREATE TABLE "new_Cooldown" ( "guildId" TEXT NOT NULL, "userId" TEXT NOT NULL, @@ -122,9 +221,25 @@ CREATE TABLE "new_Cooldown" ( CONSTRAINT "Cooldown_guildId_fkey" FOREIGN KEY ("guildId") REFERENCES "Guild" ("id") ON DELETE RESTRICT ON UPDATE CASCADE, CONSTRAINT "Cooldown_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User" ("id") ON DELETE RESTRICT ON UPDATE CASCADE ); -INSERT INTO "new_Cooldown" ("cooldown", "createdAt", "guildId", "timeoutId", "updatedAt", "userId") SELECT "cooldown", "createdAt", "guildId", "timeoutId", "updatedAt", "userId" FROM "Cooldown"; + +INSERT INTO "new_Cooldown" ("cooldown", "createdAt", "guildId", "timeoutId", "updatedAt", "userId") +SELECT + "cooldown", + "createdAt", + "guildId", + "timeoutId", + "updatedAt", + "userId" +FROM + "Cooldown"; + DROP TABLE "Cooldown"; + ALTER TABLE "new_Cooldown" RENAME TO "Cooldown"; -CREATE UNIQUE INDEX "Cooldown_guildId_userId_timeoutId_key" ON "Cooldown"("guildId", "userId", "timeoutId"); + +CREATE UNIQUE INDEX "Cooldown_guildId_userId_timeoutId_key" ON "Cooldown" ("guildId", "userId", "timeoutId"); + PRAGMA foreign_key_check; -PRAGMA foreign_keys=ON; + +PRAGMA foreign_keys = ON; +