github.com/wawandco/ox@v0.13.6-0.20230809142027-913b3d837f2a/plugins/tools/soda/initializer.go (about) 1 package soda 2 3 import ( 4 "context" 5 "os" 6 "path/filepath" 7 8 "github.com/wawandco/ox/plugins/base/new" 9 ) 10 11 type Initializer struct{} 12 13 func (in Initializer) Name() string { 14 return "soda/initializer" 15 } 16 17 func (in Initializer) Initialize(ctx context.Context, options new.Options) error { 18 err := os.MkdirAll(filepath.Join(options.Folder, "migrations"), 0777) 19 if err != nil { 20 return err 21 } 22 23 readme := filepath.Join(options.Folder, "migrations", "README.md") 24 content := []byte("This is the migrations folder, here live the migrations to keep the database up to date.") 25 err = os.WriteFile(readme, content, 0777) 26 if err != nil { 27 return err 28 } 29 30 return nil 31 }