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

Function MigrationFromFilePath

file.go:47–56  ·  view source on GitHub ↗

MigrationFromFilePath creates a Migration from a path on disk

(filename string)

Source from the content-addressed store, hash-verified

45
46// MigrationFromFilePath creates a Migration from a path on disk
47func MigrationFromFilePath(filename string) (migration *Migration, err error) {
48 migration = &Migration{}
49 migration.ID = MigrationIDFromFilename(filename)
50 contents, err := os.ReadFile(path.Clean(filename))
51 if err != nil {
52 return migration, fmt.Errorf("failed to read migration from '%s': %w", filename, err)
53 }
54 migration.Script = string(contents)
55 return migration, err
56}
57
58// File wraps the standard library io.Read and os.File.Name methods
59type File interface {

Calls 1

MigrationIDFromFilenameFunction · 0.85

Used in the wild real call sites across dependent graphs

searching dependent graphs…