Skip to content

Commit 5973c68

Browse files
committed
Additional unit tests to address open issues in github
1 parent e53b7ac commit 5973c68

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

database/spanner/spanner_test.go

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -313,6 +313,34 @@ func Test_statementGroups(t *testing.T) {
313313
},
314314
},
315315
},
316+
{
317+
name: "ALTER with DEFAULT",
318+
// From https://github.com/golang-migrate/migrate/issues/918
319+
multiStatement: "ALTER TABLE t1 ADD COLUMN c1 STRING(MAX) DEFAULT ('');ALTER TABLE t1 ADD COLUMN c1 STRING(MAX) NOT NULL DEFAULT ('');",
320+
expected: []*statementGroup{
321+
{
322+
typ: statementTypeDDL,
323+
stmts: []string{
324+
"ALTER TABLE t1 ADD COLUMN c1 STRING(MAX) DEFAULT ('')",
325+
"ALTER TABLE t1 ADD COLUMN c1 STRING(MAX) NOT NULL DEFAULT ('')",
326+
},
327+
},
328+
},
329+
},
330+
{
331+
name: "Change Streams",
332+
multiStatement: `CREATE CHANGE STREAM NamesAndAlbums
333+
FOR Singers(FirstName, LastName), Albums
334+
OPTIONS ( retention_period = '36h' );`,
335+
expected: []*statementGroup{
336+
{
337+
typ: statementTypeDDL,
338+
stmts: []string{
339+
"CREATE CHANGE STREAM NamesAndAlbums\nFOR Singers(FirstName, LastName), Albums\nOPTIONS ( retention_period = '36h' )",
340+
},
341+
},
342+
},
343+
},
316344
}
317345

318346
for _, tc := range testCases {

0 commit comments

Comments
 (0)