diff --git a/module/database.go b/module/database.go index e07b1119..310e3098 100644 --- a/module/database.go +++ b/module/database.go @@ -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() diff --git a/module/database_drivers.go b/module/database_drivers.go index 5f007f65..f1f86749 100644 --- a/module/database_drivers.go +++ b/module/database_drivers.go @@ -1,3 +1,6 @@ package module -import _ "modernc.org/sqlite" +import ( + _ "github.com/jackc/pgx/v5/stdlib" + _ "modernc.org/sqlite" +)