Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions mysql_ch_replicator/converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -448,13 +448,13 @@ def convert_alter_query(self, mysql_query, db_name):
tokens = tokens[1:]

if op_name == 'add':
if tokens[0].lower() in ('constraint', 'index', 'foreign'):
if tokens[0].lower() in ('constraint', 'index', 'foreign', 'unique'):
continue
self.__convert_alter_table_add_column(db_name, table_name, tokens)
continue

if op_name == 'drop':
if tokens[0].lower() in ('constraint', 'index', 'foreign'):
if tokens[0].lower() in ('constraint', 'index', 'foreign', 'unique'):
continue
self.__convert_alter_table_drop_column(db_name, table_name, tokens)
continue
Expand Down
3 changes: 3 additions & 0 deletions test_mysql_ch_replicator.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,9 @@ def test_e2e_regular(config_file):
mysql.execute(f"ALTER TABLE `{TEST_TABLE_NAME}` ADD `last_name` varchar(255); ")
mysql.execute(f"ALTER TABLE `{TEST_TABLE_NAME}` ADD `price` decimal(10,2) DEFAULT NULL; ")

mysql.execute(f"ALTER TABLE `{TEST_TABLE_NAME}` ADD UNIQUE INDEX prise_idx (price)")
mysql.execute(f"ALTER TABLE `{TEST_TABLE_NAME}` DROP INDEX prise_idx, ADD UNIQUE INDEX age_idx (age)")

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)
Expand Down