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:
parent
f4f258ab81
commit
99e4a564d0
25
src/migrations/20240821141555-segment-no-project-cleanup.js
Normal file
25
src/migrations/20240821141555-segment-no-project-cleanup.js
Normal 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,
|
||||||
|
);
|
||||||
|
};
|
Loading…
Reference in New Issue
Block a user