Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 48 additions & 0 deletions enginetest/queries/alter_table_queries.go
Original file line number Diff line number Diff line change
Expand Up @@ -1456,6 +1456,54 @@ var AlterTableAddAutoIncrementScripts = []ScriptTest{
},
},
},
{
Name: "ALTER AUTO INCREMENT TABLE ADD column",
SetUpScript: []string{
"CREATE TABLE test (pk int primary key, uk int UNIQUE KEY auto_increment);",
},
Assertions: []ScriptTestAssertion{
{
Query: "alter table test add column j int;",
Expected: []sql.Row{{types.NewOkResult(0)}},
},
},
},
{
Name: "ALTER TABLE MODIFY column with multiple UNIQUE KEYS",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe "compound unique key" since it's really just one unique index?

Suggested change
Name: "ALTER TABLE MODIFY column with multiple UNIQUE KEYS",
Name: "ALTER TABLE MODIFY column with compound UNIQUE KEY",

Dialect: "mysql",
SetUpScript: []string{
"CREATE table test (pk int primary key, uk1 int, uk2 int, unique(uk1, uk2))",
"ALTER TABLE `test` MODIFY column uk1 int auto_increment",
},
Assertions: []ScriptTestAssertion{
{
Query: "describe test",
Expected: []sql.Row{
{"pk", "int", "NO", "PRI", nil, ""},
{"uk1", "int", "NO", "MUL", nil, "auto_increment"},
{"uk2", "int", "YES", "", nil, ""},
},
},
},
},
{
Name: "ALTER TABLE MODIFY column with multiple KEYS",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Name: "ALTER TABLE MODIFY column with multiple KEYS",
Name: "ALTER TABLE MODIFY column with compound KEY",

Dialect: "mysql",
SetUpScript: []string{
"CREATE table test (pk int primary key, mk1 int, mk2 int, index(mk1, mk2))",
"ALTER TABLE `test` MODIFY column mk1 int auto_increment",
},
Assertions: []ScriptTestAssertion{
{
Query: "describe test",
Expected: []sql.Row{
{"pk", "int", "NO", "PRI", nil, ""},
{"mk1", "int", "NO", "MUL", nil, "auto_increment"},
{"mk2", "int", "YES", "", nil, ""},
},
},
},
},
}

var AddDropPrimaryKeyScripts = []ScriptTest{
Expand Down
Loading
Loading