-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: refactor and improve Prisma id implementation
- Loading branch information
Showing
4 changed files
with
47 additions
and
16 deletions.
There are no files selected for viewing
33 changes: 33 additions & 0 deletions
33
prisma/migrations/20240412030727_refactorIds/migration.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/* | ||
Warnings: | ||
- The primary key for the `CommandStatistics` table will be changed. If it partially fails, the table could be left without primary key constraint. | ||
- The `id` column on the `CommandStatistics` table would be dropped and recreated. This will lead to data loss if there is data in the column. | ||
- The primary key for the `EmbedField` table will be changed. If it partially fails, the table could be left without primary key constraint. | ||
- The `id` column on the `EmbedField` table would be dropped and recreated. This will lead to data loss if there is data in the column. | ||
- You are about to drop the column `guildId` on the `Guild` table. All the data in the column will be lost. | ||
*/ | ||
|
||
-- DropIndex | ||
DROP INDEX "Guild_guildId_key"; | ||
|
||
-- AlterTable | ||
ALTER TABLE "CommandStatistics" DROP CONSTRAINT "CommandStatistics_pkey", | ||
DROP COLUMN "id", | ||
ADD COLUMN "id" SERIAL NOT NULL, | ||
ADD CONSTRAINT "CommandStatistics_pkey" PRIMARY KEY ("id"); | ||
|
||
-- AlterTable | ||
ALTER TABLE "EmbedField" DROP CONSTRAINT "EmbedField_pkey", | ||
DROP COLUMN "id", | ||
ADD COLUMN "id" SERIAL NOT NULL, | ||
ADD CONSTRAINT "EmbedField_pkey" PRIMARY KEY ("id"); | ||
|
||
-- AlterTable | ||
ALTER TABLE "Guild" DROP COLUMN "guildId"; | ||
|
||
-- CreateIndex | ||
CREATE UNIQUE INDEX "CommandStatistics_id_key" ON "CommandStatistics"("id"); | ||
|
||
-- CreateIndex | ||
CREATE UNIQUE INDEX "EmbedField_id_key" ON "EmbedField"("id"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters