Skip to content

Commit

Permalink
made sure to use cargo sqlx consistently in the CLI instead of the …
Browse files Browse the repository at this point in the history
…`sqlx` shortcut
  • Loading branch information
CommanderStorm committed May 17, 2024
1 parent fb20bcd commit 644b43b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
4 changes: 2 additions & 2 deletions server/main-api/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ cargo install sqlx-cli
Migrations can be added using

```bash
sqlx migrate add -r <migration-name>
cargo sqlx migrate add -r <migration-name>
```

### Adding/editing database queries
Expand All @@ -81,7 +81,7 @@ To get compiletime guarantees for our queries, we use sqlx.
To add/edit a query, you will need to run the following command:

```bash
sqlx migrate run --database-url postgres://postgres:password@localhost:5432/postgres
cargo sqlx migrate run --database-url postgres://postgres:password@localhost:5432/postgres
cargo sqlx prepare --database-url postgres://postgres:password@localhost:5432/postgres --workspace
```

Expand Down
4 changes: 1 addition & 3 deletions server/main-api/src/setup/database/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,7 @@ async fn load_data(
tx: &mut sqlx::Transaction<'_, sqlx::Postgres>,
) -> Result<(), crate::BoxedError> {
info!("deleting old data");
sqlx::query!("DELETE FROM aliases")
.execute(&mut **tx)
.await?;
sqlx::query!("DELETE FROM aliases").execute(&mut **tx).await?;
sqlx::query!("DELETE FROM en").execute(&mut **tx).await?;
sqlx::query!("DELETE FROM de").execute(&mut **tx).await?;

Expand Down

0 comments on commit 644b43b

Please sign in to comment.