Skip to content

Commit

Permalink
Redo entire migration file ig
Browse files Browse the repository at this point in the history
  • Loading branch information
LunaUrsa committed Feb 17, 2024
1 parent 8d747bc commit 8e3e151
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 17 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"db:validateSchema": "docker exec -it tripbot npx prisma validate",
"db:generateClient": "npx prisma generate && docker exec -it tripbot npx prisma generate",
"db:pushDev": "docker exec -it tripbot npx prisma db push && npm run tripbot:db:generate",
"db:migrateDev": "docker exec -it tripbot npx prisma migrate dev -n quotes",
"db:migrateDev": "docker exec -it tripbot npx prisma migrate dev -n ai_ui_update",
"db:seed": "docker exec -it tripbot npx prisma db seed",
"## PGADMIN ##": "",
"pgadmin": "docker compose --project-name tripbot up -d --force-recreate --build tripbot_pgadmin",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
Warnings:
- The values [GPT-4,DAVINCI,CURIE,BABBAGE,ADA,GPT-3.5-TURBO-1106,GPT-4-1106-PREVIEW,GPT-4-1106-VISION-PREVIEW,DALL-E-2] on the enum `ai_model` will be removed. If these variants are still used in the database, this will fail.
- A unique constraint covering the columns `[channel_id]` on the table `ai_channels` will be added. If there are existing duplicate values, this will fail.
- Added the required column `guild_id` to the `ai_channels` table without a default value. This is not possible if the table is not empty.
*/
Expand All @@ -16,12 +15,6 @@ ALTER TYPE "ai_model_new" RENAME TO "ai_model";
DROP TYPE "ai_model_old";
COMMIT;

-- Drop the unique constraint
ALTER TABLE ai_channels DROP CONSTRAINT aichannels_channelid_personaid_unique;

-- DropIndex
DROP INDEX "aichannels_channelid_personaid_unique";

-- AlterTable
ALTER TABLE "ai_channels" ADD COLUMN "guild_id" TEXT NOT NULL;

Expand All @@ -35,9 +28,3 @@ ADD COLUMN "upvotes" INTEGER NOT NULL DEFAULT 0;
ALTER TABLE "users" ADD COLUMN "ai_history_google" TEXT,
ADD COLUMN "ai_history_openai" TEXT,
ADD COLUMN "ai_terms_agree" BOOLEAN NOT NULL DEFAULT false;

-- CreateIndex
CREATE UNIQUE INDEX "aichannels_channelid_unique" ON "ai_channels"("channel_id");

-- AddForeignKey
ALTER TABLE "ai_channels" ADD CONSTRAINT "aichannels_guildid_foreign" FOREIGN KEY ("guild_id") REFERENCES "discord_guilds"("id") ON DELETE NO ACTION ON UPDATE NO ACTION;
8 changes: 5 additions & 3 deletions src/prisma/tripbot/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ model discord_guilds {
reaction_roles reaction_roles[]
ai_moderation ai_moderation?
user_actions user_actions[]
ai_channels ai_channels[]
// ai_channels ai_channels[]
}

model drug_articles {
Expand Down Expand Up @@ -440,9 +440,11 @@ model ai_channels {
persona_id String @db.Uuid
ai_personas ai_personas @relation(fields: [persona_id], references: [id], onDelete: NoAction, onUpdate: NoAction, map: "aichannels_personaid_foreign")
discord_guilds discord_guilds @relation(fields: [guild_id], references: [id], onDelete: NoAction, onUpdate: NoAction, map: "aichannels_guildid_foreign")
// discord_guilds discord_guilds @relation(fields: [guild_id], references: [id], onDelete: NoAction, onUpdate: NoAction, map: "aichannels_guildid_foreign")
@@unique([channel_id], map: "aichannels_channelid_unique")
// @@unique([channel_id], map: "aichannels_channelid_unique")
@@unique([channel_id, persona_id], map: "aichannels_channelid_personaid_unique")
}

model ai_moderation {
Expand Down

0 comments on commit 8e3e151

Please sign in to comment.