MCPcopy Create free account
hub / github.com/Openpanel-dev/openpanel / dropColumns

Function dropColumns

packages/db/src/clickhouse/migration.ts:157–172  ·  view source on GitHub ↗
(
  tableName: string,
  columnNames: string[],
  isClustered: boolean,
)

Source from the content-addressed store, hash-verified

155 * Generates ALTER TABLE statements for dropping columns
156 */
157export 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
174export async function getExistingTables() {
175 try {

Callers

nothing calls this directly

Calls 2

replicatedFunction · 0.70
mapMethod · 0.45

Tested by

no test coverage detected