fix(mirror): ensure multiple runs (#9899)

1. After second execution, mirror starts to fail because of Primary key
constraints on the events table. Because mirror always took the the
first `system.mirror.succeeded` instead of the newest one
2. Mirror panicked during migration of fields tables

1. Adjusted the database query to order descending and limit 1
2. added missing assignment

- detailed logging if the copy from statement failed.
This commit is contained in:
Silvan
2025-05-19 11:30:11 +02:00
committed by adlerhurst
parent 5e66851c69
commit bb56775435
3 changed files with 10 additions and 1 deletions

View File

@@ -36,6 +36,7 @@ func (p *LastSuccessfulMirror) Filter() *eventstore.Filter {
),
eventstore.FilterPagination(
eventstore.Descending(),
eventstore.Limit(1),
),
)
}