MCPcopy Create free account
hub / github.com/adlio/schema / MigrationFromFile

Function MigrationFromFile

file.go:67–76  ·  view source on GitHub ↗

MigrationFromFile builds a migration by reading from an open File-like object. The migration's ID will be based on the file's name. The file will *not* be closed after being read.

(file File)

Source from the content-addressed store, hash-verified

65// object. The migration's ID will be based on the file's name. The file
66// will *not* be closed after being read.
67func MigrationFromFile(file File) (migration *Migration, err error) {
68 migration = &Migration{}
69 migration.ID = MigrationIDFromFilename(file.Name())
70 content, err := io.ReadAll(file)
71 if err != nil {
72 return migration, err
73 }
74 migration.Script = string(content)
75 return migration, err
76}

Callers 2

TestMigrationFromFileFunction · 0.85

Calls 2

MigrationIDFromFilenameFunction · 0.85
NameMethod · 0.65

Tested by 2

TestMigrationFromFileFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…