Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions module/database.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,22 @@ func (w *WorkflowDatabase) Open() (*sql.DB, error) {
return db, nil
}

// Start opens the database connection during application startup so that
// pipeline steps (db_query, db_exec) can use DB() without requiring a
// separate persistence.store module.
func (w *WorkflowDatabase) Start(ctx context.Context) error {
if w.config.DSN == "" {
return nil // no DSN configured, skip auto-open
}
_, err := w.Open()
return err
}

// Stop closes the database connection during application shutdown.
func (w *WorkflowDatabase) Stop(ctx context.Context) error {
return w.Close()
}

// Close closes the database connection
func (w *WorkflowDatabase) Close() error {
w.mu.Lock()
Expand Down
5 changes: 4 additions & 1 deletion module/database_drivers.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
package module

import _ "modernc.org/sqlite"
import (
_ "github.com/jackc/pgx/v5/stdlib"
_ "modernc.org/sqlite"
)
Loading