openAndMigrateSQLiteStore opens the database and runs migrations
(ctx context.Context, path string)
| 521 | |
| 522 | // openAndMigrateSQLiteStore opens the database and runs migrations |
| 523 | func openAndMigrateSQLiteStore(ctx context.Context, path string) (*SQLiteSessionStore, error) { |
| 524 | db, err := sqliteutil.OpenDB(ctx, path) |
| 525 | if err != nil { |
| 526 | return nil, err |
| 527 | } |
| 528 | |
| 529 | if err := setupAndMigrate(ctx, db); err != nil { |
| 530 | db.Close() |
| 531 | if sqliteutil.IsCantOpenError(err) { |
| 532 | return nil, sqliteutil.DiagnoseDBOpenError(path, err) |
| 533 | } |
| 534 | return nil, err |
| 535 | } |
| 536 | |
| 537 | return &SQLiteSessionStore{db: db}, nil |
| 538 | } |
| 539 | |
| 540 | // setupAndMigrate creates the bootstrap sessions table (if missing) and runs |
| 541 | // all pending schema migrations. The bootstrap schema only declares the |
no test coverage detected