Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
6 changes: 2 additions & 4 deletions pkg/migration/file.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,10 +177,8 @@ func (m *SeedFile) ExecBatchWithCache(ctx context.Context, conn *pgx.Conn, fsys
}
// Data statements don't mutate schemas, safe to use statement cache
batch := pgx.Batch{}
if !m.Dirty {
for _, line := range lines {
batch.Queue(line)
}
for _, line := range lines {
batch.Queue(line)
}
batch.Queue(UPSERT_SEED_FILE, m.Path, m.Hash)
// No need to track version here because there are no schema changes
Expand Down
6 changes: 4 additions & 2 deletions pkg/migration/seed_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,12 @@ func TestSeedData(t *testing.T) {
conn := pgtest.NewConn()
defer conn.Close(t)
mockSeedHistory(conn).
Query(UPSERT_SEED_FILE, seed.Path, seed.Hash).
Query(testSeed+`;INSERT INTO supabase_migrations.seed_files(path, hash) VALUES( 'testdata/seed.sql' , '61868484fc0ddca2a2022217629a9fd9a4cf1ca479432046290797d6d40ffcc3' ) ON CONFLICT (path) DO UPDATE SET hash = EXCLUDED.hash`).
Reply("INSERT 0 1")
// Run test
err := SeedData(context.Background(), []SeedFile{seed}, conn.MockClient(t), testMigrations)
err := SeedData(context.Background(), []SeedFile{seed}, conn.MockClient(t, func(cc *pgx.ConnConfig) {
cc.PreferSimpleProtocol = true
}), testMigrations)
// Check error
assert.NoError(t, err)
})
Expand Down
Loading