feat(postgres): add cascade table drop option
This commit is contained in:
1 parent
8539011f25
commit
745f7f60b0
12 files changed
+155
-28
No files matched your search
@@ -12,6 +12,7 @@ export interface TableAdminSqlOptions {
|
||||
databaseType?: DatabaseType;
|
||||
schema?: string | null;
|
||||
tableName: string;
|
||||
cascade?: boolean;
|
||||
}
|
||||
|
||||
export type TableChildObjectType = "COLUMN" | "INDEX" | "FOREIGN_KEY" | "TRIGGER";
|
||||
@@ -85,6 +86,12 @@ export function buildTruncateTableSql(options: TableAdminSqlOptions): Promise<st
|
||||
return api.buildTruncateTableSql(options);
|
||||
}
|
||||
|
||||
const DROP_TABLE_CASCADE_DATABASE_TYPES: readonly DatabaseType[] = ["postgres", "redshift", "gaussdb", "kwdb", "kingbase", "highgo", "vastbase", "opengauss"];
|
||||
|
||||
export function supportsDropTableCascade(databaseType?: DatabaseType): boolean {
|
||||
return !!databaseType && DROP_TABLE_CASCADE_DATABASE_TYPES.includes(databaseType);
|
||||
}
|
||||
|
||||
export function buildDropDatabaseSql(options: DatabaseNameSqlOptions): Promise<string> {
|
||||
return api.buildDropDatabaseSql(options);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user