mysql - Overriding sql table structure -
table 1
create table `test`.`table_1` ( `id` integer unsigned not null auto_increment, `name` varchar(45), primary key (`id`) ) engine = innodb;
table 2
create table `test`.`table_2` ( `id` integer unsigned not null auto_increment, `name` varchar(256) not null, `number` integer unsigned not null, primary key (`id`) ) engine = innodb;
the result want get: table 1 , table 2 expected same, table 1 in coworker workspace , want change table 2 without losing data
you can use alter table
. should fine:
alter table table_1 modify name varchar(256) not null; alter table table_1 add number integer unsigned not null;
notes: not null
s assume table empty (for number
) , name
has no null
values. otherwise, need default values.
Comments
Post a Comment