added tests to verify no false positives rename-column found
This commit is contained in:
parent
cb040b8bbf
commit
5119ea4d31
@ -229,7 +229,7 @@ func (this *Migrator) validateStatement() (err error) {
|
|||||||
if this.parser.HasNonTrivialRenames() && !this.migrationContext.SkipRenamedColumns {
|
if this.parser.HasNonTrivialRenames() && !this.migrationContext.SkipRenamedColumns {
|
||||||
this.migrationContext.ColumnRenameMap = this.parser.GetNonTrivialRenames()
|
this.migrationContext.ColumnRenameMap = this.parser.GetNonTrivialRenames()
|
||||||
if !this.migrationContext.ApproveRenamedColumns {
|
if !this.migrationContext.ApproveRenamedColumns {
|
||||||
return fmt.Errorf("gh-ost believes the ALTER statement renames columns, as follows: %v; as precation, you are asked to confirm gh-ost is correct, and provide with `--approve-renamed-columns`, and we're all happy. Or you can skip renamed columns via `--skip-renamed-columns`, in which case column data may be lost", this.parser.GetNonTrivialRenames())
|
return fmt.Errorf("gh-ost believes the ALTER statement renames columns, as follows: %v; as precaution, you are asked to confirm gh-ost is correct, and provide with `--approve-renamed-columns`, and we're all happy. Or you can skip renamed columns via `--skip-renamed-columns`, in which case column data may be lost", this.parser.GetNonTrivialRenames())
|
||||||
}
|
}
|
||||||
log.Infof("Alter statement has column(s) renamed. gh-ost finds the following renames: %v; --approve-renamed-columns is given and so migration proceeds.", this.parser.GetNonTrivialRenames())
|
log.Infof("Alter statement has column(s) renamed. gh-ost finds the following renames: %v; --approve-renamed-columns is given and so migration proceeds.", this.parser.GetNonTrivialRenames())
|
||||||
}
|
}
|
||||||
|
8
localtests/rename-none-column/create.sql
Normal file
8
localtests/rename-none-column/create.sql
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
drop table if exists gh_ost_test;
|
||||||
|
create table gh_ost_test (
|
||||||
|
id int auto_increment,
|
||||||
|
c1 int not null,
|
||||||
|
primary key (id)
|
||||||
|
) auto_increment=1;
|
||||||
|
|
||||||
|
drop event if exists gh_ost_test;
|
1
localtests/rename-none-column/extra_args
Normal file
1
localtests/rename-none-column/extra_args
Normal file
@ -0,0 +1 @@
|
|||||||
|
--alter="add column exchange double comment 'exchange rate used for pay in your own currency'"
|
8
localtests/rename-none-comment/create.sql
Normal file
8
localtests/rename-none-comment/create.sql
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
drop table if exists gh_ost_test;
|
||||||
|
create table gh_ost_test (
|
||||||
|
id int auto_increment,
|
||||||
|
c1 int not null,
|
||||||
|
primary key (id)
|
||||||
|
) auto_increment=1;
|
||||||
|
|
||||||
|
drop event if exists gh_ost_test;
|
1
localtests/rename-none-comment/extra_args
Normal file
1
localtests/rename-none-comment/extra_args
Normal file
@ -0,0 +1 @@
|
|||||||
|
--alter="add column exchange_rate double comment 'change rate used for pay in your own currency'"
|
Loading…
Reference in New Issue
Block a user