-
Notifications
You must be signed in to change notification settings - Fork 278
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
internal/integration: test mysql auto_increment
Also, fix minor diff issue in AUTO_INCREMENT migration
- Loading branch information
Showing
4 changed files
with
115 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
apply 1.hcl | ||
cmpshow users 1.sql | ||
|
||
# Setup a custom AUTO_INCREMENT initial value. | ||
apply 2.hcl | ||
cmpshow users 2.sql | ||
|
||
# Increase the AUTO_INCREMENT value. | ||
apply 3.hcl | ||
cmpshow users 3.sql | ||
|
||
-- 1.hcl -- | ||
schema "$db" {} | ||
|
||
table "users" { | ||
schema = schema.$db | ||
column "id" { | ||
null = false | ||
type = bigint | ||
auto_increment = true | ||
} | ||
primary_key { | ||
columns = [column.id] | ||
} | ||
} | ||
|
||
-- 1.sql -- | ||
CREATE TABLE `users` ( | ||
`id` bigint(20) NOT NULL AUTO_INCREMENT, | ||
PRIMARY KEY (`id`) | ||
) | ||
|
||
-- 8/1.sql -- | ||
CREATE TABLE `users` ( | ||
`id` bigint NOT NULL AUTO_INCREMENT, | ||
PRIMARY KEY (`id`) | ||
) | ||
|
||
-- 2.hcl -- | ||
schema "$db" {} | ||
|
||
table "users" { | ||
schema = schema.$db | ||
column "id" { | ||
null = false | ||
type = bigint | ||
auto_increment = true | ||
} | ||
primary_key { | ||
columns = [column.id] | ||
} | ||
auto_increment = 1000 | ||
} | ||
|
||
-- 2.sql -- | ||
CREATE TABLE `users` ( | ||
`id` bigint(20) NOT NULL AUTO_INCREMENT, | ||
PRIMARY KEY (`id`) | ||
) AUTO_INCREMENT=1000 | ||
|
||
-- 8/2.sql -- | ||
CREATE TABLE `users` ( | ||
`id` bigint NOT NULL AUTO_INCREMENT, | ||
PRIMARY KEY (`id`) | ||
) AUTO_INCREMENT=1000 | ||
|
||
-- 3.hcl -- | ||
schema "$db" {} | ||
|
||
table "users" { | ||
schema = schema.$db | ||
column "id" { | ||
null = false | ||
type = bigint | ||
auto_increment = true | ||
} | ||
primary_key { | ||
columns = [column.id] | ||
} | ||
auto_increment = 2000 | ||
} | ||
|
||
-- 3.sql -- | ||
CREATE TABLE `users` ( | ||
`id` bigint(20) NOT NULL AUTO_INCREMENT, | ||
PRIMARY KEY (`id`) | ||
) AUTO_INCREMENT=2000 | ||
|
||
-- 8/3.sql -- | ||
CREATE TABLE `users` ( | ||
`id` bigint NOT NULL AUTO_INCREMENT, | ||
PRIMARY KEY (`id`) | ||
) AUTO_INCREMENT=2000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters