diff --git a/.env b/.env index dda717435..94f365068 100644 --- a/.env +++ b/.env @@ -1 +1,2 @@ +SQLX_OFFLINE=true DATABASE_URL=postgresql://postgres:postgres@127.0.0.1:5432/postgres diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 000000000..71bbbe768 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,4 @@ +# Ensure consistent line endings for SQL files across all platforms +# This is required for sqlx offline mode to generate consistent query hashes +# see https://github.com/launchbadge/sqlx/issues/1494 +*.sql text eol=lf diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index c39fc03d7..3653df224 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -12,6 +12,7 @@ on: - "Cargo.lock" - "rust-toolchain.toml" - "rustfmt.toml" + - ".env" # or in js packages - "packages/**" # or in workflows diff --git a/crates/pgls_lsp/tests/server.rs b/crates/pgls_lsp/tests/server.rs index 41c6665f9..e4798c536 100644 --- a/crates/pgls_lsp/tests/server.rs +++ b/crates/pgls_lsp/tests/server.rs @@ -858,19 +858,18 @@ async fn test_execute_statement(test_db: PgPool) -> Result<()> { server.load_configuration().await?; let users_tbl_exists = async || { - let result = sqlx::query!( + sqlx::query_scalar::<_, bool>( r#" select exists ( - select 1 as exists + select 1 from pg_catalog.pg_tables where tablename = 'users' - ); - "# + ) + "#, ) .fetch_one(&test_db.clone()) - .await; - - result.unwrap().exists.unwrap() + .await + .unwrap() }; assert!(