• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

supabase / etl / 15885763648

25 Jun 2025 07:49PM UTC coverage: 60.073% (-1.4%) from 61.443%
15885763648

Pull #152

github

web-flow
Merge 2b95001e0 into 9f0201c2d
Pull Request #152: feat: add postgres state store to allow state to be persisted to the source db

81 of 313 new or added lines in 16 files covered. (25.88%)

29 existing lines in 8 files now uncovered.

5576 of 9282 relevant lines covered (60.07%)

27.44 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/replicator/src/migrations.rs
1
use config::shared::SourceConfig;
2
use sqlx::{postgres::PgPoolOptions, Executor};
3

4
const NUM_POOL_CONNECTIONS: u32 = 1;
5

6
/// This function runs migrations on the source database when the source database acts
7
/// as a state store.
NEW
8
pub async fn migrate_state_store(source_config: SourceConfig) -> Result<(), sqlx::Error> {
×
NEW
9
    let options = source_config.into_connection_config().with_db();
×
10

NEW
11
    let pool = PgPoolOptions::new()
×
NEW
12
        .max_connections(NUM_POOL_CONNECTIONS)
×
NEW
13
        .min_connections(NUM_POOL_CONNECTIONS)
×
NEW
14
        .after_connect(|conn, _meta| {
×
NEW
15
            Box::pin(async move {
×
NEW
16
                // Create the etl schema if it doesn't exist
×
NEW
17
                conn.execute("create schema if not exists etl;").await?;
×
18
                // We set the search_path to etl so that the _sqlx_migrations
19
                // metadata table is created inside that schema instead of the public
20
                // schema
NEW
21
                conn.execute("set search_path = 'etl';").await?;
×
NEW
22
                Ok(())
×
NEW
23
            })
×
NEW
24
        })
×
NEW
25
        .connect_with(options)
×
NEW
26
        .await?;
×
27

NEW
28
    let migrator = sqlx::migrate!("./migrations");
×
NEW
29
    migrator.run(&pool).await?;
×
30

NEW
31
    Ok(())
×
NEW
32
}
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc