mirror of
https://github.com/Unleash/unleash.git
synced 2025-09-10 17:53:36 +02:00
feat: add impression data column
This commit is contained in:
parent
26f66c4f93
commit
861ec548ba
@ -206,6 +206,7 @@ class FeatureStrategiesStore implements IFeatureStrategiesStore {
|
|||||||
'features.project as project',
|
'features.project as project',
|
||||||
'features.stale as stale',
|
'features.stale as stale',
|
||||||
'features.variants as variants',
|
'features.variants as variants',
|
||||||
|
'features.impression_data as impression_data',
|
||||||
'features.created_at as created_at',
|
'features.created_at as created_at',
|
||||||
'features.last_seen_at as last_seen_at',
|
'features.last_seen_at as last_seen_at',
|
||||||
'feature_environments.enabled as enabled',
|
'feature_environments.enabled as enabled',
|
||||||
@ -249,6 +250,7 @@ class FeatureStrategiesStore implements IFeatureStrategiesStore {
|
|||||||
acc.environments = {};
|
acc.environments = {};
|
||||||
}
|
}
|
||||||
acc.name = r.name;
|
acc.name = r.name;
|
||||||
|
acc.impressionData = r.impression_data;
|
||||||
acc.description = r.description;
|
acc.description = r.description;
|
||||||
acc.project = r.project;
|
acc.project = r.project;
|
||||||
acc.stale = r.stale;
|
acc.stale = r.stale;
|
||||||
|
@ -15,6 +15,7 @@ const FEATURE_COLUMNS = [
|
|||||||
'stale',
|
'stale',
|
||||||
'variants',
|
'variants',
|
||||||
'created_at',
|
'created_at',
|
||||||
|
'impression_data',
|
||||||
'last_seen_at',
|
'last_seen_at',
|
||||||
];
|
];
|
||||||
|
|
||||||
@ -27,6 +28,7 @@ export interface FeaturesTable {
|
|||||||
project: string;
|
project: string;
|
||||||
last_seen_at?: Date;
|
last_seen_at?: Date;
|
||||||
created_at?: Date;
|
created_at?: Date;
|
||||||
|
impression_data: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
const TABLE = 'features';
|
const TABLE = 'features';
|
||||||
@ -166,6 +168,7 @@ export default class FeatureToggleStore implements IFeatureToggleStore {
|
|||||||
variants: sortedVariants,
|
variants: sortedVariants,
|
||||||
createdAt: row.created_at,
|
createdAt: row.created_at,
|
||||||
lastSeenAt: row.last_seen_at,
|
lastSeenAt: row.last_seen_at,
|
||||||
|
impressionData: row.impression_data,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -188,6 +191,7 @@ export default class FeatureToggleStore implements IFeatureToggleStore {
|
|||||||
archived: data.archived || false,
|
archived: data.archived || false,
|
||||||
stale: data.stale,
|
stale: data.stale,
|
||||||
created_at: data.createdAt,
|
created_at: data.createdAt,
|
||||||
|
impression_data: data.impressionData,
|
||||||
};
|
};
|
||||||
if (!row.created_at) {
|
if (!row.created_at) {
|
||||||
delete row.created_at;
|
delete row.created_at;
|
||||||
|
@ -56,6 +56,7 @@ export const featureMetadataSchema = joi
|
|||||||
archived: joi.boolean().default(false),
|
archived: joi.boolean().default(false),
|
||||||
type: joi.string().default('release'),
|
type: joi.string().default('release'),
|
||||||
description: joi.string().allow('').allow(null).optional(),
|
description: joi.string().allow('').allow(null).optional(),
|
||||||
|
impressionData: joi.boolean().allow(true).allow(false).optional(),
|
||||||
createdAt: joi.date().optional().allow(null),
|
createdAt: joi.date().optional().allow(null),
|
||||||
})
|
})
|
||||||
.options({ allowUnknown: false, stripUnknown: true, abortEarly: false });
|
.options({ allowUnknown: false, stripUnknown: true, abortEarly: false });
|
||||||
@ -70,6 +71,7 @@ export const featureSchema = joi
|
|||||||
type: joi.string().default('release'),
|
type: joi.string().default('release'),
|
||||||
project: joi.string().default('default'),
|
project: joi.string().default('default'),
|
||||||
description: joi.string().allow('').allow(null).optional(),
|
description: joi.string().allow('').allow(null).optional(),
|
||||||
|
impressionData: joi.boolean().allow(true).allow(false).optional(),
|
||||||
strategies: joi
|
strategies: joi
|
||||||
.array()
|
.array()
|
||||||
.min(0)
|
.min(0)
|
||||||
|
@ -38,6 +38,7 @@ export interface FeatureToggleDTO {
|
|||||||
stale?: boolean;
|
stale?: boolean;
|
||||||
archived?: boolean;
|
archived?: boolean;
|
||||||
createdAt?: Date;
|
createdAt?: Date;
|
||||||
|
impressionData?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface FeatureToggle extends FeatureToggleDTO {
|
export interface FeatureToggle extends FeatureToggleDTO {
|
||||||
|
@ -0,0 +1,19 @@
|
|||||||
|
'use strict';
|
||||||
|
|
||||||
|
exports.up = function (db, cb) {
|
||||||
|
db.runSql(
|
||||||
|
`
|
||||||
|
ALTER TABLE features ADD COLUMN "impression_data" BOOLEAN DEFAULT FALSE;
|
||||||
|
`,
|
||||||
|
cb,
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.down = function (db, cb) {
|
||||||
|
db.runSql(
|
||||||
|
`
|
||||||
|
ALTER TABLE features DROP COLUMN "impression_data";
|
||||||
|
`,
|
||||||
|
cb,
|
||||||
|
);
|
||||||
|
};
|
@ -12,7 +12,7 @@ process.nextTick(async () => {
|
|||||||
password: 'passord',
|
password: 'passord',
|
||||||
host: 'localhost',
|
host: 'localhost',
|
||||||
port: 5432,
|
port: 5432,
|
||||||
database: 'unleash',
|
database: 'rbacmigration',
|
||||||
ssl: false,
|
ssl: false,
|
||||||
},
|
},
|
||||||
server: {
|
server: {
|
||||||
|
Loading…
Reference in New Issue
Block a user