mirror of
https://github.com/kremalicious/umami.git
synced 2024-12-24 18:26:20 +01:00
squash psql migration. add event_data migration
This commit is contained in:
parent
3749e2a70d
commit
8abeba4c0d
@ -33,6 +33,7 @@ export function TestConsole() {
|
|||||||
booleanError: 'true',
|
booleanError: 'true',
|
||||||
time: new Date(),
|
time: new Date(),
|
||||||
number: 1,
|
number: 1,
|
||||||
|
number2: Math.random() * 100,
|
||||||
time2: new Date().toISOString(),
|
time2: new Date().toISOString(),
|
||||||
nested: {
|
nested: {
|
||||||
test: 'test-data',
|
test: 'test-data',
|
||||||
|
@ -1,29 +0,0 @@
|
|||||||
-- CreateTable
|
|
||||||
CREATE TABLE "report" (
|
|
||||||
"report_id" UUID NOT NULL,
|
|
||||||
"user_id" UUID NOT NULL,
|
|
||||||
"website_id" UUID NOT NULL,
|
|
||||||
"type" VARCHAR(200) NOT NULL,
|
|
||||||
"name" VARCHAR(200) NOT NULL,
|
|
||||||
"description" VARCHAR(500) NOT NULL,
|
|
||||||
"parameters" VARCHAR(6000) NOT NULL,
|
|
||||||
"created_at" TIMESTAMPTZ(6) DEFAULT CURRENT_TIMESTAMP,
|
|
||||||
"updated_at" TIMESTAMPTZ(6),
|
|
||||||
|
|
||||||
CONSTRAINT "report_pkey" PRIMARY KEY ("report_id")
|
|
||||||
);
|
|
||||||
|
|
||||||
-- CreateIndex
|
|
||||||
CREATE UNIQUE INDEX "report_report_id_key" ON "report"("report_id");
|
|
||||||
|
|
||||||
-- CreateIndex
|
|
||||||
CREATE INDEX "report_user_id_idx" ON "report"("user_id");
|
|
||||||
|
|
||||||
-- CreateIndex
|
|
||||||
CREATE INDEX "report_website_id_idx" ON "report"("website_id");
|
|
||||||
|
|
||||||
-- CreateIndex
|
|
||||||
CREATE INDEX "report_type_idx" ON "report"("type");
|
|
||||||
|
|
||||||
-- CreateIndex
|
|
||||||
CREATE INDEX "report_name_idx" ON "report"("name");
|
|
@ -21,6 +21,21 @@ CREATE TABLE "session_data" (
|
|||||||
CONSTRAINT "session_data_pkey" PRIMARY KEY ("session_data_id")
|
CONSTRAINT "session_data_pkey" PRIMARY KEY ("session_data_id")
|
||||||
);
|
);
|
||||||
|
|
||||||
|
-- CreateTable
|
||||||
|
CREATE TABLE "report" (
|
||||||
|
"report_id" UUID NOT NULL,
|
||||||
|
"user_id" UUID NOT NULL,
|
||||||
|
"website_id" UUID NOT NULL,
|
||||||
|
"type" VARCHAR(200) NOT NULL,
|
||||||
|
"name" VARCHAR(200) NOT NULL,
|
||||||
|
"description" VARCHAR(500) NOT NULL,
|
||||||
|
"parameters" VARCHAR(6000) NOT NULL,
|
||||||
|
"created_at" TIMESTAMPTZ(6) DEFAULT CURRENT_TIMESTAMP,
|
||||||
|
"updated_at" TIMESTAMPTZ(6),
|
||||||
|
|
||||||
|
CONSTRAINT "report_pkey" PRIMARY KEY ("report_id")
|
||||||
|
);
|
||||||
|
|
||||||
-- CreateIndex
|
-- CreateIndex
|
||||||
CREATE INDEX "session_data_created_at_idx" ON "session_data"("created_at");
|
CREATE INDEX "session_data_created_at_idx" ON "session_data"("created_at");
|
||||||
|
|
||||||
@ -29,3 +44,27 @@ CREATE INDEX "session_data_website_id_idx" ON "session_data"("website_id");
|
|||||||
|
|
||||||
-- CreateIndex
|
-- CreateIndex
|
||||||
CREATE INDEX "session_data_session_id_idx" ON "session_data"("session_id");
|
CREATE INDEX "session_data_session_id_idx" ON "session_data"("session_id");
|
||||||
|
|
||||||
|
-- CreateIndex
|
||||||
|
CREATE UNIQUE INDEX "report_report_id_key" ON "report"("report_id");
|
||||||
|
|
||||||
|
-- CreateIndex
|
||||||
|
CREATE INDEX "report_user_id_idx" ON "report"("user_id");
|
||||||
|
|
||||||
|
-- CreateIndex
|
||||||
|
CREATE INDEX "report_website_id_idx" ON "report"("website_id");
|
||||||
|
|
||||||
|
-- CreateIndex
|
||||||
|
CREATE INDEX "report_type_idx" ON "report"("type");
|
||||||
|
|
||||||
|
-- CreateIndex
|
||||||
|
CREATE INDEX "report_name_idx" ON "report"("name");
|
||||||
|
|
||||||
|
-- EventData migration
|
||||||
|
UPDATE "event_data"
|
||||||
|
SET string_value = number_value
|
||||||
|
WHERE data_type = 2;
|
||||||
|
|
||||||
|
UPDATE "event_data"
|
||||||
|
SET string_value = CONCAT(REPLACE(TO_CHAR(date_value, 'YYYY-MM-DD HH24:MI:SS:MS'), ' ', 'T'), 'Z')
|
||||||
|
WHERE data_type = 4;
|
@ -37,8 +37,9 @@ async function relationalQuery(data: {
|
|||||||
websiteEventId: eventId,
|
websiteEventId: eventId,
|
||||||
websiteId,
|
websiteId,
|
||||||
eventKey: a.key,
|
eventKey: a.key,
|
||||||
stringValue: a.value.toString(),
|
stringValue:
|
||||||
numericValue: a.dynamicDataType === DATA_TYPE.number ? a.value : null,
|
a.dynamicDataType === DATA_TYPE.number ? parseFloat(a.value).toFixed(4) : a.value.toString(),
|
||||||
|
numberValue: a.dynamicDataType === DATA_TYPE.number ? a.value : null,
|
||||||
dateValue: a.dynamicDataType === DATA_TYPE.date ? new Date(a.value) : null,
|
dateValue: a.dynamicDataType === DATA_TYPE.date ? new Date(a.value) : null,
|
||||||
dataType: a.dynamicDataType,
|
dataType: a.dynamicDataType,
|
||||||
}));
|
}));
|
||||||
|
@ -20,12 +20,8 @@ export async function saveSessionData(data: {
|
|||||||
sessionId,
|
sessionId,
|
||||||
key: a.key,
|
key: a.key,
|
||||||
stringValue:
|
stringValue:
|
||||||
a.dynamicDataType === DATA_TYPE.string ||
|
a.dynamicDataType === DATA_TYPE.number ? parseFloat(a.value).toFixed(4) : a.value.toString(),
|
||||||
a.dynamicDataType === DATA_TYPE.boolean ||
|
numberValue: a.dynamicDataType === DATA_TYPE.number ? a.value : null,
|
||||||
a.dynamicDataType === DATA_TYPE.array
|
|
||||||
? a.value
|
|
||||||
: null,
|
|
||||||
numericValue: a.dynamicDataType === DATA_TYPE.number ? a.value : null,
|
|
||||||
dateValue: a.dynamicDataType === DATA_TYPE.date ? new Date(a.value) : null,
|
dateValue: a.dynamicDataType === DATA_TYPE.date ? new Date(a.value) : null,
|
||||||
dataType: a.dynamicDataType,
|
dataType: a.dynamicDataType,
|
||||||
}));
|
}));
|
||||||
|
@ -8048,13 +8048,20 @@ semver@^6.0.0, semver@^6.1.1, semver@^6.1.2, semver@^6.3.0:
|
|||||||
resolved "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz"
|
resolved "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz"
|
||||||
integrity sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==
|
integrity sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==
|
||||||
|
|
||||||
semver@^7.3.4, semver@^7.3.5, semver@^7.3.6, semver@^7.3.7, semver@^7.3.8:
|
semver@^7.3.4, semver@^7.3.5, semver@^7.3.7, semver@^7.3.8:
|
||||||
version "7.5.2"
|
version "7.5.2"
|
||||||
resolved "https://registry.npmjs.org/semver/-/semver-7.5.2.tgz"
|
resolved "https://registry.npmjs.org/semver/-/semver-7.5.2.tgz"
|
||||||
integrity sha512-SoftuTROv/cRjCze/scjGyiDtcUyxw1rgYQSZY7XTmtR5hX+dm76iDbTH8TkLPHCQmlbQVSSbNZCPM2hb0knnQ==
|
integrity sha512-SoftuTROv/cRjCze/scjGyiDtcUyxw1rgYQSZY7XTmtR5hX+dm76iDbTH8TkLPHCQmlbQVSSbNZCPM2hb0knnQ==
|
||||||
dependencies:
|
dependencies:
|
||||||
lru-cache "^6.0.0"
|
lru-cache "^6.0.0"
|
||||||
|
|
||||||
|
semver@^7.5.2:
|
||||||
|
version "7.5.4"
|
||||||
|
resolved "https://registry.yarnpkg.com/semver/-/semver-7.5.4.tgz#483986ec4ed38e1c6c48c34894a9182dbff68a6e"
|
||||||
|
integrity sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==
|
||||||
|
dependencies:
|
||||||
|
lru-cache "^6.0.0"
|
||||||
|
|
||||||
serialize-javascript@^4.0.0:
|
serialize-javascript@^4.0.0:
|
||||||
version "4.0.0"
|
version "4.0.0"
|
||||||
resolved "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-4.0.0.tgz"
|
resolved "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-4.0.0.tgz"
|
||||||
|
Loading…
Reference in New Issue
Block a user