Implement warning system enhancements with unique identifiers
- Added a `warningNumber` field to the `Warning` model for sequential identification of warnings. - Updated the `createWarning` function to handle the new `warningNumber` logic and notify users via DM upon receiving a warning. - Refactored moderation commands to utilize the new warning system, including changes to the warning creation and removal processes. - Enhanced the WebUI to display warning numbers in the warnings table and updated localization for related messages. - Documented changes in phase tracking to reflect the new warning system features.
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
-- AlterTable
|
||||
ALTER TABLE "Warning" ADD COLUMN "warningNumber" INTEGER;
|
||||
|
||||
-- Backfill per-guild sequential numbers (oldest first)
|
||||
WITH numbered AS (
|
||||
SELECT id, ROW_NUMBER() OVER (PARTITION BY "guildId" ORDER BY "createdAt" ASC, id ASC) AS rn
|
||||
FROM "Warning"
|
||||
)
|
||||
UPDATE "Warning" AS w
|
||||
SET "warningNumber" = numbered.rn
|
||||
FROM numbered
|
||||
WHERE w.id = numbered.id;
|
||||
|
||||
ALTER TABLE "Warning" ALTER COLUMN "warningNumber" SET NOT NULL;
|
||||
|
||||
CREATE UNIQUE INDEX "Warning_guildId_warningNumber_key" ON "Warning"("guildId", "warningNumber");
|
||||
Reference in New Issue
Block a user