mirror of
https://github.com/matrix-org/dendrite.git
synced 2025-12-28 09:13:09 -06:00
Use Query
This commit is contained in:
parent
beef1e3131
commit
e5b4e75357
|
|
@ -65,7 +65,7 @@ func UpStateBlocksRefactor(tx *sql.Tx) error {
|
||||||
if _, err := tx.Exec(`ALTER TABLE roomserver_state_snapshots RENAME TO _roomserver_state_snapshots;`); err != nil {
|
if _, err := tx.Exec(`ALTER TABLE roomserver_state_snapshots RENAME TO _roomserver_state_snapshots;`); err != nil {
|
||||||
return fmt.Errorf("tx.Exec: %w", err)
|
return fmt.Errorf("tx.Exec: %w", err)
|
||||||
}
|
}
|
||||||
_, err := tx.Exec(`
|
createblock, err := tx.Query(`
|
||||||
DROP SEQUENCE IF EXISTS roomserver_state_block_nid_seq;
|
DROP SEQUENCE IF EXISTS roomserver_state_block_nid_seq;
|
||||||
CREATE SEQUENCE roomserver_state_block_nid_seq START WITH $1;
|
CREATE SEQUENCE roomserver_state_block_nid_seq START WITH $1;
|
||||||
|
|
||||||
|
|
@ -78,7 +78,10 @@ func UpStateBlocksRefactor(tx *sql.Tx) error {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("tx.Exec: %w", err)
|
return fmt.Errorf("tx.Exec: %w", err)
|
||||||
}
|
}
|
||||||
_, err = tx.Exec(`
|
if err = createblock.Close(); err != nil {
|
||||||
|
return fmt.Errorf("snapshots.Close: %w", err)
|
||||||
|
}
|
||||||
|
createsnapshot, err := tx.Query(`
|
||||||
DROP SEQUENCE IF EXISTS roomserver_state_snapshot_nid_seq;
|
DROP SEQUENCE IF EXISTS roomserver_state_snapshot_nid_seq;
|
||||||
CREATE SEQUENCE roomserver_state_snapshot_nid_seq START WITH $1;
|
CREATE SEQUENCE roomserver_state_snapshot_nid_seq START WITH $1;
|
||||||
|
|
||||||
|
|
@ -92,6 +95,9 @@ func UpStateBlocksRefactor(tx *sql.Tx) error {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("tx.Exec: %w", err)
|
return fmt.Errorf("tx.Exec: %w", err)
|
||||||
}
|
}
|
||||||
|
if err = createsnapshot.Close(); err != nil {
|
||||||
|
return fmt.Errorf("snapshots.Close: %w", err)
|
||||||
|
}
|
||||||
logrus.Warn("New tables created...")
|
logrus.Warn("New tables created...")
|
||||||
|
|
||||||
batchsize := 100
|
batchsize := 100
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue