🏷️ fixed "wrong" types

This commit is contained in:
Axel Olausson Holtenäs 2022-10-20 10:53:13 +02:00
parent ea8e3bb1dc
commit 98acf7ce57
4 changed files with 48 additions and 3 deletions

View file

@ -0,0 +1,18 @@
-- RedefineTables
PRAGMA foreign_keys=OFF;
CREATE TABLE "new_Cooldown" (
"guildId" TEXT NOT NULL,
"userId" TEXT NOT NULL,
"cooldown" TEXT NOT NULL,
"timeoutId" TEXT NOT NULL,
"createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" DATETIME NOT NULL,
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";
DROP TABLE "Cooldown";
ALTER TABLE "new_Cooldown" RENAME TO "Cooldown";
CREATE UNIQUE INDEX "Cooldown_guildId_userId_timeoutId_key" ON "Cooldown"("guildId", "userId", "timeoutId");
PRAGMA foreign_key_check;
PRAGMA foreign_keys=ON;

View file

@ -0,0 +1,24 @@
/*
Warnings:
- 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 `String` to `Int`.
*/
-- RedefineTables
PRAGMA foreign_keys=OFF;
CREATE TABLE "new_Cooldown" (
"guildId" TEXT NOT NULL,
"userId" TEXT NOT NULL,
"cooldown" INTEGER NOT NULL,
"timeoutId" TEXT NOT NULL,
"createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" DATETIME NOT NULL,
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";
DROP TABLE "Cooldown";
ALTER TABLE "new_Cooldown" RENAME TO "Cooldown";
CREATE UNIQUE INDEX "Cooldown_guildId_userId_timeoutId_key" ON "Cooldown"("guildId", "userId", "timeoutId");
PRAGMA foreign_key_check;
PRAGMA foreign_keys=ON;

View file

@ -51,7 +51,10 @@ export default {
noSelfReputation(optionTarget, user);
// Check if user is on cooldown otherwise create one
await CooldownCommand(interaction, process.env.REPUTATION_TIMEOUT);
await CooldownCommand(
interaction,
parseInt(process.env.REPUTATION_TIMEOUT)
);
switch (optionType) {
case "positive": {

View file

@ -7,7 +7,7 @@ declare global {
DISCORD_TOKEN: string;
DISCORD_CLIENT_ID: Snowflake;
DISCORD_GUILD_ID: Snowflake;
DEVELOPMENT_MODE: boolean;
DEVELOPMENT_MODE: string;
ENCRYPTION_ALGORITHM: string;
ENCRYPTION_SECRET: string;
EMBED_COLOR_SUCCESS: ColorResolvable;
@ -16,7 +16,7 @@ declare global {
EMBED_FOOTER_TEXT: string;
EMBED_FOOTER_ICON: string;
LOG_LEVEL: string;
REPUTATION_TIMEOUT: number;
REPUTATION_TIMEOUT: string;
BOT_HOSTER_NAME: string;
BOT_HOSTER_URL: string;
}