mirror of
https://github.com/umami-software/umami.git
synced 2026-02-04 04:37:11 +01:00
add psql migration
This commit is contained in:
parent
0cb28e9fde
commit
cbeefe733f
3 changed files with 18 additions and 0 deletions
14
db/postgresql/migrations/05_add_visit_id/migration.sql
Normal file
14
db/postgresql/migrations/05_add_visit_id/migration.sql
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
-- AlterTable
|
||||
ALTER TABLE "website_event" ADD COLUMN "session_id" UUID NULL;
|
||||
|
||||
UPDATE "website_event"
|
||||
SET session_id = uuid_in(overlay(overlay(md5(CONCAT(session_id::text, to_char(date_trunc('hour', created_at), 'YYYY-MM-DD HH24:00:00'))) placing '4' from 13) placing '8' from 17)::cstring)
|
||||
WHERE session_id IS NULL;
|
||||
|
||||
ALTER TABLE "website_event" ALTER COLUMN "session_id" SET NOT NULL;
|
||||
|
||||
-- CreateIndex
|
||||
CREATE INDEX "website_event_visit_id_idx" ON "website_event"("visit_id");
|
||||
|
||||
-- CreateIndex
|
||||
CREATE INDEX "website_event_website_id_visit_id_created_at_idx" ON "website_event"("website_id", "visit_id", "created_at");
|
||||
Loading…
Add table
Add a link
Reference in a new issue