chore(*): remove unused code (#6781)

The code removed in the PR was flagged as unused by the JetBrains
inspector.

I did a QA on the dev environment but other checks are highly
recommended.

There is one commit by scope to make the review easier.

---------

Co-authored-by: Charles Bochet <charles@twenty.com>
This commit is contained in:
Antoine Moreaux
2024-08-29 18:16:50 +02:00
committed by GitHub
parent ebfdc6cfd2
commit cd06ae20e8
86 changed files with 97 additions and 575 deletions

View File

@ -20,7 +20,7 @@ export abstract class AbstractWorkspaceFixer<
> {
private issueTypes: IssueTypes[];
constructor(...issueTypes: IssueTypes[]) {
protected constructor(...issueTypes: IssueTypes[]) {
this.issueTypes = issueTypes;
}

View File

@ -112,13 +112,12 @@ export class WorkspaceDefaultValueFixer extends AbstractWorkspaceFixer<Workspace
for (const issue of issues) {
const currentDefaultValue:
| FieldMetadataDefaultValue<'default'>
| FieldMetadataDefaultValue
// Old format for default values
// TODO: Remove this after all workspaces are migrated
| { type: FieldMetadataDefaultValueFunctionNames }
| null = issue.fieldMetadata.defaultValue;
let alteredDefaultValue: FieldMetadataDefaultValue<'default'> | null =
null;
let alteredDefaultValue: FieldMetadataDefaultValue | null = null;
// Check if it's an old function default value
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
@ -189,7 +188,7 @@ export class WorkspaceDefaultValueFixer extends AbstractWorkspaceFixer<Workspace
private computeFieldMetadataDefaultValueFromColumnDefault(
columnDefault: string | undefined,
): FieldMetadataDefaultValue<'default'> {
): FieldMetadataDefaultValue {
if (
columnDefault === undefined ||
columnDefault === null ||

View File

@ -151,24 +151,6 @@ export class DatabaseStructureService {
}));
}
async workspaceColumnExist(
schemaName: string,
tableName: string,
columnName: string,
): Promise<boolean> {
const mainDataSource = this.typeORMService.getMainDataSource();
const results = await mainDataSource.query(
`SELECT column_name
FROM information_schema.columns
WHERE table_schema = $1
AND table_name = $2
AND column_name = $3`,
[schemaName, tableName, columnName],
);
return results.length >= 1;
}
getPostgresDataTypes(fieldMetadata: FieldMetadataEntity): string[] {
const mainDataSource = this.typeORMService.getMainDataSource();