mirror of
https://github.com/Unleash/unleash.git
synced 2025-09-10 17:53:36 +02:00
Revert "Add changeRequestEnabled to project and project_environments (#2357)"
This reverts commit 47a617c78b
.
This commit is contained in:
parent
0649262c70
commit
a908c85e7b
@ -21,14 +21,12 @@ const COLUMNS = [
|
|||||||
'created_at',
|
'created_at',
|
||||||
'health',
|
'health',
|
||||||
'updated_at',
|
'updated_at',
|
||||||
'change_request_enabled',
|
|
||||||
];
|
];
|
||||||
const TABLE = 'projects';
|
const TABLE = 'projects';
|
||||||
|
|
||||||
export interface IEnvironmentProjectLink {
|
export interface IEnvironmentProjectLink {
|
||||||
environmentName: string;
|
environmentName: string;
|
||||||
projectId: string;
|
projectId: string;
|
||||||
changeRequestsEnabled?: string;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IProjectMembersCount {
|
export interface IProjectMembersCount {
|
||||||
@ -80,7 +78,7 @@ class ProjectStore implements IProjectStore {
|
|||||||
let projects = this.db(TABLE)
|
let projects = this.db(TABLE)
|
||||||
.select(
|
.select(
|
||||||
this.db.raw(
|
this.db.raw(
|
||||||
'projects.id, projects.name, projects.description, projects.health, projects.updated_at, projects.change_request_enabled, count(features.name) AS number_of_features',
|
'projects.id, projects.name, projects.description, projects.health, projects.updated_at, count(features.name) AS number_of_features',
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
.leftJoin('features', 'features.project', 'projects.id')
|
.leftJoin('features', 'features.project', 'projects.id')
|
||||||
@ -117,7 +115,6 @@ class ProjectStore implements IProjectStore {
|
|||||||
featureCount: Number(row.number_of_features) || 0,
|
featureCount: Number(row.number_of_features) || 0,
|
||||||
memberCount: Number(row.number_of_users) || 0,
|
memberCount: Number(row.number_of_users) || 0,
|
||||||
updatedAt: row.updated_at,
|
updatedAt: row.updated_at,
|
||||||
changeRequestsEnabled: row.change_request_enabled || false,
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -199,7 +196,6 @@ class ProjectStore implements IProjectStore {
|
|||||||
const environments = projects.map((p) => ({
|
const environments = projects.map((p) => ({
|
||||||
project_id: p.id,
|
project_id: p.id,
|
||||||
environment_name: DEFAULT_ENV,
|
environment_name: DEFAULT_ENV,
|
||||||
change_request_enabled: p.change_request_enabled,
|
|
||||||
}));
|
}));
|
||||||
await this.db('project_environments')
|
await this.db('project_environments')
|
||||||
.insert(environments)
|
.insert(environments)
|
||||||
@ -244,13 +240,8 @@ class ProjectStore implements IProjectStore {
|
|||||||
id: string,
|
id: string,
|
||||||
environment: string,
|
environment: string,
|
||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
const project = await this.get(id);
|
|
||||||
await this.db('project_environments')
|
await this.db('project_environments')
|
||||||
.insert({
|
.insert({ project_id: id, environment_name: environment })
|
||||||
project_id: id,
|
|
||||||
environment_name: environment,
|
|
||||||
change_request_enabled: project.changeRequestsEnabled,
|
|
||||||
})
|
|
||||||
.onConflict(['project_id', 'environment_name'])
|
.onConflict(['project_id', 'environment_name'])
|
||||||
.ignore();
|
.ignore();
|
||||||
}
|
}
|
||||||
@ -259,12 +250,10 @@ class ProjectStore implements IProjectStore {
|
|||||||
environment: string,
|
environment: string,
|
||||||
projects: string[],
|
projects: string[],
|
||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
const rows = projects.map(async (projectId) => {
|
const rows = projects.map((project) => {
|
||||||
const project = await this.get(projectId);
|
|
||||||
return {
|
return {
|
||||||
project_id: projectId,
|
project_id: project,
|
||||||
environment_name: environment,
|
environment_name: environment,
|
||||||
change_request_enabled: project.changeRequestsEnabled || false,
|
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -381,7 +370,6 @@ class ProjectStore implements IProjectStore {
|
|||||||
return {
|
return {
|
||||||
environmentName: row.environment_name,
|
environmentName: row.environment_name,
|
||||||
projectId: row.project_id,
|
projectId: row.project_id,
|
||||||
changeRequestsEnabled: row.change_request_enabled,
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -398,7 +386,6 @@ class ProjectStore implements IProjectStore {
|
|||||||
createdAt: row.created_at,
|
createdAt: row.created_at,
|
||||||
health: row.health || 100,
|
health: row.health || 100,
|
||||||
updatedAt: row.updated_at || new Date(),
|
updatedAt: row.updated_at || new Date(),
|
||||||
changeRequestsEnabled: row.change_request_enabled || false,
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,9 +9,6 @@ export const projectEnvironmentSchema = {
|
|||||||
environment: {
|
environment: {
|
||||||
type: 'string',
|
type: 'string',
|
||||||
},
|
},
|
||||||
changeRequestsEnabled: {
|
|
||||||
type: 'boolean',
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
components: {},
|
components: {},
|
||||||
} as const;
|
} as const;
|
||||||
|
@ -10,22 +10,6 @@ test('projectSchema', () => {
|
|||||||
featureCount: 10,
|
featureCount: 10,
|
||||||
memberCount: 3,
|
memberCount: 3,
|
||||||
updatedAt: '2022-06-28T17:33:53.963Z',
|
updatedAt: '2022-06-28T17:33:53.963Z',
|
||||||
changeRequestsEnabled: false,
|
|
||||||
};
|
|
||||||
|
|
||||||
expect(
|
|
||||||
validateSchema('#/components/schemas/projectSchema', {}),
|
|
||||||
).not.toBeUndefined();
|
|
||||||
|
|
||||||
expect(
|
|
||||||
validateSchema('#/components/schemas/projectSchema', data),
|
|
||||||
).toBeUndefined();
|
|
||||||
});
|
|
||||||
|
|
||||||
test('projectSchema with only required', () => {
|
|
||||||
const data: ProjectSchema = {
|
|
||||||
name: 'Default',
|
|
||||||
id: 'default',
|
|
||||||
};
|
};
|
||||||
|
|
||||||
expect(
|
expect(
|
||||||
|
@ -33,9 +33,6 @@ export const projectSchema = {
|
|||||||
format: 'date-time',
|
format: 'date-time',
|
||||||
nullable: true,
|
nullable: true,
|
||||||
},
|
},
|
||||||
changeRequestsEnabled: {
|
|
||||||
type: 'boolean',
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
components: {},
|
components: {},
|
||||||
} as const;
|
} as const;
|
||||||
|
@ -345,8 +345,8 @@ export interface IProject {
|
|||||||
health?: number;
|
health?: number;
|
||||||
createdAt?: Date;
|
createdAt?: Date;
|
||||||
updatedAt?: Date;
|
updatedAt?: Date;
|
||||||
changeRequestsEnabled?: boolean;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ICustomRole {
|
export interface ICustomRole {
|
||||||
id: number;
|
id: number;
|
||||||
name: string;
|
name: string;
|
||||||
|
@ -10,7 +10,6 @@ export interface IProjectInsert {
|
|||||||
name: string;
|
name: string;
|
||||||
description: string;
|
description: string;
|
||||||
updatedAt?: Date;
|
updatedAt?: Date;
|
||||||
changeRequestsEnabled?: boolean;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IProjectArchived {
|
export interface IProjectArchived {
|
||||||
@ -27,11 +26,6 @@ export interface IProjectQuery {
|
|||||||
id?: string;
|
id?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IProjectEnvironmentWithChangeRequests {
|
|
||||||
environment: string;
|
|
||||||
changeRequestsEnabled: boolean;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface IProjectStore extends Store<IProject, string> {
|
export interface IProjectStore extends Store<IProject, string> {
|
||||||
hasProject(id: string): Promise<boolean>;
|
hasProject(id: string): Promise<boolean>;
|
||||||
updateHealth(healthUpdate: IProjectHealthUpdate): Promise<void>;
|
updateHealth(healthUpdate: IProjectHealthUpdate): Promise<void>;
|
||||||
@ -50,11 +44,9 @@ export interface IProjectStore extends Store<IProject, string> {
|
|||||||
getProjectsWithCounts(query?: IProjectQuery): Promise<IProjectWithCount[]>;
|
getProjectsWithCounts(query?: IProjectQuery): Promise<IProjectWithCount[]>;
|
||||||
count(): Promise<number>;
|
count(): Promise<number>;
|
||||||
getAll(query?: IProjectQuery): Promise<IProject[]>;
|
getAll(query?: IProjectQuery): Promise<IProject[]>;
|
||||||
|
|
||||||
getProjectLinksForEnvironments(
|
getProjectLinksForEnvironments(
|
||||||
environments: string[],
|
environments: string[],
|
||||||
): Promise<IEnvironmentProjectLink[]>;
|
): Promise<IEnvironmentProjectLink[]>;
|
||||||
|
|
||||||
addEnvironmentToProjects(
|
addEnvironmentToProjects(
|
||||||
environment: string,
|
environment: string,
|
||||||
projects: string[],
|
projects: string[],
|
||||||
|
@ -1,21 +0,0 @@
|
|||||||
'use strict';
|
|
||||||
|
|
||||||
exports.up = function (db, callback) {
|
|
||||||
db.runSql(
|
|
||||||
`
|
|
||||||
ALTER TABLE project_environments add column if not exists change_request_enabled bool default false;
|
|
||||||
ALTER TABLE projects add column if not exists change_request_enabled bool default false;
|
|
||||||
`,
|
|
||||||
callback,
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
exports.down = function (db, callback) {
|
|
||||||
db.runSql(
|
|
||||||
`
|
|
||||||
ALTER TABLE project_environments drop column if exists change_request_enabled;
|
|
||||||
ALTER TABLE projects drop column if exists change_request_enabled;
|
|
||||||
`,
|
|
||||||
callback,
|
|
||||||
);
|
|
||||||
};
|
|
@ -2255,9 +2255,6 @@ exports[`should serve the OpenAPI spec 1`] = `
|
|||||||
"projectEnvironmentSchema": {
|
"projectEnvironmentSchema": {
|
||||||
"additionalProperties": false,
|
"additionalProperties": false,
|
||||||
"properties": {
|
"properties": {
|
||||||
"changeRequestsEnabled": {
|
|
||||||
"type": "boolean",
|
|
||||||
},
|
|
||||||
"environment": {
|
"environment": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
},
|
},
|
||||||
@ -2270,9 +2267,6 @@ exports[`should serve the OpenAPI spec 1`] = `
|
|||||||
"projectSchema": {
|
"projectSchema": {
|
||||||
"additionalProperties": false,
|
"additionalProperties": false,
|
||||||
"properties": {
|
"properties": {
|
||||||
"changeRequestsEnabled": {
|
|
||||||
"type": "boolean",
|
|
||||||
},
|
|
||||||
"createdAt": {
|
"createdAt": {
|
||||||
"format": "date-time",
|
"format": "date-time",
|
||||||
"type": "string",
|
"type": "string",
|
||||||
|
Loading…
Reference in New Issue
Block a user