Clean up schema reading.

This commit is contained in:
M. J. Fromberger
2021-08-27 08:17:00 -07:00
parent 4a1358ea5a
commit 6995e1d18a

View File

@@ -160,17 +160,16 @@ func getTestBlockHeader() types.EventDataNewBlockHeader {
}
func readSchema() ([]*schema.Migration, error) {
filename := "schema.sql"
const filename = "schema.sql"
contents, err := ioutil.ReadFile(filename)
if err != nil {
return nil, fmt.Errorf("failed to read sql file from '%s': %w", filename, err)
}
mg := &schema.Migration{}
mg.ID = time.Now().Local().String() + " db schema"
mg.Script = string(contents)
return append([]*schema.Migration{}, mg), nil
return []*schema.Migration{{
ID: time.Now().Local().String() + " db schema",
Script: string(contents),
}}, nil
}
func resetDB(t *testing.T) {