| 1 |
source include/have_innodb.inc; |
| 2 |
source include/master-slave.inc; |
| 3 |
|
| 4 |
use test; |
| 5 |
create table t1 (id int primary key, c1 int default 10, c2 varchar(20) default 'holiday') engine = innodb; |
| 6 |
|
| 7 |
insert into t1 values(1, 12345, 'abcde'), (2, default, default), (3, 23456, 'xyzab'); |
| 8 |
|
| 9 |
set time_zone='+03:00'; |
| 10 |
set timestamp = 1; |
| 11 |
alter table t1 add column d1 timestamp not null default current_timestamp; |
| 12 |
|
| 13 |
select * from t1; |
| 14 |
sync_slave_with_master; |
| 15 |
|
| 16 |
connection slave; |
| 17 |
set time_zone='+03:00'; |
| 18 |
select * from t1; |
| 19 |
|
| 20 |
connection master; |
| 21 |
alter table t1 add column d2 timestamp not null default current_timestamp, ALGORITHM=copy; |
| 22 |
|
| 23 |
sync_slave_with_master; |
| 24 |
|
| 25 |
connection slave; |
| 26 |
select * from t1; |
| 27 |
|
| 28 |
connection master; |
| 29 |
drop table t1; |
| 30 |
|
| 31 |
|
| 32 |
# datetime |
| 33 |
create table t4 (id int primary key, c2 int); |
| 34 |
insert into t4 values(1,1),(2,2),(3,3); |
| 35 |
set timestamp = 1000; |
| 36 |
alter table t4 add column (c3 datetime default current_timestamp(), c4 timestamp not null default current_timestamp()); |
| 37 |
select * from t4; |
| 38 |
alter table t4 add column c5 time not null default current_timestamp(); |
| 39 |
alter table t4 add column c6 date not null default current_timestamp(); |
| 40 |
|
| 41 |
select * from t4; |
| 42 |
sync_slave_with_master; |
| 43 |
|
| 44 |
connection slave; |
| 45 |
select * from t4; |
| 46 |
|
| 47 |
connection master; |
| 48 |
drop table t4; |
| 49 |
|
| 50 |
--source include/rpl_end.inc |