( tableName: string, columnNames: string[], isClustered: boolean, )
| 155 | * Generates ALTER TABLE statements for dropping columns |
| 156 | */ |
| 157 | export function dropColumns( |
| 158 | tableName: string, |
| 159 | columnNames: string[], |
| 160 | isClustered: boolean, |
| 161 | ): string[] { |
| 162 | if (isClustered) { |
| 163 | return columnNames.flatMap((colName) => [ |
| 164 | `ALTER TABLE ${replicated(tableName)} ON CLUSTER '{cluster}' DROP COLUMN IF EXISTS ${colName}`, |
| 165 | `ALTER TABLE ${tableName} ON CLUSTER '{cluster}' DROP COLUMN IF EXISTS ${colName}`, |
| 166 | ]); |
| 167 | } |
| 168 | |
| 169 | return columnNames.map( |
| 170 | (colName) => `ALTER TABLE ${tableName} DROP COLUMN IF EXISTS ${colName}`, |
| 171 | ); |
| 172 | } |
| 173 | |
| 174 | export async function getExistingTables() { |
| 175 | try { |
nothing calls this directly
no test coverage detected