Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update used DB tables list #3277

Merged
merged 5 commits into from
Feb 14, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/nitpicks.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
- markdown: |
Reminder: Please update the DB Readme and comment whether migrations are reversible (include rollback scripts if applicable).
If new tables were added, update the [tables list](https://github.com/cowprotocol/services/blob/main/crates/database/src/lib.rs#L51-L87).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if specifying line numbers is sensible, as they can change in the future.

pathFilter:
- "database/sql/**"

Expand Down
45 changes: 27 additions & 18 deletions crates/database/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,32 +50,41 @@ pub type PgTransaction<'a> = sqlx::Transaction<'a, sqlx::Postgres>;

/// The names of tables we use in the db.
pub const TABLES: &[&str] = &[
"orders",
"trades",
"invalidations",
"last_indexed_blocks",
"quotes",
"settlements",
"presignature_events",
"order_quotes",
"solver_competitions",
"app_data",
"auction_orders",
"auctions",
"competition_auctions",
"onchain_placed_orders",
"ethflow_orders",
"order_execution",
"interactions",
"ethflow_refunds",
"settlement_scores",
"settlement_observations",
"auction_prices",
"auction_participants",
"app_data",
"fee_policies",
"interactions",
"invalidations",
"jit_orders",
"last_indexed_blocks",
"onchain_order_invalidations",
"onchain_placed_orders",
"order_execution",
"order_quotes",
"orders",
"presignature_events",
"proposed_jit_orders",
"proposed_solutions",
"quotes",
"settlement_observations",
"settlement_scores",
"settlements",
"solver_competitions",
"surplus_capturing_jit_order_owners",
"trades",
];

/// The names of potentially big volume tables we use in the db.
pub const LARGE_TABLES: &[&str] = &["order_events"];
pub const LARGE_TABLES: &[&str] = &[
"auction_prices",
"auction_participants",
"order_events",
"proposed_trade_executions",
];

pub fn all_tables() -> impl Iterator<Item = &'static str> {
TABLES.iter().copied().chain(LARGE_TABLES.iter().copied())
Expand Down
Loading