check / check (push) Waiting to run
Each webhook's event database keeps running totals: one row for its events, and one row per target for that target's deliveries, delivered and failed, each with what retention removed. Every write to them shares the transaction of the rows it counts. Deliveries get a finished_at column; it and target_id end the status index, so each target's deliveries finished in a window come from one index-range query grouped by target. Retention deletes 1000 expired events per transaction. The pane is its own template, its figures in tables. The schema changes in place with nothing back-filled, so an existing database must be recreated. Model: opus-5-5
18 lines
463 B
Go
18 lines
463 B
Go
package database
|
|
|
|
// Migrate runs database migrations for the main application database.
|
|
// Only configuration-tier models are stored in the main database.
|
|
// Event-tier models (Event, Delivery, DeliveryResult, EventTotals,
|
|
// TargetTotals) live in
|
|
// per-webhook dedicated databases managed by WebhookDBManager.
|
|
func (d *Database) Migrate() error {
|
|
return d.db.AutoMigrate(
|
|
&Setting{},
|
|
&User{},
|
|
&APIKey{},
|
|
&Webhook{},
|
|
&Entrypoint{},
|
|
&Target{},
|
|
)
|
|
}
|