Skip to content

Commit a6b3342

Browse files
author
Shlomi Noach
authored
Merge pull request #240 from github/test-column-reorder
added tests for column-reorder
2 parents f58a8be + 63419b3 commit a6b3342

File tree

13 files changed

+99
-7
lines changed

13 files changed

+99
-7
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
drop table if exists gh_ost_test;
2+
create table gh_ost_test (
3+
id int auto_increment,
4+
c1 int not null,
5+
c2 int not null,
6+
primary key (id)
7+
) auto_increment=1;
8+
9+
drop event if exists gh_ost_test;
10+
delimiter ;;
11+
create event gh_ost_test
12+
on schedule every 1 second
13+
starts current_timestamp
14+
ends current_timestamp + interval 60 second
15+
on completion not preserve
16+
enable
17+
do
18+
begin
19+
insert ignore into gh_ost_test values (1, 11, 23);
20+
insert ignore into gh_ost_test values (2, 13, 23);
21+
insert into gh_ost_test values (null, 17, 23);
22+
set @last_insert_id := last_insert_id();
23+
update gh_ost_test set c1=c1+@last_insert_id, c2=c2+@last_insert_id where id=@last_insert_id order by id desc limit 1;
24+
delete from gh_ost_test where id=1;
25+
delete from gh_ost_test where c1=13; -- id=2
26+
end ;;
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
--alter="change column c2 c2a int not null after id" --approve-renamed-columns
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
id, c1, c2a
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
id, c1, c2
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
drop table if exists gh_ost_test;
2+
create table gh_ost_test (
3+
id int auto_increment,
4+
c1 int not null,
5+
c2 int not null,
6+
c3 int not null,
7+
primary key (id)
8+
) auto_increment=1;
9+
10+
drop event if exists gh_ost_test;
11+
delimiter ;;
12+
create event gh_ost_test
13+
on schedule every 1 second
14+
starts current_timestamp
15+
ends current_timestamp + interval 60 second
16+
on completion not preserve
17+
enable
18+
do
19+
begin
20+
insert ignore into gh_ost_test values (1, 11, 23, 97);
21+
insert ignore into gh_ost_test values (2, 13, 27, 61);
22+
insert into gh_ost_test values (null, 17, 31, 53);
23+
set @last_insert_id := last_insert_id();
24+
update gh_ost_test set c1=c1+@last_insert_id, c2=c2+@last_insert_id, c3=c3+@last_insert_id where id=@last_insert_id order by id desc limit 1;
25+
delete from gh_ost_test where id=1;
26+
delete from gh_ost_test where c1=13; -- id=2
27+
end ;;
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
--alter="change column c2 c2a int not null, change column c3 c3 int not null after id" --approve-renamed-columns
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
id, c1, c2a, c3
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
id, c1, c2, c3

localtests/reorder-columns/create.sql

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
drop table if exists gh_ost_test;
2+
create table gh_ost_test (
3+
id int auto_increment,
4+
c1 int not null,
5+
c2 int not null,
6+
primary key (id)
7+
) auto_increment=1;
8+
9+
drop event if exists gh_ost_test;
10+
delimiter ;;
11+
create event gh_ost_test
12+
on schedule every 1 second
13+
starts current_timestamp
14+
ends current_timestamp + interval 60 second
15+
on completion not preserve
16+
enable
17+
do
18+
begin
19+
insert ignore into gh_ost_test values (1, 11, 23);
20+
insert ignore into gh_ost_test values (2, 13, 29);
21+
insert into gh_ost_test values (null, 17, 31);
22+
set @last_insert_id := last_insert_id();
23+
update gh_ost_test set c1=c1+@last_insert_id, c2=c2+@last_insert_id where id=@last_insert_id order by id desc limit 1;
24+
delete from gh_ost_test where id=1;
25+
delete from gh_ost_test where c1=13;
26+
end ;;

localtests/reorder-columns/extra_args

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
--alter="change column c2 c2 int not null after id"

0 commit comments

Comments
 (0)