Add constraint after dropping the column

This commit is contained in:
Till Faelligen 2023-05-17 13:27:41 +02:00
parent 52ff93ede4
commit 2801634961
No known key found for this signature in database
GPG key ID: 3DF82D8AB9211D4E

View file

@ -42,5 +42,11 @@ func UpDropEventReferenceSHAPrevEvents(ctx context.Context, tx *sql.Tx) error {
if err != nil {
return fmt.Errorf("failed to execute upgrade: %w", err)
}
// re-add constraint, as it seems to be dropped as well
_, err = tx.ExecContext(ctx, `ALTER TABLE roomserver_previous_events ADD CONSTRAINT roomserver_previous_event_id_unique UNIQUE (previous_event_id);`)
if err != nil {
return fmt.Errorf("failed to execute upgrade: %w", err)
}
return nil
}