Skip to content

Commit

Permalink
Additional unit tests to address open issues in github
Browse files Browse the repository at this point in the history
  • Loading branch information
jtwatson committed Feb 5, 2025
1 parent e53b7ac commit 5973c68
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions database/spanner/spanner_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,34 @@ func Test_statementGroups(t *testing.T) {
},
},
},
{
name: "ALTER with DEFAULT",
// From https://github.com/golang-migrate/migrate/issues/918
multiStatement: "ALTER TABLE t1 ADD COLUMN c1 STRING(MAX) DEFAULT ('');ALTER TABLE t1 ADD COLUMN c1 STRING(MAX) NOT NULL DEFAULT ('');",
expected: []*statementGroup{
{
typ: statementTypeDDL,
stmts: []string{
"ALTER TABLE t1 ADD COLUMN c1 STRING(MAX) DEFAULT ('')",
"ALTER TABLE t1 ADD COLUMN c1 STRING(MAX) NOT NULL DEFAULT ('')",
},
},
},
},
{
name: "Change Streams",
multiStatement: `CREATE CHANGE STREAM NamesAndAlbums
FOR Singers(FirstName, LastName), Albums
OPTIONS ( retention_period = '36h' );`,
expected: []*statementGroup{
{
typ: statementTypeDDL,
stmts: []string{
"CREATE CHANGE STREAM NamesAndAlbums\nFOR Singers(FirstName, LastName), Albums\nOPTIONS ( retention_period = '36h' )",
},
},
},
},
}

for _, tc := range testCases {
Expand Down

0 comments on commit 5973c68

Please sign in to comment.