clickhouse + mysql: modify table option

This commit is contained in:
Jan Prochazka
2024-09-11 15:09:16 +02:00
parent 7ad1950777
commit fb39cd1302
12 changed files with 88 additions and 21 deletions

View File

@@ -97,6 +97,13 @@ interface AlterOperation_FillPreloadedRows {
autoIncrementColumn: string;
}
interface AlterOperation_SetTableOption {
operationType: 'setTableOption';
table: TableInfo;
optionName: string;
optionValue: string;
}
type AlterOperation =
| AlterOperation_CreateColumn
| AlterOperation_ChangeColumn
@@ -112,7 +119,8 @@ type AlterOperation =
| AlterOperation_CreateSqlObject
| AlterOperation_DropSqlObject
| AlterOperation_RecreateTable
| AlterOperation_FillPreloadedRows;
| AlterOperation_FillPreloadedRows
| AlterOperation_SetTableOption;
export class AlterPlan {
recreates = {
@@ -253,6 +261,15 @@ export class AlterPlan {
});
}
setTableOption(table: TableInfo, optionName: string, optionValue: string) {
this.operations.push({
operationType: 'setTableOption',
table,
optionName,
optionValue,
});
}
run(processor: AlterProcessor) {
for (const op of this.operations) {
runAlterOperation(op, processor);
@@ -575,6 +592,9 @@ export function runAlterOperation(op: AlterOperation, processor: AlterProcessor)
case 'dropSqlObject':
processor.dropSqlObject(op.oldObject);
break;
case 'setTableOption':
processor.setTableOption(op.table, op.optionName, op.optionValue);
break;
case 'fillPreloadedRows':
processor.fillPreloadedRows(op.table, op.oldRows, op.newRows, op.key, op.insertOnly, op.autoIncrementColumn);
break;