mirror of
https://github.com/umami-software/umami.git
synced 2026-02-15 01:55:36 +01:00
add relational migrations. update event_key references to data_key
This commit is contained in:
parent
cc834083d9
commit
7381254cc2
10 changed files with 73 additions and 33 deletions
20
db/mysql/migrations/06_session_data/migration.sql
Normal file
20
db/mysql/migrations/06_session_data/migration.sql
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
-- DropIndex
|
||||
DROP INDEX `event_data_website_id_created_at_event_key_idx` ON `event_data`;
|
||||
|
||||
-- DropIndex
|
||||
DROP INDEX `event_data_website_id_website_event_id_created_at_idx` ON `event_data`;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `event_data` RENAME COLUMN `event_key` TO `data_key`;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `session_data` RENAME COLUMN `event_key` TO `data_key`;
|
||||
|
||||
-- CreateIndex
|
||||
CREATE INDEX `event_data_website_id_created_at_data_key_idx` ON `event_data`(`website_id`, `created_at`, `data_key`);
|
||||
|
||||
-- CreateIndex
|
||||
CREATE INDEX `session_data_session_id_created_at_idx` ON `session_data`(`session_id`, `created_at`);
|
||||
|
||||
-- CreateIndex
|
||||
CREATE INDEX `session_data_website_id_created_at_data_key_idx` ON `session_data`(`website_id`, `created_at`, `data_key`);
|
||||
|
|
@ -125,7 +125,7 @@ model EventData {
|
|||
id String @id() @map("event_data_id") @db.VarChar(36)
|
||||
websiteId String @map("website_id") @db.VarChar(36)
|
||||
websiteEventId String @map("website_event_id") @db.VarChar(36)
|
||||
eventKey String @map("event_key") @db.VarChar(500)
|
||||
dataKey String @map("data_key") @db.VarChar(500)
|
||||
stringValue String? @map("string_value") @db.VarChar(500)
|
||||
numberValue Decimal? @map("number_value") @db.Decimal(19, 4)
|
||||
dateValue DateTime? @map("date_value") @db.Timestamp(0)
|
||||
|
|
@ -138,9 +138,8 @@ model EventData {
|
|||
@@index([createdAt])
|
||||
@@index([websiteId])
|
||||
@@index([websiteEventId])
|
||||
@@index([websiteId, websiteEventId, createdAt])
|
||||
@@index([websiteId, createdAt])
|
||||
@@index([websiteId, createdAt, eventKey])
|
||||
@@index([websiteId, createdAt, dataKey])
|
||||
@@map("event_data")
|
||||
}
|
||||
|
||||
|
|
@ -148,7 +147,7 @@ model SessionData {
|
|||
id String @id() @map("session_data_id") @db.VarChar(36)
|
||||
websiteId String @map("website_id") @db.VarChar(36)
|
||||
sessionId String @map("session_id") @db.VarChar(36)
|
||||
eventKey String @map("event_key") @db.VarChar(500)
|
||||
dataKey String @map("data_key") @db.VarChar(500)
|
||||
stringValue String? @map("string_value") @db.VarChar(500)
|
||||
numberValue Decimal? @map("number_value") @db.Decimal(19, 4)
|
||||
dateValue DateTime? @map("date_value") @db.Timestamp(0)
|
||||
|
|
@ -161,6 +160,8 @@ model SessionData {
|
|||
@@index([createdAt])
|
||||
@@index([websiteId])
|
||||
@@index([sessionId])
|
||||
@@index([sessionId, createdAt])
|
||||
@@index([websiteId, createdAt, dataKey])
|
||||
@@map("session_data")
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue