1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88
|
apply 1.hcl
cmpshow t 1.sql
# Insert a few records to the table, and cause the new desired change to fail.
execsql 'INSERT INTO $db.t (c, d) VALUES (1, 1), (1, 2), (1, 3)'
! apply 2.fail.hcl "Error 1062: Duplicate entry '1' for key 'c'"
apply 2.hcl
cmpshow t 2.sql
-- 1.hcl --
schema "$db" {
charset = "$charset"
collate = "$collate"
}
table "t" {
schema = schema.$db
column "c" {
type = bigint
}
column "d" {
type = bigint
}
index "c" {
unique = true
columns = [column.c, column.d]
}
}
-- 1.sql --
CREATE TABLE `t` (
`c` bigint(20) NOT NULL,
`d` bigint(20) NOT NULL,
UNIQUE KEY `c` (`c`,`d`)
)
-- mysql8/1.sql --
CREATE TABLE `t` (
`c` bigint NOT NULL,
`d` bigint NOT NULL,
UNIQUE KEY `c` (`c`,`d`)
)
-- 2.fail.hcl --
schema "$db" {
charset = "$charset"
collate = "$collate"
}
table "t" {
schema = schema.$db
column "c" {
type = bigint
}
index "c" {
unique = true
columns = [column.c]
}
}
-- 2.hcl --
schema "$db" {
charset = "$charset"
collate = "$collate"
}
table "t" {
schema = schema.$db
column "c" {
type = bigint
}
index "c" {
columns = [column.c]
}
}
-- 2.sql --
CREATE TABLE `t` (
`c` bigint(20) NOT NULL,
KEY `c` (`c`)
)
-- mysql8/2.sql --
CREATE TABLE `t` (
`c` bigint NOT NULL,
KEY `c` (`c`)
)
|