mirror of
https://github.com/Unleash/unleash.git
synced 2025-01-20 00:08:02 +01:00
chore: remove archived column from features table (#6431)
This column has not been used for 1.5 years and was replace by **archived_at** column and people still get confused of why this is not working as name suggests. Removing this column to remove technical debt.
This commit is contained in:
parent
15db139f25
commit
ae38b81af1
@ -300,10 +300,11 @@ export default class FeatureToggleStore implements IFeatureToggleStore {
|
|||||||
.count('type')
|
.count('type')
|
||||||
.groupBy('type');
|
.groupBy('type');
|
||||||
|
|
||||||
query.where({
|
query
|
||||||
project: projectId,
|
.where({
|
||||||
archived,
|
project: projectId,
|
||||||
});
|
})
|
||||||
|
.modify(FeatureToggleStore.filterByArchived, archived);
|
||||||
|
|
||||||
const result = await query;
|
const result = await query;
|
||||||
return result.map((row) => ({
|
return result.map((row) => ({
|
||||||
@ -677,7 +678,8 @@ export default class FeatureToggleStore implements IFeatureToggleStore {
|
|||||||
WHERE feature_types.id = features.type) *
|
WHERE feature_types.id = features.type) *
|
||||||
INTERVAL '1 day'))) as current_staleness
|
INTERVAL '1 day'))) as current_staleness
|
||||||
FROM features
|
FROM features
|
||||||
WHERE NOT stale = true AND archived_at IS NULL`,
|
WHERE NOT stale = true
|
||||||
|
AND archived_at IS NULL`,
|
||||||
[currentTime || this.db.fn.now()],
|
[currentTime || this.db.fn.now()],
|
||||||
);
|
);
|
||||||
|
|
||||||
|
17
src/migrations/20240305094305-features-remove-archived.js
Normal file
17
src/migrations/20240305094305-features-remove-archived.js
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
exports.up = function (db, cb) {
|
||||||
|
db.runSql(
|
||||||
|
`
|
||||||
|
ALTER TABLE features DROP COLUMN IF EXISTS archived;
|
||||||
|
`,
|
||||||
|
cb,
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.down = function (db, cb) {
|
||||||
|
db.runSql(
|
||||||
|
`
|
||||||
|
ALTER TABLE features ADD COLUMN IF NOT EXISTS archived BOOLEAN DEFAULT FALSE;
|
||||||
|
`,
|
||||||
|
cb,
|
||||||
|
);
|
||||||
|
};
|
@ -2070,19 +2070,15 @@ test('should get correct amount of features archived in current and past window'
|
|||||||
await Promise.all([
|
await Promise.all([
|
||||||
updateFeature(toggles[0].name, {
|
updateFeature(toggles[0].name, {
|
||||||
archived_at: new Date(),
|
archived_at: new Date(),
|
||||||
archived: true,
|
|
||||||
}),
|
}),
|
||||||
updateFeature(toggles[1].name, {
|
updateFeature(toggles[1].name, {
|
||||||
archived_at: new Date(),
|
archived_at: new Date(),
|
||||||
archived: true,
|
|
||||||
}),
|
}),
|
||||||
updateFeature(toggles[2].name, {
|
updateFeature(toggles[2].name, {
|
||||||
archived_at: subDays(new Date(), 31),
|
archived_at: subDays(new Date(), 31),
|
||||||
archived: true,
|
|
||||||
}),
|
}),
|
||||||
updateFeature(toggles[3].name, {
|
updateFeature(toggles[3].name, {
|
||||||
archived_at: subDays(new Date(), 31),
|
archived_at: subDays(new Date(), 31),
|
||||||
archived: true,
|
|
||||||
}),
|
}),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user