Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
-- AlterTable
ALTER TABLE `categories` ADD COLUMN `buttonStyle` INTEGER NOT NULL DEFAULT 2;

Check warning on line 2 in db/mysql/migrations/20250303181321_category_button_style/migration.sql

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

db/mysql/migrations/20250303181321_category_button_style/migration.sql#L2

syntax error at or near "`"
1 change: 1 addition & 0 deletions db/mysql/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ model ArchivedUser {
}

model Category {
buttonStyle Int @default(2)
channelName String
claiming Boolean @default(false)
createdAt DateTime @default(now())
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
-- AlterTable
ALTER TABLE "categories" ADD COLUMN "buttonStyle" INTEGER NOT NULL DEFAULT 2;
1 change: 1 addition & 0 deletions db/postgresql/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ model ArchivedUser {
}

model Category {
buttonStyle Int @default(2)
channelName String
claiming Boolean @default(false)
createdAt DateTime @default(now())
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
-- RedefineTables
PRAGMA defer_foreign_keys=ON;

Check warning on line 2 in db/sqlite/migrations/20250227205558_category_button_style/migration.sql

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

db/sqlite/migrations/20250227205558_category_button_style/migration.sql#L2

syntax error at or near "PRAGMA"
PRAGMA foreign_keys=OFF;

Check warning on line 3 in db/sqlite/migrations/20250227205558_category_button_style/migration.sql

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

db/sqlite/migrations/20250227205558_category_button_style/migration.sql#L3

syntax error at or near "PRAGMA"
CREATE TABLE "new_categories" (
"buttonStyle" INTEGER NOT NULL DEFAULT 2,
"channelName" TEXT NOT NULL,
"claiming" BOOLEAN NOT NULL DEFAULT false,
"createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
"cooldown" INTEGER,
"customTopic" TEXT,
"description" TEXT NOT NULL,
"discordCategory" TEXT NOT NULL,
"emoji" TEXT NOT NULL,
"enableFeedback" BOOLEAN NOT NULL DEFAULT false,
"guildId" TEXT NOT NULL,
"id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,

Check warning on line 16 in db/sqlite/migrations/20250227205558_category_button_style/migration.sql

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

db/sqlite/migrations/20250227205558_category_button_style/migration.sql#L16

syntax error at or near "AUTOINCREMENT"
"image" TEXT,
"memberLimit" INTEGER NOT NULL DEFAULT 1,
"name" TEXT NOT NULL,
"openingMessage" TEXT NOT NULL,
"pingRoles" TEXT NOT NULL DEFAULT '[]',
"ratelimit" INTEGER,
"requiredRoles" TEXT NOT NULL DEFAULT '[]',
"requireTopic" BOOLEAN NOT NULL DEFAULT false,
"staffRoles" TEXT NOT NULL,
"totalLimit" INTEGER NOT NULL DEFAULT 50,
CONSTRAINT "categories_guildId_fkey" FOREIGN KEY ("guildId") REFERENCES "guilds" ("id") ON DELETE CASCADE ON UPDATE CASCADE
);
INSERT INTO "new_categories" ("channelName", "claiming", "cooldown", "createdAt", "customTopic", "description", "discordCategory", "emoji", "enableFeedback", "guildId", "id", "image", "memberLimit", "name", "openingMessage", "pingRoles", "ratelimit", "requireTopic", "requiredRoles", "staffRoles", "totalLimit") SELECT "channelName", "claiming", "cooldown", "createdAt", "customTopic", "description", "discordCategory", "emoji", "enableFeedback", "guildId", "id", "image", "memberLimit", "name", "openingMessage", "pingRoles", "ratelimit", "requireTopic", "requiredRoles", "staffRoles", "totalLimit" FROM "categories";
DROP TABLE "categories";
ALTER TABLE "new_categories" RENAME TO "categories";
PRAGMA foreign_keys=ON;

Check warning on line 32 in db/sqlite/migrations/20250227205558_category_button_style/migration.sql

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

db/sqlite/migrations/20250227205558_category_button_style/migration.sql#L32

syntax error at or near "PRAGMA"
PRAGMA defer_foreign_keys=OFF;

Check warning on line 33 in db/sqlite/migrations/20250227205558_category_button_style/migration.sql

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

db/sqlite/migrations/20250227205558_category_button_style/migration.sql#L33

syntax error at or near "PRAGMA"
1 change: 1 addition & 0 deletions db/sqlite/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ model ArchivedUser {
}

model Category {
buttonStyle Int @default(2)
channelName String
claiming Boolean @default(false)
createdAt DateTime @default(now())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ module.exports.patch = fastify => ({
const data = req.body;

const select = {
buttonStyle: true,
channelName: true,
claiming: true,
// createdAt: true,
Expand Down
7 changes: 2 additions & 5 deletions src/routes/api/admin/guilds/[guild]/panels.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
const {
ActionRowBuilder,
ButtonBuilder,
ButtonStyle: {
Primary,
Secondary,
},
ButtonStyle: { Primary },
ChannelType: { GuildText },
EmbedBuilder,
StringSelectMenuBuilder,
Expand Down Expand Up @@ -100,7 +97,7 @@ module.exports.post = fastify => ({
action: 'create',
target: category.id,
}))
.setStyle(Secondary)
.setStyle(category.buttonStyle)
.setLabel(category.name)
.setEmoji(emoji.hasEmoji(category.emoji) ? emoji.get(category.emoji) : { id: category.emoji }),
),
Expand Down