1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-02-23 00:22:19 +01:00

fix: fix events with no-project projects (#7951)

Fixes issue where `segment-created `events had fake project name
**no-project** attached.

In total for previous 4 months, all segments created that were global
segments, have this issue.


https://github.com/Unleash/unleash/pull/6872/files#diff-68dcd43b31d35a8a80c73bca1f2a9626b0234dd0b76920a6881b81fa04708268R135
This commit is contained in:
Jaanus Sellin 2024-08-21 15:32:37 +03:00 committed by GitHub
parent f4f258ab81
commit 99e4a564d0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -0,0 +1,25 @@
'use strict';
exports.up = function (db, callback) {
db.runSql(
`
UPDATE events
SET project = NULL
WHERE type = 'segment-created'
AND project = 'no-project'
AND NOT EXISTS (
SELECT 1
FROM projects
WHERE name = 'no-project'
);
`,
callback,
);
};
exports.down = function (db, callback) {
db.runSql(
``,
callback,
);
};