Init ensures the schema exists and the managed directory is present.
(ctx context.Context)
| 73 | |
| 74 | // Init ensures the schema exists and the managed directory is present. |
| 75 | func (s *Store) Init(ctx context.Context) error { |
| 76 | if err := appstate.New(s.dbPath).Init(ctx); err != nil { |
| 77 | return err |
| 78 | } |
| 79 | if err := os.MkdirAll(managedDir(), 0o755); err != nil { |
| 80 | return fmt.Errorf("instructions: mkdir managed dir: %w", err) |
| 81 | } |
| 82 | return nil |
| 83 | } |
| 84 | |
| 85 | func (s *Store) open() (*sql.DB, error) { |
| 86 | db, err := sql.Open("sqlite", s.dbPath) |