Skip to content

Commit 82d5b38

Browse files
authored
chore: set SQLX_OFFLINE=true (#587)
we are preparing anyways and without `SQLX_OFFLINE`, offline builds have to remove the `.env` file first (e.g. homebrew)
1 parent 1e374ac commit 82d5b38

File tree

4 files changed

+12
-7
lines changed

4 files changed

+12
-7
lines changed

.env

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1+
SQLX_OFFLINE=true
12
DATABASE_URL=postgresql://postgres:postgres@127.0.0.1:5432/postgres

.gitattributes

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Ensure consistent line endings for SQL files across all platforms
2+
# This is required for sqlx offline mode to generate consistent query hashes
3+
# see https://github.com/launchbadge/sqlx/issues/1494
4+
*.sql text eol=lf

.github/workflows/pull_request.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ on:
1212
- "Cargo.lock"
1313
- "rust-toolchain.toml"
1414
- "rustfmt.toml"
15+
- ".env"
1516
# or in js packages
1617
- "packages/**"
1718
# or in workflows

crates/pgls_lsp/tests/server.rs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -858,19 +858,18 @@ async fn test_execute_statement(test_db: PgPool) -> Result<()> {
858858
server.load_configuration().await?;
859859

860860
let users_tbl_exists = async || {
861-
let result = sqlx::query!(
861+
sqlx::query_scalar::<_, bool>(
862862
r#"
863863
select exists (
864-
select 1 as exists
864+
select 1
865865
from pg_catalog.pg_tables
866866
where tablename = 'users'
867-
);
868-
"#
867+
)
868+
"#,
869869
)
870870
.fetch_one(&test_db.clone())
871-
.await;
872-
873-
result.unwrap().exists.unwrap()
871+
.await
872+
.unwrap()
874873
};
875874

876875
assert!(

0 commit comments

Comments
 (0)