From 6f7729e5788bb42ea2c8b77042f76b1a473ca13f Mon Sep 17 00:00:00 2001 From: Neil Alexander Date: Thu, 10 Nov 2022 10:56:43 +0000 Subject: [PATCH] Fix migration --- .../postgres/deltas/2022110411000000_server_names.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/userapi/storage/postgres/deltas/2022110411000000_server_names.go b/userapi/storage/postgres/deltas/2022110411000000_server_names.go index cdf266a15..194679c00 100644 --- a/userapi/storage/postgres/deltas/2022110411000000_server_names.go +++ b/userapi/storage/postgres/deltas/2022110411000000_server_names.go @@ -51,14 +51,14 @@ func UpServerNames(ctx context.Context, tx *sql.Tx, serverName gomatrixserverlib pq.QuoteIdentifier(newTable), pq.QuoteIdentifier(newTable+"_pkey"), ) if _, err := tx.ExecContext(ctx, q); err != nil { - return fmt.Errorf("drop PK from %q error: %w", newTable, err) + return fmt.Errorf("drop new PK from %q error: %w", newTable, err) } q = fmt.Sprintf( "ALTER TABLE IF EXISTS %s DROP CONSTRAINT IF EXISTS %s;", - pq.QuoteIdentifier(oldTable), pq.QuoteIdentifier(oldTable+"_pkey"), + pq.QuoteIdentifier(newTable), pq.QuoteIdentifier(oldTable+"_pkey"), ) if _, err := tx.ExecContext(ctx, q); err != nil { - return fmt.Errorf("drop PK from %q error: %w", oldTable, err) + return fmt.Errorf("drop old PK from %q error: %w", newTable, err) } } return nil