storj/satellite/satellitedb
Jessica Grebenschikov aeab599d21 satellitedb: removed unused id on storagenode_storage_tallies table, add index on node_id
The goal of this change is to improve the storagenode_storage_tallies table by removing the unneeded id column that is not being used but only taking up space, and also to add an index on a different column that needs it. Removing and adding a column seems simple, but ended up being more complicated because of some cockroachdb limitations.

The cockroachdb limitation when trying to remove a column from a table and create a new primary key are:
1. only allows primary key creation at table creation time (docs: https://www.cockroachlabs.com/docs/stable/primary-key.html)
2. table drop or rename is performed async and cannot be done in a transaction (issue: https://github.com/cockroachdb/cockroach/issues/12123, https://github.com/cockroachdb/cockroach/issues/22868)

To address these differences between cockroachdb  and Postgres, this PR performs different migrations for the two database. The Postgres migration is straight forward and what you would expect, but the cockroach migration has two main changes:
1. To change a primary key, use the recommended process from the cockroachdb docs to create a new table with the new primary key you want and then migrate the data.
2. In order to do 1, we needed to do the new table renaming in a separate transaction from the data migration.

Ref: SM-65

Change-Id: Idc9aee3ab57aa4d5570e3d2980afea853cd966bf
2020-03-20 14:39:44 -07:00
..
dbx satellitedb: removed unused id on storagenode_storage_tallies table, add index on node_id 2020-03-20 14:39:44 -07:00
pbold common: separate repository 2019-12-27 14:11:15 +02:00
satellitedbtest private/testplanet: flatten migration for running tests 2020-01-22 15:09:11 +00:00
testdata satellitedb: removed unused id on storagenode_storage_tallies table, add index on node_id 2020-03-20 14:39:44 -07:00
apikeys.go satellite/satellitedb: fixes to row handling 2020-01-16 17:07:26 +02:00
attribution_test.go satellite/satellitedb/satellitedbtest: pass ctx as an argument 2020-01-20 16:35:42 +02:00
attribution.go satellite/satellitedb: add missing err check 2020-01-19 19:24:12 +00:00
buckets.go satellite/metainfo: check bucket existence on upload and listing 2020-03-17 15:43:22 +00:00
coinpaymentstxs.go satellite/payments: fail when trying to consume consumed transactions 2020-02-13 19:52:55 +00:00
consoledb_test.go satellite/satellitedb/satellitedbtest: pass ctx as an argument 2020-01-20 16:35:42 +02:00
consoledb.go satellite/payments: fix promotional coupons 2020-01-29 16:40:43 +02:00
containment.go satellite/satellitedb/dbx: name the package dbx 2020-01-15 15:16:39 -07:00
coupons.go satellite/payments: More Cleanup and Satellite command to ensure we have stripe customers (#3805) 2020-03-16 20:34:15 +01:00
credits.go satellite/payments/stripecoinpayments: credits added to invoice calculations 2020-02-24 16:48:27 +00:00
customers.go satellite/payments: fix promotional coupons 2020-01-29 16:40:43 +02:00
database.go satellite/satellitedb/heldamount added, endpoint added 2020-03-13 18:15:52 +00:00
downtime.go satellite/satellitedb/dbx: name the package dbx 2020-01-15 15:16:39 -07:00
gracefulexit.go satellite/satellitedb: gracefulexit, add missing Errs check 2020-01-19 15:24:12 +00:00
heldamount.go satellitedb/heldamount updated, tests added + storagenode console updated 2020-03-19 15:37:45 +02:00
invoiceprojectrecords.go satellite/payments/stripecoinpayments: credits added to invoice calculations 2020-02-24 16:48:27 +00:00
irreparabledb.go satellite/repair: put irreparable segments in irreparableDB 2020-03-09 21:45:16 +00:00
migrate_test.go satellite/satellitedb: increase migrate test timeout 2020-03-09 14:30:50 +02:00
migrate.go satellitedb: removed unused id on storagenode_storage_tallies table, add index on node_id 2020-03-20 14:39:44 -07:00
offers.go satellite: use tagsql 2020-01-19 14:39:16 +02:00
orders.go satellite/orders: more efficient processing of orders 2020-03-18 09:03:30 +00:00
overlaycache.go satellite/{overlay, satellitedb}: account for suspended field in overlay cache 2020-03-17 17:14:56 +00:00
peeridentities.go satellite: use tagsql 2020-01-19 14:39:16 +02:00
projectaccounting.go satellite/satellitedb: don't include GET_AUDIT and GET_REPAIR with chargeable BW 2020-02-07 12:02:44 +00:00
projectmembers_test.go web/satellite: project members sorting fixed (#3231) 2019-10-15 15:24:53 +03:00
projectmembers.go satellite/satellitedb: fixes to row handling 2020-01-16 17:07:26 +02:00
projects_test.go satellite/satellitedb/dbx: name the package dbx 2020-01-15 15:16:39 -07:00
projects.go satellite/satellitedb: check indexes on migration 2020-03-13 10:45:22 +00:00
regtokens.go satellite/satellitedb/dbx: name the package dbx 2020-01-15 15:16:39 -07:00
repairqueue.go satellite/satellitedb: use time zones with all timestamps 2020-03-05 21:11:25 +00:00
resetpasstokens.go satellite/satellitedb/dbx: name the package dbx 2020-01-15 15:16:39 -07:00
storagenodeaccounting.go satellitedb: removed unused id on storagenode_storage_tallies table, add index on node_id 2020-03-20 14:39:44 -07:00
stripecoinpaymentsdb.go satellite/payments : deposit bonuses (credits) added 2020-02-11 11:11:42 +00:00
usercredits.go satellite/satellitedb: fixes to row handling 2020-01-16 17:07:26 +02:00
users_test.go satellite/satellitedb/dbx: name the package dbx 2020-01-15 15:16:39 -07:00
users.go satellite/satellitedb/dbx: name the package dbx 2020-01-15 15:16:39 -07:00
utils_test.go common: separate repository 2019-12-27 14:11:15 +02:00
utils.go common: separate repository 2019-12-27 14:11:15 +02:00