skip analysis of generated column data type in unique key

Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>
This commit is contained in:
Shlomi Noach 2021-01-19 13:42:45 +02:00
parent 7202076c77
commit b7b3bfbd34
2 changed files with 14 additions and 10 deletions

View File

@ -188,6 +188,10 @@ func (this *Inspector) inspectOriginalAndGhostTables() (err error) {
}
for _, column := range this.migrationContext.UniqueKey.Columns.Columns() {
if this.migrationContext.GhostTableVirtualColumns.GetColumn(column.Name) != nil {
// this is a virtual column
continue
}
if this.migrationContext.MappedSharedColumns.HasTimezoneConversion(column.Name) {
return fmt.Errorf("No support at this time for converting a column from DATETIME to TIMESTAMP that is also part of the chosen unique key. Column: %s, key: %s", column.Name, this.migrationContext.UniqueKey.Name)
}

View File

@ -6,8 +6,8 @@ create table gh_ost_test (
PRIMARY KEY (`id`,`idb`)
) auto_increment=1;
insert into gh_ost_test (id, jsonobj) values (null, ''{"_id":2}'');
insert into gh_ost_test (id, jsonobj) values (null, ''{"_id":3}'');
insert into gh_ost_test (id, jsonobj) values (null, '{"_id":2}');
insert into gh_ost_test (id, jsonobj) values (null, '{"_id":3}');
drop event if exists gh_ost_test;
delimiter ;;
@ -19,12 +19,12 @@ create event gh_ost_test
enable
do
begin
insert into gh_ost_test (id, jsonobj) values (null, ''{"_id":5}'');
insert into gh_ost_test (id, jsonobj) values (null, ''{"_id":7}'');
insert into gh_ost_test (id, jsonobj) values (null, ''{"_id":11}'');
insert into gh_ost_test (id, jsonobj) values (null, ''{"_id":13}'');
insert into gh_ost_test (id, jsonobj) values (null, ''{"_id":17}'');
insert into gh_ost_test (id, jsonobj) values (null, ''{"_id":19}'');
insert into gh_ost_test (id, jsonobj) values (null, ''{"_id":23}'');
insert into gh_ost_test (id, jsonobj) values (null, ''{"_id":27}'');
insert into gh_ost_test (id, jsonobj) values (null, '{"_id":5}');
insert into gh_ost_test (id, jsonobj) values (null, '{"_id":7}');
insert into gh_ost_test (id, jsonobj) values (null, '{"_id":11}');
insert into gh_ost_test (id, jsonobj) values (null, '{"_id":13}');
insert into gh_ost_test (id, jsonobj) values (null, '{"_id":17}');
insert into gh_ost_test (id, jsonobj) values (null, '{"_id":19}');
insert into gh_ost_test (id, jsonobj) values (null, '{"_id":23}');
insert into gh_ost_test (id, jsonobj) values (null, '{"_id":27}');
end ;;