mirror of
https://github.com/kremalicious/umami.git
synced 2025-02-14 21:10:34 +01:00
Added access_code column to teams.
This commit is contained in:
parent
dff105c747
commit
aef7326f4c
27
db/postgresql/migrations/02_add_access_code/migration.sql
Normal file
27
db/postgresql/migrations/02_add_access_code/migration.sql
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
/*
|
||||||
|
Warnings:
|
||||||
|
|
||||||
|
- You are about to alter the column `share_id` on the `website` table. The data in that column could be lost. The data in that column will be cast from `VarChar(64)` to `VarChar(50)`.
|
||||||
|
- A unique constraint covering the columns `[access_code]` on the table `team` will be added. If there are existing duplicate values, this will fail.
|
||||||
|
|
||||||
|
*/
|
||||||
|
-- AlterTable
|
||||||
|
ALTER TABLE "team" ADD COLUMN "access_code" VARCHAR(50);
|
||||||
|
|
||||||
|
-- AlterTable
|
||||||
|
ALTER TABLE "website" ALTER COLUMN "share_id" SET DATA TYPE VARCHAR(50);
|
||||||
|
|
||||||
|
-- CreateIndex
|
||||||
|
CREATE UNIQUE INDEX "team_access_code_key" ON "team"("access_code");
|
||||||
|
|
||||||
|
-- CreateIndex
|
||||||
|
CREATE INDEX "team_user_id_idx" ON "team"("user_id");
|
||||||
|
|
||||||
|
-- CreateIndex
|
||||||
|
CREATE INDEX "team_access_code_idx" ON "team"("access_code");
|
||||||
|
|
||||||
|
-- CreateIndex
|
||||||
|
CREATE INDEX "team_user_team_id_idx" ON "team_user"("team_id");
|
||||||
|
|
||||||
|
-- CreateIndex
|
||||||
|
CREATE INDEX "team_user_user_id_idx" ON "team_user"("user_id");
|
@ -43,7 +43,7 @@ model Website {
|
|||||||
id String @id @unique @map("website_id") @db.Uuid
|
id String @id @unique @map("website_id") @db.Uuid
|
||||||
name String @db.VarChar(100)
|
name String @db.VarChar(100)
|
||||||
domain String? @db.VarChar(500)
|
domain String? @db.VarChar(500)
|
||||||
shareId String? @unique @map("share_id") @db.VarChar(64)
|
shareId String? @unique @map("share_id") @db.VarChar(50)
|
||||||
revId Int @default(0) @map("rev_id") @db.Integer
|
revId Int @default(0) @map("rev_id") @db.Integer
|
||||||
userId String? @map("user_id") @db.Uuid
|
userId String? @map("user_id") @db.Uuid
|
||||||
teamId String? @map("team_id") @db.Uuid
|
teamId String? @map("team_id") @db.Uuid
|
||||||
@ -82,6 +82,7 @@ model Team {
|
|||||||
id String @id() @unique() @map("team_id") @db.Uuid
|
id String @id() @unique() @map("team_id") @db.Uuid
|
||||||
name String @db.VarChar(50)
|
name String @db.VarChar(50)
|
||||||
userId String @map("user_id") @db.Uuid
|
userId String @map("user_id") @db.Uuid
|
||||||
|
accessCode String? @unique @map("access_code") @db.VarChar(50)
|
||||||
createdAt DateTime? @default(now()) @map("created_at") @db.Timestamptz(6)
|
createdAt DateTime? @default(now()) @map("created_at") @db.Timestamptz(6)
|
||||||
updatedAt DateTime? @map("updated_at") @db.Timestamptz(6)
|
updatedAt DateTime? @map("updated_at") @db.Timestamptz(6)
|
||||||
deletedAt DateTime? @map("deleted_at") @db.Timestamptz(6)
|
deletedAt DateTime? @map("deleted_at") @db.Timestamptz(6)
|
||||||
@ -89,6 +90,8 @@ model Team {
|
|||||||
teamUsers TeamUser[]
|
teamUsers TeamUser[]
|
||||||
Website Website[]
|
Website Website[]
|
||||||
|
|
||||||
|
@@index([userId])
|
||||||
|
@@index([accessCode])
|
||||||
@@map("team")
|
@@map("team")
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -104,5 +107,7 @@ model TeamUser {
|
|||||||
team Team @relation(fields: [teamId], references: [id])
|
team Team @relation(fields: [teamId], references: [id])
|
||||||
user User @relation(fields: [userId], references: [id])
|
user User @relation(fields: [userId], references: [id])
|
||||||
|
|
||||||
|
@@index([teamId])
|
||||||
|
@@index([userId])
|
||||||
@@map("team_user")
|
@@map("team_user")
|
||||||
}
|
}
|
||||||
|
@ -204,7 +204,7 @@ async function findFirst(data) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function connect() {
|
async function connect() {
|
||||||
if (!clickhouse) {
|
if (enabled && !clickhouse) {
|
||||||
clickhouse = process.env.CLICKHOUSE_URL && (global[CLICKHOUSE] || getClient());
|
clickhouse = process.env.CLICKHOUSE_URL && (global[CLICKHOUSE] || getClient());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user