Skip to content

Commit

Permalink
chore: remove unused clone code (#7529)
Browse files Browse the repository at this point in the history
Removing this code, because variants per env are GA and I did not find
any usage of it.
  • Loading branch information
sjaanus authored Jul 3, 2024
1 parent 990ea1f commit 08533d7
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 46 deletions.
35 changes: 0 additions & 35 deletions src/lib/db/feature-environment-store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -303,41 +303,6 @@ export class FeatureEnvironmentStore implements IFeatureEnvironmentStore {
.del();
}

// TODO: remove this once variants per env are GA
async clonePreviousVariants(
environment: string,
project: string,
): Promise<void> {
const rows = await this.db(`${T.features} as f`)
.select([
this.db.raw(`'${environment}' as environment`),
'fe.enabled',
'fe.feature_name',
'fe.variants',
])
.distinctOn(['environment', 'feature_name'])
.join(`${T.featureEnvs} as fe`, 'f.name', 'fe.feature_name')
.whereNot({ environment })
.andWhere({ project });

const newRows = rows.map((row) => {
const r = row as any as IFeatureEnvironmentRow;
return {
variants: JSON.stringify(r.variants),
enabled: r.enabled,
environment: r.environment,
feature_name: r.feature_name,
};
});

if (newRows.length > 0) {
await this.db(T.featureEnvs)
.insert(newRows)
.onConflict(['environment', 'feature_name'])
.merge(['variants']);
}
}

async connectFeatureToEnvironmentsForProject(
featureName: string,
projectId: string,
Expand Down
2 changes: 0 additions & 2 deletions src/lib/types/stores/feature-environment-store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,5 @@ export interface IFeatureEnvironmentStore
featureEnvironment: IFeatureEnvironment,
): Promise<void>;

clonePreviousVariants(environment: string, project: string): Promise<void>;

variantExists(featureName: string): Promise<boolean>;
}
9 changes: 0 additions & 9 deletions src/test/fixtures/fake-feature-environment-store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -224,15 +224,6 @@ export default class FakeFeatureEnvironmentStore
throw new Error('Method not implemented.');
}

clonePreviousVariants(
// eslint-disable-next-line @typescript-eslint/no-unused-vars
environment: string,
// eslint-disable-next-line @typescript-eslint/no-unused-vars
project: string,
): Promise<void> {
throw new Error('Method not implemented.');
}

async getAllByFeatures(
// eslint-disable-next-line @typescript-eslint/no-unused-vars
features: string[],
Expand Down

0 comments on commit 08533d7

Please sign in to comment.