18 lines
800 B
Go
18 lines
800 B
Go
package pipeline
|
|
|
|
func (s *Store) initSchedules() error {
|
|
// Retain the legacy tables intact as migration evidence and audit history.
|
|
// No runtime writer dispatches or advances embedded-definition schedules.
|
|
_, err := s.db.Exec(`CREATE TABLE IF NOT EXISTS schedule_state (
|
|
pipeline_id INTEGER NOT NULL REFERENCES pipelines(id), version INTEGER NOT NULL,
|
|
slot INTEGER NOT NULL, next_due TEXT NOT NULL, PRIMARY KEY(pipeline_id,version,slot));
|
|
CREATE TABLE IF NOT EXISTS schedule_events (
|
|
id INTEGER PRIMARY KEY, pipeline_id INTEGER NOT NULL, version INTEGER NOT NULL,
|
|
slot INTEGER NOT NULL, due TEXT NOT NULL, status TEXT NOT NULL, diagnostic TEXT NOT NULL DEFAULT '',
|
|
run_id INTEGER, UNIQUE(pipeline_id,version,slot,due));`)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
return s.initSavedSchedules()
|
|
}
|