قرینه از
https://github.com/umami-software/umami.git
synced 2025-08-23 00:57:34 +00:00
26 خطوط
817 B
SQL
26 خطوط
817 B
SQL
-- 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");
|
|
|
|
|
|
|