mirror of
https://github.com/matrix-org/dendrite.git
synced 2025-12-26 00:03:09 -06:00
Reset sequences
This commit is contained in:
parent
e7ada57dbb
commit
88685be9d2
|
|
@ -39,6 +39,7 @@ func UpFixSequences(tx *sql.Tx) error {
|
||||||
|
|
||||||
-- Use the new syncapi_receipts_id sequence.
|
-- Use the new syncapi_receipts_id sequence.
|
||||||
CREATE SEQUENCE IF NOT EXISTS syncapi_receipt_id;
|
CREATE SEQUENCE IF NOT EXISTS syncapi_receipt_id;
|
||||||
|
ALTER SEQUENCE IF EXISTS syncapi_receipt_id RESTART WITH 1;
|
||||||
ALTER TABLE syncapi_receipts ALTER COLUMN id SET DEFAULT nextval('syncapi_receipt_id');
|
ALTER TABLE syncapi_receipts ALTER COLUMN id SET DEFAULT nextval('syncapi_receipt_id');
|
||||||
`)
|
`)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
||||||
|
|
@ -36,6 +36,7 @@ func UpFixSequences(tx *sql.Tx) error {
|
||||||
-- will be wrong, and we'll get primary key violations if we try to
|
-- will be wrong, and we'll get primary key violations if we try to
|
||||||
-- reuse existing stream IDs from a different sequence.
|
-- reuse existing stream IDs from a different sequence.
|
||||||
DELETE FROM syncapi_receipts;
|
DELETE FROM syncapi_receipts;
|
||||||
|
UPDATE syncapi_stream_id SET stream_id=1 WHERE stream_name="receipt";
|
||||||
`)
|
`)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("failed to execute upgrade: %w", err)
|
return fmt.Errorf("failed to execute upgrade: %w", err)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue