From 396acf3bbbe00a192cb0ea0a9ccf91b1d8d2850b Mon Sep 17 00:00:00 2001 From: Fuwn <50817549+Fuwn@users.noreply.github.com> Date: Sat, 24 Jan 2026 13:09:50 +0000 Subject: Initial commit Created from https://vercel.com/new --- .../09_update_hostname_region/migration.sql | 25 ++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 prisma/migrations/09_update_hostname_region/migration.sql (limited to 'prisma/migrations/09_update_hostname_region') diff --git a/prisma/migrations/09_update_hostname_region/migration.sql b/prisma/migrations/09_update_hostname_region/migration.sql new file mode 100644 index 0000000..191a131 --- /dev/null +++ b/prisma/migrations/09_update_hostname_region/migration.sql @@ -0,0 +1,25 @@ +-- AlterTable +ALTER TABLE "website_event" ADD COLUMN "hostname" VARCHAR(100); + +-- DataMigration +UPDATE "website_event" w +SET hostname = s.hostname +FROM "session" s +WHERE s.website_id = w.website_id + and s.session_id = w.session_id; + +-- DropIndex +DROP INDEX IF EXISTS "session_website_id_created_at_hostname_idx"; +DROP INDEX IF EXISTS "session_website_id_created_at_subdivision1_idx"; + +-- AlterTable +ALTER TABLE "session" RENAME COLUMN "subdivision1" TO "region"; +ALTER TABLE "session" DROP COLUMN "subdivision2"; +ALTER TABLE "session" DROP COLUMN "hostname"; + +-- CreateIndex +CREATE INDEX "website_event_website_id_created_at_hostname_idx" ON "website_event"("website_id", "created_at", "hostname"); +CREATE INDEX "session_website_id_created_at_region_idx" ON "session"("website_id", "created_at", "region"); + + + -- cgit v1.2.3