Closed HenryQW closed 2 months ago
also it's worth paying attention to https://github.com/RSS3-Network/Node/issues/208
Got a dilemma:
When creating some tables, it needs to generate the "id" bigint GENERATED BY DEFAULT AS IDENTITY (INCREMENT 1 MINVALUE 0 START 0)
, such as average_tax_rate_submissions
table.
But gorm's tag doesn't cover this requirement, its autoIncrement
, autoIncrementIncrement
don't work (docs: https://gorm.io/docs/models.html#Fields-Tags)
add a reminder: GORM's tag cannot specify the name of Composite Primary Key, some database requires (manual) reconstruction
bridge.events
-> bridge_events
bridge.transactions
-> bridge_transactions
node.events
-> node_events
node.min_tokens_to_stake_snapshots
-> node_min_tokens_to_stake_snapshots
node.count_snapshots
-> node_count_snapshots
node.operator_profit_snapshots
-> node_operator_profit_snapshots
stake.chips
-> stake_chips
stake.events
-> stake_events
stake.transactions
-> stake_transactions
stake.count_snapshots
-> stake_count_snapshots
stake.profit_snapshots
-> stake_profit_snapshots
local
-> location
total_reward_items
-> total_reward_nodes
tax_amounts
-> tax_collected
request_counts
-> request_count
Change table commands: (Refer to https://www.cockroachlabs.com/docs/stable/alter-table )
Change table name:
ALTER TABLE ... RENAME TO ...
Change table schema:
ALTER TABLE ... SET SCHEMA ...
Change column name:
ALTER TABLE ... RENAME COLUMN ...
keep manually maintained SQL + more tests
public
.internal/database/dialer/cockroachdb/README.md
for more information.A second CRDB container is needed as a temporary DB for Atlas to perform its magic.
Close #147