diff --git a/mysql_ch_replicator/converter.py b/mysql_ch_replicator/converter.py index a6c6b57..a82f67d 100644 --- a/mysql_ch_replicator/converter.py +++ b/mysql_ch_replicator/converter.py @@ -465,9 +465,6 @@ def __convert_alter_table_add_column(self, db_name, table_name, tokens): if len(tokens) < 2: raise Exception('wrong tokens count', tokens) - if ',' in ' '.join(tokens): - raise Exception('add multiple columns not implemented', tokens) - column_after = None column_first = False if tokens[-2].lower() == 'after': @@ -522,9 +519,6 @@ def __convert_alter_table_add_column(self, db_name, table_name, tokens): self.db_replicator.clickhouse_api.execute_command(query) def __convert_alter_table_drop_column(self, db_name, table_name, tokens): - if ',' in ' '.join(tokens): - raise Exception('add multiple columns not implemented', tokens) - if len(tokens) != 1: raise Exception('wrong tokens count', tokens) @@ -547,9 +541,6 @@ def __convert_alter_table_modify_column(self, db_name, table_name, tokens): if len(tokens) < 2: raise Exception('wrong tokens count', tokens) - if ',' in ' '.join(tokens): - raise Exception('add multiple columns not implemented', tokens) - column_name = strip_sql_name(tokens[0]) column_type_mysql = tokens[1] column_type_mysql_parameters = ' '.join(tokens[2:]) @@ -578,9 +569,6 @@ def __convert_alter_table_change_column(self, db_name, table_name, tokens): if len(tokens) < 3: raise Exception('wrong tokens count', tokens) - if ',' in ' '.join(tokens): - raise Exception('add multiple columns not implemented', tokens) - column_name = strip_sql_name(tokens[0]) new_column_name = strip_sql_name(tokens[1]) column_type_mysql = tokens[2] diff --git a/test_mysql_ch_replicator.py b/test_mysql_ch_replicator.py index 231005a..e54587f 100644 --- a/test_mysql_ch_replicator.py +++ b/test_mysql_ch_replicator.py @@ -135,7 +135,9 @@ def test_e2e_regular(config_file): mysql.execute(f"ALTER TABLE `{TEST_TABLE_NAME}` ADD `last_name` varchar(255); ") - mysql.execute(f"INSERT INTO `{TEST_TABLE_NAME}` (name, age, last_name) VALUES ('Mary', 24, 'Smith');", commit=True) + mysql.execute(f"ALTER TABLE `{TEST_TABLE_NAME}` ADD `price` decimal(10,2) DEFAULT NULL; ") + + mysql.execute(f"INSERT INTO `{TEST_TABLE_NAME}` (name, age, last_name, price) VALUES ('Mary', 24, 'Smith', 3.2);", commit=True) assert_wait(lambda: len(ch.select(TEST_TABLE_NAME)) == 4) assert_wait(lambda: ch.select(TEST_TABLE_NAME, where="name='Mary'")[0]['last_name'] == 'Smith')