Skip to content

Commit dd43c67

Browse files
committed
fix: comments from PR, use whereIn instead of boolean field
1 parent 04f0c9f commit dd43c67

File tree

4 files changed

+17
-22
lines changed

4 files changed

+17
-22
lines changed

src/lib/db/feature-environment-store.ts

+5-1
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,11 @@ export class FeatureEnvironmentStore implements IFeatureEnvironmentStore {
112112
'=',
113113
`${T.featureEnvs}.environment`,
114114
)
115-
.where('environments.enabled_in_oss', true);
115+
.whereIn('environments.name', [
116+
'default',
117+
'development',
118+
'production',
119+
]);
116120
}
117121
return queryBuilder;
118122
}

src/lib/features/client-feature-toggles/client-feature-toggle-service.ts

-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ export class ClientFeatureToggleService {
2727
this.logger = getLogger('services/client-feature-toggle-service.ts');
2828
this.segmentReadModel = segmentReadModel;
2929
this.clientFeatureToggleStore = clientFeatureToggleStore;
30-
const isTest = process.env.NODE_ENV === 'test';
3130
}
3231

3332
async getActiveSegmentsForClient() {

src/lib/features/project-environments/environment-store.ts

+12-4
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,11 @@ export default class EnvironmentStore implements IEnvironmentStore {
158158
const stopTimer = this.timer('get');
159159
let keyQuery = this.db<IEnvironmentsTable>(TABLE).where({ name: key });
160160
if (this.isOss) {
161-
keyQuery = keyQuery.where('enabled_in_oss', true);
161+
keyQuery = keyQuery.whereIn('name', [
162+
'default',
163+
'development',
164+
'production',
165+
]);
162166
}
163167
const row = await keyQuery.first();
164168
stopTimer();
@@ -180,7 +184,7 @@ export default class EnvironmentStore implements IEnvironmentStore {
180184
qB = qB.where(query);
181185
}
182186
if (this.isOss) {
183-
qB = qB.where('enabled_in_oss', true);
187+
qB = qB.whereIn('name', ['default', 'development', 'production']);
184188
}
185189
const rows = await qB;
186190
stopTimer();
@@ -210,7 +214,7 @@ export default class EnvironmentStore implements IEnvironmentStore {
210214
qB = qB.where(query);
211215
}
212216
if (this.isOss) {
213-
qB = qB.where('enabled_in_oss', true);
217+
qB = qB.whereIn('name', ['default', 'development', 'production']);
214218
}
215219
const rows = await qB;
216220
stopTimer();
@@ -247,7 +251,11 @@ export default class EnvironmentStore implements IEnvironmentStore {
247251
qB = qB.where(query);
248252
}
249253
if (this.isOss) {
250-
qB = qB.where('environments.enabled_in_oss', true);
254+
qB = qB.whereIn('environments.name', [
255+
'default',
256+
'production',
257+
'development',
258+
]);
251259
}
252260

253261
const rows = await qB;

src/migrations/20241125115848-add-enabled-in-oss-to-project-and-environment.js

-16
This file was deleted.

0 commit comments

Comments
 (0)