From 0a177e0b4678a1d04bcbc698b8bae9175a0292d6 Mon Sep 17 00:00:00 2001 From: Sebastiaan de Schaetzen Date: Wed, 12 Mar 2025 08:23:16 +0100 Subject: [PATCH] Allow multi-statement migration scripts --- migrator_test.go | 4 ++++ testMigrations/3_multicomment.sql | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/migrator_test.go b/migrator_test.go index e8ce92d..48388fc 100644 --- a/migrator_test.go +++ b/migrator_test.go @@ -17,4 +17,8 @@ func TestDb_MigrateDb(t *testing.T) { var count int db.Query("select count(*) from mydata").MustScanSingle(&count) require.Equal(t, 1, count, "incorrect number of rows in database") + + count = 0 + db.Query("select count(*) from multiTable").MustScanSingle(&count) + require.Equal(t, 1, count, "incorrect number of rows in database") } diff --git a/testMigrations/3_multicomment.sql b/testMigrations/3_multicomment.sql index e3ad9c2..af64c70 100644 --- a/testMigrations/3_multicomment.sql +++ b/testMigrations/3_multicomment.sql @@ -1,3 +1,3 @@ -create table testTable(value text); +create table multiTable(value text); -insert into testTable(value) values ('testValue'); +insert into multiTable(value) values ('testValue');