Umami is a privacy-first web and product analytics platform. Traffic, campaigns, behavior, conversions, and revenue in one place. No cookies, no surveillance, self-hosted or in the cloud.
TypeScript analyticsaudience-segmentationchartscohort-analysisgoogle-analyticsproduct-analyticsstatisticsuser-journeyweb-analytics
update schema file and add migrations
Francis Caoa6a73db9c456
diff --git a/db/mysql/migrations/04_team_redesign/migration.sql b/db/mysql/migrations/04_team_redesign/migration.sqlnew file mode 100644index 000000000..1ff7ee6ee--- /dev/null+++ b/db/mysql/migrations/04_team_redesign/migration.sql@@ -0,0 +1,17 @@+/*+ Warnings:++ - You are about to drop the `team_website` table. If the table is not empty, all the data it contains will be lost.++*/+-- AlterTable+ALTER TABLE `team` ADD COLUMN `deleted_at` TIMESTAMP(0) NULL;++-- AlterTable+ALTER TABLE `website` ADD COLUMN `team_id` VARCHAR(36) NULL;++-- DropTable+DROP TABLE `team_website`;++-- CreateIndex+CREATE INDEX `website_team_id_idx` ON `website`(`team_id`);diff --git a/db/mysql/schema.prisma b/db/mysql/schema.prismaindex 38bb91f4b..de1a3f7f5 100644--- a/db/mysql/schema.prisma+++ b/db/mysql/schema.prisma@@ -64,17 +64,19 @@ model Website {shareId String? @unique @map("share_id") @db.VarChar(50)resetAt DateTime? @map("reset_at") @db.Timestamp(0)userId String? @map("user_id") @db.VarChar(36)+ teamId String? @map("team_id") @db.VarChar(36)createdAt DateTime? @default(now()) @map("created_at") @db.Timestamp(0)updatedAt DateTime? @updatedAt @map("updated_at") @db.Timestamp(0)deletedAt DateTime? @map("deleted_at") @db.Timestamp(0)user User? @relation(fields: [userId], references: [id])- teamWebsite TeamWebsite[]+ team Team? @relation(fields: [teamId], references: [id])eventData EventData[]report Report[]sessionData SessionData[]@@index([userId])+ @@index([teamId])@@index([createdAt])@@index([shareId])@@map("website")@@ -159,9 +161,10 @@ model Team {accessCode String? @unique @map("access_code") @db.VarChar(50)createdAt DateTime? @default(now()) @map("created_at") @db.Timestamp(0)updatedAt DateTime? @updatedAt @map("updated_at") @db.Timestamp(0)+ deletedAt DateTime? @map("deleted_at") @db.Timestamp(0)+ website Website[]teamUser TeamUser[]- teamWebsite TeamWebsite[]@@index([accessCode])@@map("team")@@ -183,20 +186,6 @@ model TeamUser {@@map("team_user")}-model TeamWebsite {- id String @id() @unique() @map("team_website_id") @db.VarChar(36)- teamId String @map("team_id") @db.VarChar(36)- websiteId String @map("website_id") @db.VarChar(36)- createdAt DateTime? @default(now()) @map("created_at") @db.Timestamp(0)-- team Team @relation(fields: [teamId], references: [id])- website Website @relation(fields: [websiteId], references: [id])-- @@index([teamId])- @@index([websiteId])- @@map("team_website")-}-model Report {id String @id() @unique() @map("report_id") @db.VarChar(36)userId String @map("user_id") @db.VarChar(36)diff --git a/db/postgresql/migrations/04_team_redesign/migration.sql b/db/postgresql/migrations/04_team_redesign/migration.sqlnew file mode 100644index 000000000..d69e371f1--- /dev/null+++ b/db/postgresql/migrations/04_team_redesign/migration.sql@@ -0,0 +1,17 @@+/*+ Warnings:++ - You are about to drop the `team_website` table. If the table is not empty, all the data it contains will be lost.++*/+-- AlterTable+ALTER TABLE "team" ADD COLUMN "deleted_at" TIMESTAMPTZ(6) DEFAULT CURRENT_TIMESTAMP;++-- AlterTable+ALTER TABLE "website" ADD COLUMN "team_id" UUID;++-- DropTable+DROP TABLE "team_website";++-- CreateIndex+CREATE INDEX "website_team_id_idx" ON "website"("team_id");diff --git a/db/postgresql/schema.prisma b/db/postgresql/schema.prismaindex 336e8f500..6dda2b022 100644--- a/db/postgresql/schema.prisma+++ b/db/postgresql/schema.prisma@@ -65,17 +65,19 @@ model Website {shareId String? @unique @map("share_id") @db.VarChar(50)resetAt DateTime? @map("reset_at") @db.Timestamptz(6)userId String? @map("user_id") @db.Uuid+ teamId String? @map("team_id") @db.UuidcreatedAt DateTime? @default(now()) @map("created_at") @db.Timestamptz(6)updatedAt DateTime? @updatedAt @map("updated_at") @db.Timestamptz(6)deletedAt DateTime? @map("deleted_at") @db.Timestamptz(6)user User? @relation(fields: [userId], references: [id])- teamWebsite TeamWebsite[]+ team Team? @relation(fields: [teamId], references: [id])eventData EventData[]report Report[]sessionData SessionData[]@@index([userId])+ @@index([teamId])@@index([createdAt])@@index([shareId])@@map("website")@@ -160,9 +162,10 @@ model Team {accessCode String? @unique @map("access_code") @db.VarChar(50)createdAt DateTime? @default(now()) @map("created_at") @db.Timestamptz(6)updatedAt DateTime? @updatedAt @map("updated_at") @db.Timestamptz(6)+ deletedAt DateTime? @default(now()) @map("deleted_at") @db.Timestamptz(6)+ website Website[]teamUser TeamUser[]- teamWebsite TeamWebsite[]@@index([accessCode])@@map("team")@@ -184,20 +187,6 @@ model TeamUser {@@map("team_user")}-model TeamWebsite {- id String @id() @unique() @map("team_website_id") @db.Uuid- teamId String @map("team_id") @db.Uuid- websiteId String @map("website_id") @db.Uuid- createdAt DateTime? @default(now()) @map("created_at") @db.Timestamptz(6)-- team Team @relation(fields: [teamId], references: [id])- website Website @relation(fields: [websiteId], references: [id])-- @@index([teamId])- @@index([websiteId])- @@map("team_website")-}-model Report {id String @id() @unique() @map("report_id") @db.UuiduserId String @map("user_id") @db.Uuid