MCPcopy Create free account
hub / github.com/chain/Core / TestApplyMigrationSQL

Function TestApplyMigrationSQL

core/migrate/migrate_test.go:108–125  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

106}
107
108func TestApplyMigrationSQL(t *testing.T) {
109 save := migrations
110 defer func() { migrations = save }()
111
112 _, db := pgtest.NewDB(t, "testdata/empty.sql")
113
114 migrations = []migration{{
115 Name: "test-migration",
116 SQL: `CREATE TABLE test_table (a int);`,
117 }}
118
119 h := sha256.Sum256([]byte(migrations[0].SQL))
120 migrations[0].Hash = hex.EncodeToString(h[:])
121 err := Run(db)
122 if err != nil {
123 t.Error(err)
124 }
125}

Callers

nothing calls this directly

Calls 2

RunFunction · 0.70
ErrorMethod · 0.45

Tested by

no test coverage detected