I'm trying to run postgres database in offline mode using the sqlx cli
by running the command sqlx prepare
to prepare the sqlx-data.json
file to work offline per these instructions:
I've set this environment variable SQLX_OFFLINE=true in my .env
file and am getting the following error and am passing in the --database-url
like so:
✦ ❯ cargo sqlx prepare -- --bin my-project --database-url postgres://postgres@localhost?db_name=postgres&user=postgres&password=postgres
[1] 13748
[2] 13749
[2]+ Done user=postgres
✦2 ❯ error: The following required arguments were not provided:
--database-url <database-url>
USAGE:
cargo sqlx prepare <args>... --database-url <database-url>
For more information try --help
^C^C
I'm confused by this because the command seems to succeed, and then a few seconds later, I get an error message.
I'm explicitly asked to provide a bin and am wondering how to provide BOTH a database-url
and a bin name
. Seems like I can only work with one or the other, but am getting errors for both?
✦ ❯ error: extra arguments to `rustc` can only be passed to one target, consider filtering
the package by passing, e.g., `--lib` or `--bin NAME` to specify a single target
error: `cargo check` failed with status: exit status: 101
cargo sqlx prepare --database-url postgres://postgres@localhost?db_name=postgres&user=postgres&password=postgres
[1]+ Exit 1 cargo sqlx prepare --database-url postgres://postgres@localhost?db_name=postgres
[1] 14236
[2] 14237
[2]+ Done user=postgres
✦2 ❯ error: extra arguments to `rustc` can only be passed to one target, consider filtering
the package by passing, e.g., `--lib` or `--bin NAME` to specify a single target
error: `cargo check` failed with status: exit status: 101
^C
[1]+ Exit 1 cargo sqlx prepare --database-url postgres://postgres@localhost?db_name=postgres
Any help would be greatly appreciated. Thanks in advance!