You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Sep 17, 2024. It is now read-only.
table structure in server1:
CREATE TABLE t1 ( a int NOT NULL, b char(10) NOT NULL, c varchar(100) DEFAULT '',
PRIMARY KEY (a,b),
KEY idx_a_b (a,b)
)
table structure in server2:
CREATE TABLE t1 ( a int(11) NOT NULL AUTO_INCREMENT, b char(10) DEFAULT NULL COMMENT '保证金', c varchar(100) NOT NULL DEFAULT '', d datetime DEFAULT NULL, e datetime DEFAULT NULL,
PRIMARY KEY (a),
KEY idx_b_c (b,c)
)
--changes-for=server1 result :
ALTER TABLE test.t1
DROP PRIMARY KEY,
DROP PRIMARY KEY,
DROP INDEX idx_a_b,
ADD PRIMARY KEY(a),
ADD INDEX idx_b_c (b,c),
CHANGE COLUMN a a int(11) NOT NULL AUTO_INCREMENT,
ADD COLUMN e datetime NULL,
ADD COLUMN d datetime NULL AFTER c,
CHANGE COLUMN c c varchar(100) NOT NULL DEFAULT '',
CHANGE COLUMN b b char(10) NULL COMMENT '保证金',
AUTO_INCREMENT=3, COLLATE=utf8_general_ci;
If it is a federated primary key, "drop primary key" will generate multiple primary keys
The text was updated successfully, but these errors were encountered:
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
table structure in server1:
CREATE TABLE
t1
(a
int NOT NULL,b
char(10) NOT NULL,c
varchar(100) DEFAULT '',PRIMARY KEY (
a
,b
),KEY
idx_a_b
(a
,b
))
table structure in server2:
CREATE TABLE
t1
(a
int(11) NOT NULL AUTO_INCREMENT,b
char(10) DEFAULT NULL COMMENT '保证金',c
varchar(100) NOT NULL DEFAULT '',d
datetime DEFAULT NULL,e
datetime DEFAULT NULL,PRIMARY KEY (
a
),KEY
idx_b_c
(b
,c
))
--changes-for=server1 result :
ALTER TABLE
test
.t1
DROP PRIMARY KEY,
DROP PRIMARY KEY,
DROP INDEX idx_a_b,
ADD PRIMARY KEY(
a
),ADD INDEX idx_b_c (b,c),
CHANGE COLUMN a a int(11) NOT NULL AUTO_INCREMENT,
ADD COLUMN e datetime NULL,
ADD COLUMN d datetime NULL AFTER c,
CHANGE COLUMN c c varchar(100) NOT NULL DEFAULT '',
CHANGE COLUMN b b char(10) NULL COMMENT '保证金',
AUTO_INCREMENT=3, COLLATE=utf8_general_ci;
If it is a federated primary key, "drop primary key" will generate multiple primary keys
The text was updated successfully, but these errors were encountered: