mirror of
https://github.com/Unleash/unleash.git
synced 2025-09-05 17:53:12 +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.stale as stale',
|
||||
'features.variants as variants',
|
||||
'features.impression_data as impression_data',
|
||||
'features.created_at as created_at',
|
||||
'features.last_seen_at as last_seen_at',
|
||||
'feature_environments.enabled as enabled',
|
||||
@ -249,6 +250,7 @@ class FeatureStrategiesStore implements IFeatureStrategiesStore {
|
||||
acc.environments = {};
|
||||
}
|
||||
acc.name = r.name;
|
||||
acc.impressionData = r.impression_data;
|
||||
acc.description = r.description;
|
||||
acc.project = r.project;
|
||||
acc.stale = r.stale;
|
||||
|
@ -15,6 +15,7 @@ const FEATURE_COLUMNS = [
|
||||
'stale',
|
||||
'variants',
|
||||
'created_at',
|
||||
'impression_data',
|
||||
'last_seen_at',
|
||||
];
|
||||
|
||||
@ -27,6 +28,7 @@ export interface FeaturesTable {
|
||||
project: string;
|
||||
last_seen_at?: Date;
|
||||
created_at?: Date;
|
||||
impression_data: boolean;
|
||||
}
|
||||
|
||||
const TABLE = 'features';
|
||||
@ -166,6 +168,7 @@ export default class FeatureToggleStore implements IFeatureToggleStore {
|
||||
variants: sortedVariants,
|
||||
createdAt: row.created_at,
|
||||
lastSeenAt: row.last_seen_at,
|
||||
impressionData: row.impression_data,
|
||||
};
|
||||
}
|
||||
|
||||
@ -188,6 +191,7 @@ export default class FeatureToggleStore implements IFeatureToggleStore {
|
||||
archived: data.archived || false,
|
||||
stale: data.stale,
|
||||
created_at: data.createdAt,
|
||||
impression_data: data.impressionData,
|
||||
};
|
||||
if (!row.created_at) {
|
||||
delete row.created_at;
|
||||
|
@ -56,6 +56,7 @@ export const featureMetadataSchema = joi
|
||||
archived: joi.boolean().default(false),
|
||||
type: joi.string().default('release'),
|
||||
description: joi.string().allow('').allow(null).optional(),
|
||||
impressionData: joi.boolean().allow(true).allow(false).optional(),
|
||||
createdAt: joi.date().optional().allow(null),
|
||||
})
|
||||
.options({ allowUnknown: false, stripUnknown: true, abortEarly: false });
|
||||
@ -70,6 +71,7 @@ export const featureSchema = joi
|
||||
type: joi.string().default('release'),
|
||||
project: joi.string().default('default'),
|
||||
description: joi.string().allow('').allow(null).optional(),
|
||||
impressionData: joi.boolean().allow(true).allow(false).optional(),
|
||||
strategies: joi
|
||||
.array()
|
||||
.min(0)
|
||||
|
@ -38,6 +38,7 @@ export interface FeatureToggleDTO {
|
||||
stale?: boolean;
|
||||
archived?: boolean;
|
||||
createdAt?: Date;
|
||||
impressionData?: boolean;
|
||||
}
|
||||
|
||||
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',
|
||||
host: 'localhost',
|
||||
port: 5432,
|
||||
database: 'unleash',
|
||||
database: 'rbacmigration',
|
||||
ssl: false,
|
||||
},
|
||||
server: {
|
||||
|
Loading…
Reference in New Issue
Block a user