命令:
alter table `test` modify column `id` bigint(20) NOT NULL; alter table `test1` modify column `id` bigint(20) NOT NULL; alter table `test2` modify column `id` bigint(20) NOT NULL;
修改前:
desc test;
+-------------------------+--------------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +-------------------------+--------------+------+-----+---------+----------------+ | id | int(11) | NO | PRI | NULL | auto_increment | | name | varchar(255) | NO | UNI | NULL | |
修改后:
desc test;
+-------------------------+--------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +-------------------------+--------------+------+-----+---------+-------+ | id | bigint(20) | NO | PRI | NULL | | | name | varchar(255) | NO | UNI | NULL | |
Tips:如果需要配合id生成器使用,可以参考之前博客
【记录】Golang分布式ID生成-SonyFlake



