umami/db/clickhouse/migrations/01_edit_keys.sql

18 lines
755 B
MySQL
Raw Normal View History

2023-07-06 06:09:16 +02:00
-- edit event_data values
ALTER TABLE "event_data" RENAME COLUMN "event_date_value" TO "date_value";
2023-07-06 06:09:16 +02:00
ALTER TABLE "event_data" RENAME COLUMN "event_numeric_value" TO "number_value";
ALTER TABLE "event_data" RENAME COLUMN "event_string_value" TO "string_value";
2023-07-06 06:09:16 +02:00
ALTER TABLE "event_data" RENAME COLUMN "event_data_type" TO "data_type";
-- add job_id
ALTER TABLE "website_event" ADD COLUMN "job_id" UUID AFTER "created_at";
2023-07-11 01:54:42 +02:00
ALTER TABLE "event_data" ADD COLUMN "job_id" UUID AFTER "created_at";
-- update event_data string
alter table umami.event_data
update string_value = number_value
2023-07-11 07:29:38 +02:00
where data_type = 2
2023-07-11 01:54:42 +02:00
alter table umami.event_data
update string_value = replaceOne(concat(CAST(toDateTime(date_value, 'UTC'), 'String'),'Z'), ' ', 'T')
2023-07-11 07:29:38 +02:00
where data_type = 4