mirror of
https://github.com/kremalicious/umami.git
synced 2024-11-15 17:55:08 +01:00
add mysql 02 migration
This commit is contained in:
parent
77f758205b
commit
1038a54fe4
19
db/mysql/migrations/02_report_schema/migration.sql
Normal file
19
db/mysql/migrations/02_report_schema/migration.sql
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
-- CreateTable
|
||||||
|
CREATE TABLE `report` (
|
||||||
|
`report_id` VARCHAR(36) NOT NULL,
|
||||||
|
`user_id` VARCHAR(36) NOT NULL,
|
||||||
|
`website_id` VARCHAR(36) NOT NULL,
|
||||||
|
`type` VARCHAR(200) NOT NULL,
|
||||||
|
`name` VARCHAR(200) NOT NULL,
|
||||||
|
`description` VARCHAR(500) NOT NULL,
|
||||||
|
`parameters` VARCHAR(6000) NOT NULL,
|
||||||
|
`created_at` TIMESTAMP(0) NULL DEFAULT CURRENT_TIMESTAMP(0),
|
||||||
|
`updated_at` TIMESTAMP(0) NULL,
|
||||||
|
|
||||||
|
UNIQUE INDEX `report_report_id_key`(`report_id`),
|
||||||
|
INDEX `report_user_id_idx`(`user_id`),
|
||||||
|
INDEX `report_website_id_idx`(`website_id`),
|
||||||
|
INDEX `report_type_idx`(`type`),
|
||||||
|
INDEX `report_name_idx`(`name`),
|
||||||
|
PRIMARY KEY (`report_id`)
|
||||||
|
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
@ -19,6 +19,7 @@ model User {
|
|||||||
|
|
||||||
website Website[]
|
website Website[]
|
||||||
teamUser TeamUser[]
|
teamUser TeamUser[]
|
||||||
|
Report Report[]
|
||||||
|
|
||||||
@@map("user")
|
@@map("user")
|
||||||
}
|
}
|
||||||
@ -59,6 +60,7 @@ model Website {
|
|||||||
user User? @relation(fields: [userId], references: [id])
|
user User? @relation(fields: [userId], references: [id])
|
||||||
teamWebsite TeamWebsite[]
|
teamWebsite TeamWebsite[]
|
||||||
eventData EventData[]
|
eventData EventData[]
|
||||||
|
Report Report[]
|
||||||
|
|
||||||
@@index([userId])
|
@@index([userId])
|
||||||
@@index([createdAt])
|
@@index([createdAt])
|
||||||
@ -155,3 +157,24 @@ model TeamWebsite {
|
|||||||
@@index([websiteId])
|
@@index([websiteId])
|
||||||
@@map("team_website")
|
@@map("team_website")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
model Report {
|
||||||
|
id String @id() @unique() @map("report_id") @db.VarChar(36)
|
||||||
|
userId String @map("user_id") @db.VarChar(36)
|
||||||
|
websiteId String @map("website_id") @db.VarChar(36)
|
||||||
|
type String @map("type") @db.VarChar(200)
|
||||||
|
name String @map("name") @db.VarChar(200)
|
||||||
|
description String @map("description") @db.VarChar(500)
|
||||||
|
parameters String @map("parameters") @db.VarChar(6000)
|
||||||
|
createdAt DateTime? @default(now()) @map("created_at") @db.Timestamp(0)
|
||||||
|
updatedAt DateTime? @updatedAt @map("updated_at") @db.Timestamp(0)
|
||||||
|
|
||||||
|
user User @relation(fields: [userId], references: [id])
|
||||||
|
website Website @relation(fields: [websiteId], references: [id])
|
||||||
|
|
||||||
|
@@index([userId])
|
||||||
|
@@index([websiteId])
|
||||||
|
@@index([type])
|
||||||
|
@@index([name])
|
||||||
|
@@map("report")
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user