mirror of
https://github.com/umami-software/umami.git
synced 2026-02-20 20:45:39 +01:00
implemented the user view type and website sharing
This commit is contained in:
parent
7a3443cd06
commit
66e67c7a3b
19 changed files with 260 additions and 68 deletions
19
db/postgresql/migrations/04_add_website_viewer/migration.sql
Normal file
19
db/postgresql/migrations/04_add_website_viewer/migration.sql
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
-- AlterTable
|
||||
ALTER TABLE "account" ADD COLUMN "is_viewer" BOOLEAN NOT NULL DEFAULT false;
|
||||
|
||||
-- DropTable
|
||||
DROP TABLE "_event_old";
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE "viewerforwebsite" (
|
||||
"user_id" INTEGER NOT NULL,
|
||||
"website_id" INTEGER NOT NULL,
|
||||
|
||||
CONSTRAINT "viewerforwebsite_pkey" PRIMARY KEY ("user_id","website_id")
|
||||
);
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "viewerforwebsite" ADD CONSTRAINT "viewerforwebsite_user_id_fkey" FOREIGN KEY ("user_id") REFERENCES "account"("user_id") ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "viewerforwebsite" ADD CONSTRAINT "viewerforwebsite_website_id_fkey" FOREIGN KEY ("website_id") REFERENCES "website"("website_id") ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
|
@ -12,10 +12,12 @@ model account {
|
|||
username String @unique @db.VarChar(255)
|
||||
password String @db.VarChar(60)
|
||||
isAdmin Boolean @default(false) @map("is_admin")
|
||||
isViewer Boolean @default(false) @map("is_viewer")
|
||||
createdAt DateTime? @default(now()) @map("created_at") @db.Timestamptz(6)
|
||||
updatedAt DateTime? @default(now()) @map("updated_at") @db.Timestamptz(6)
|
||||
accountUuid String @unique @map("account_uuid") @db.Uuid
|
||||
website website[]
|
||||
viewwebsites viewerforwebsite[]
|
||||
|
||||
@@index([accountUuid])
|
||||
}
|
||||
|
|
@ -97,7 +99,18 @@ model website {
|
|||
event event[]
|
||||
pageview pageview[]
|
||||
session session[]
|
||||
viewers viewerforwebsite[]
|
||||
|
||||
@@index([userId])
|
||||
@@index([websiteUuid])
|
||||
}
|
||||
|
||||
model viewerforwebsite {
|
||||
userId Int @map("user_id")
|
||||
websiteId Int @map("website_id")
|
||||
|
||||
account account @relation(fields: [userId], references: [id])
|
||||
website website @relation(fields: [websiteId], references: [id])
|
||||
|
||||
@@id([userId, websiteId])
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue