umami/db/postgresql/migrations/04_add_uuid/migration.sql
Mike Cao aceb904398
v1.39.2 (#1599)
* Fixed issue with realtime page rendering.

* fix auth, add pg extension (#1596)

* Fixed change password issue. API refactoring. Closes #1592.

* Fixed account lookup.

* Fixed issue with accessing user dashboards. Closes #1590

* fix sort on dashboard (#1600)

Co-authored-by: Brian Cao <brian@umami.is>
2022-10-25 16:50:12 -07:00

38 lines
1013 B
SQL

-- CreateExtension
CREATE EXTENSION IF NOT EXISTS pgcrypto;
-- AlterTable
ALTER TABLE "account" ADD COLUMN "account_uuid" UUID NULL;
-- Backfill UUID
UPDATE "account" SET account_uuid = gen_random_uuid();
-- AlterTable
ALTER TABLE "account" ALTER COLUMN "account_uuid" SET NOT NULL;
-- CreateIndex
CREATE UNIQUE INDEX "account_account_uuid_key" ON "account"("account_uuid");
-- AlterTable
ALTER TABLE "event" ADD COLUMN "event_uuid" UUID NULL;
-- Backfill UUID
UPDATE "event" SET event_uuid = gen_random_uuid();
-- AlterTable
ALTER TABLE "event" ALTER COLUMN "event_uuid" SET NOT NULL;
-- CreateIndex
CREATE UNIQUE INDEX "event_event_uuid_key" ON "event"("event_uuid");
-- CreateIndex
CREATE INDEX "account_account_uuid_idx" ON "account"("account_uuid");
-- CreateIndex
CREATE INDEX "session_session_uuid_idx" ON "session"("session_uuid");
-- CreateIndex
CREATE INDEX "website_website_uuid_idx" ON "website"("website_uuid");
-- CreateIndex
CREATE INDEX "event_event_uuid_idx" ON "event"("event_uuid");