Commit graph

141 commits

Author SHA1 Message Date
Pedro de Matos Fedricci
c30a4a5d88
Add --source for migration subcommands (#1769) 2022-04-01 12:19:51 -07:00
LovecraftianHorror
feff96c460
fix(sqlx-cli): pass the DATABASE_URL to command spawned for sqlx-macros (#1735) 2022-03-09 10:24:00 -06:00
Austin Bonander
eaf41fd092
prepare 0.5.11 release (#1715) 2022-02-18 13:49:06 -08:00
Fredrik Park
e7a50d3501
Document Offline mode with feature flags (#1665)
I ran into this and found the solution inside of this issue https://github.com/launchbadge/sqlx/issues/1593
Fixes #1593
2022-02-15 21:14:04 -08:00
Marcin Puc
313cc69988
Simplify cargo-sqlx cmdline definition (#1626)
* Simplify cargo-sqlx cmdline definition

* Add note about the parser definition for cargo-sqlx

* Fix formatting
2022-02-15 20:13:42 -08:00
Liam
7fb54d3d7b
Add checksum mismtaches to sqlx-cli migrate info (#1680)
This fixes #870
2022-02-15 20:11:06 -08:00
Austin Bonander
8e46e17ce0
docs: fix install instructions for sqlx-cli 2022-01-03 13:32:58 -08:00
Austin Bonander
fdbfc5dfc3
Prepare 0.5.10 release (#1603)
* fix(cli): change new `rustls` and `native-tls` features to use correct runtime feature

* chore: upgrade SQLx crates to 0.5.10, upgrade all dependencies to latest versions

chore(cli): upgraded `clap` to `3.0.0-rc.9`

* fix(tests/sqlite): ignore `issue_1467()` as spuriously failing

I'm well aware of the principle that a spuriously failing test is a failing test, but even though I have it outputting the seed used with a reproducible PRNG, I can't reproduce the failures locally, so 🤷.

* chore: add CHANGELOG entry for 0.5.10
2021-12-29 17:25:49 -08:00
SonicZentropy
aa40f5fe5d
[CLI] Adds feature enabling Rustls usage rather than OpenSSL (#1584)
* Adds feature enabling Rustls usage rather than OpenSSL

* Update sqlx-cli/Cargo.toml

Removes extraneous openssl feature that slipped through

Co-authored-by: Austin Bonander <austin.bonander@gmail.com>

Co-authored-by: Austin Bonander <austin.bonander@gmail.com>
2021-12-29 15:49:49 -08:00
Thomas Kintscher
f0d0f2f2e9
Append to existing RUSTFLAGS, instead of overwriting. (#1582)
* Append to existing RUSTFLAGS, instead of overwriting.

* Assemble RUSTFLAGS correctly.

Co-authored-by: Thomas Kintscher <thomas@flowciety.de>
2021-12-20 19:12:58 -08:00
Austin Bonander
c8db803dca
fix(sqlx-cli/readme): mention openssl-vendored 2021-11-09 18:02:32 -08:00
Austin Bonander
9abe9b3ac5
prepare 0.5.9 hotfix release (#1469) 2021-10-01 15:52:52 -07:00
Austin Bonander
1b5dd6514b
preparing 0.5.8 release (#1466)
* preparing 0.5.8 release

* fix warnings before release
2021-10-01 14:45:25 -07:00
Erik
efde5c507f
Add reverting instructions to README (#1468)
Instructions on reverting migrations are missing from the README. Here are some that others may find helpful.
2021-10-01 13:44:48 -07:00
David James
bb33a296cb
Fix issue #1431 (#1432)
Why: dotenv() must execute before clap's get_matches()

Co-authored-by: David James <davidcjames@gmail.com>
2021-09-10 15:06:49 -07:00
David James
ad81e35f28
Use promptly instead of dialoguer (#1410)
See #1409

Co-authored-by: David James <davidcjames@gmail.com>
2021-08-30 14:10:53 -07:00
Evan Cameron
0e51272b72
fix(cli) move database_url #1391 (#1400) 2021-08-30 14:10:01 -07:00
Austin Bonander
3749e0ea37
chore: prepare 0.5.7 (hotfix) release (#1394) 2021-08-20 17:14:42 -07:00
Austin Bonander
207e6db2ce
chore: bump versions of sqlx-* in dependencies 2021-08-17 12:49:02 -07:00
Austin Bonander
6bb1c716bd
preparing 0.5.6 release (#1382)
* fix(pool): reenable connection reaper

* fix warnings

* chore: bump published crates to 0.5.6

* chore: update CHANGELOG.md for 0.5.6
2021-08-17 12:44:24 -07:00
Austin Bonander
38435ca647
fix(cli): pin clap_derive version (#1381)
When `clap_derive 3.0.0-beta.4` released, new invocations of `cargo install sqlx-cli` would try to compile that against `clap 3.0.0-beta.2` which caused some breakages.

Until `clap 3.0.0` proper is released, we need to pin both versions to insure against potential breakages from automatic upgrades.

closes #1378
2021-08-16 16:51:31 -07:00
Austin Bonander
e89cb0971a
fix(macros): tell the compiler about external files/env vars to watch (#1332)
* fix(macros): tell the compiler about external files/env vars to watch

closes #663
closes #681

* feat(cli): add `migrate` subcommand for generating a build script

suggest embedding migrations on `sqlx migrate add` in a new project
2021-07-21 16:36:22 -07:00
Jonas Platte
4986ea2e59
Improve root README.md and sqlx-cli/README.md (#1262)
* readme: Fix inconsistent list style

* readme: Improve text alignment

* readme: Fix missing links

* readme: Consistently use code formatting for runtime & TLS crates and dedup links

* readme: Add SQLx is not an ORM section

* readme: Improve documentation about offline mode
2021-05-30 15:52:25 -07:00
Ryan Leckey
694a2ac478 release: v0.5.5 2021-05-24 09:34:34 -07:00
Ryan Leckey
5d9c292132 release: v0.5.4 2021-05-22 16:38:54 -07:00
Ryan Leckey
13f7c7124a release: v0.5.3 2021-05-21 17:27:15 -07:00
Kitsu
be88631b5e Remove redundant args default notice 2021-04-27 12:35:46 -07:00
Stephen W
212d235334
Try to make 'no queries found' message more clear (#1191)
* try to make 'no queries found' message more clear

* Be more polite
2021-04-26 00:40:33 -07:00
Ryan Leckey
f7775f7fde release: 0.5.2 2021-04-15 18:40:46 -07:00
Ryan Leckey
633a662752 chore: update dependencies 2021-04-09 00:31:07 -07:00
Benjamin Bäumler
fc6eb6363b sqlx-cli database reset fix confirmation flag
sqlx database reset currenctly requires no confirmation and a
confirmation when -y flag is set. Should be the other way around
as it is for sqlx database drop. This commit fixes this.
2021-04-09 00:12:27 -07:00
Vyacheslav Gudkov
674d89bbab Removed unnecessarey preserve_order feature for serde_json. More reliable serialization-desetislization of sqlx-data.json. Added unit tests for sqlx-data.json serialization-deserialization
Signed-off-by: Vyacheslav Gudkov <vyacheslav.gudkov@dsr-corporation.com>
2021-04-09 00:10:32 -07:00
Evgeny Nosov
85ff651ba1 Add ignore_missing parameter 2021-04-08 23:50:39 -07:00
Evgeny Nosov
8950332ca3 Rewrite migration algorithm in order to apply also unapplied migrations 2021-04-08 23:50:39 -07:00
Ryan Leckey
cbe820760f
release: 0.5.1 2021-02-04 09:16:11 -08:00
Ryan Leckey
8da44b9898
cli: update README 2021-02-04 06:37:46 -08:00
Ryan Leckey
94d0baeb52
release: 0.5 2021-02-04 06:32:50 -08:00
AriusX7
ed20639d47 Move Cargo.toml check to run_prepare_step 2021-01-31 16:55:57 -08:00
AriusX7
264cb09528 Don't require Cargo.toml for all subcommands 2021-01-31 16:55:57 -08:00
Emilio González
df6a2a2eb6 Update sqlx-cli/README.md 2021-01-29 07:13:07 +08:00
Jonas Platte
cdafc8ae17 Upgrade async runtime dependencies
Co-authored-by: Josh Toft <joshtoft@gmail.com>
Co-authored-by: Philip A Reimer <antreimer@gmail.com>
2021-01-20 21:49:46 -08:00
Jonas Platte
0758ffd10e Remove cargo_metadata dependency
It was not pulling its weight.

Just look at that Cargo.lock diff!
2021-01-13 23:05:56 -08:00
Jonas Platte
501be329e7 Fix docs for cargo sqlx prepare 2021-01-13 23:05:56 -08:00
Jonas Platte
d2d56c69fa [offline] Don't read sqlx-data.json into a String before parsing 2021-01-13 23:05:56 -08:00
Jonas Platte
52a7c35439 [offline] Use buffering for JSON file reading / writing 2021-01-13 23:05:56 -08:00
Joe Grund
3e1da43434 Support workspaces for offline feature
This patch enables having a top-level `sqlx-data.json` file within a
workspace.

It does this by using a full clean / check instead of `cargo rustc`
which fails on a workspace.

A `--merged` flag is introduced to switch to the workspace behavior

Fixes #353.

Signed-off-by: Joe Grund <jgrund@whamcloud.io>
2020-12-19 05:17:07 +00:00
sid
e8c073c5e2 fix migrate marco to take migration type 2020-11-24 16:04:43 -08:00
sid
f41551f3ad reversible migrations for cli
- adds a -r flag whihc will create a reversible migration
- add revert subcommand, which reverts the last migration
- add --dry-run flag to migration run command, which list the migrations that will be applied
- updates add migration to check if all migration are of same type, i.e cannot mix and match reversible and simple migrations
2020-11-24 16:04:43 -08:00
Jonas Platte
3c7c266eac Fix some clippy lints 2020-11-19 14:04:07 -08:00
Tyler Hallada
672f724aac Bump version in sqlx-cli README to 0.2.0
I was getting an error while running `cargo sqlx prepare` while on `sqlx` version 0.4.1:

```
error: EOF while parsing an object at line 34 column 6
```

Then I realized that I had version 0.1.0-beta.1 of sqlx-cli but 0.2.0 was released on cargo.

I upgraded to 0.2.0 and the command succeeded.

I figured that the README was mistakenly not updated with the release.
2020-11-14 21:27:52 -08:00
Ryan Leckey
f2d55bc049 sqlx-cli: prepare v0.2.0 2020-11-12 07:50:31 -08:00
Ryan Leckey
12da5ba534 fix: usage of migrate::run now takes two parameters 2020-11-12 07:38:54 -08:00
Jonas Platte
a161bcba05 Rename cargo features in preparation for rustls support 2020-11-12 07:32:21 -08:00
Stuart Hinson
c91eb2b04a use default_value for migrations source 2020-11-12 07:13:01 -08:00
Stuart Hinson
a4729cdcc8 Add source param to command line 2020-11-12 07:13:01 -08:00
Ivan Tham
6a5c54be70 Add context of where to put the offline feature 2020-11-03 22:50:37 -08:00
Jonas Platte
4fda8be005 Fix documentation for SQLX_OFFLINE environment variable 2020-10-29 22:21:57 -07:00
Jonas Platte
139704f264 Pass SQLX_OFFLINE=false to rustc in prepare
Without this, `cargo sqlx prepare` is just an expensive no-op and
`cargo sqlx prepare --check` checks `sqlx-data.json` against itself.
2020-10-29 22:21:27 -07:00
Jonas Platte
f45f9ae8ed Fix a typo 2020-10-29 22:21:27 -07:00
Chloe Ross
e816943c60 fix(cli): wait for newlines for confirmations 2020-10-23 19:33:13 -07:00
Jonas Platte
e00d8aaa5a Bump clap version
This time use an exact version requirement since it would otherwise be
upgraded to later betas automatically.
2020-10-13 10:04:05 -07:00
Jonas Platte
e3a71f095c Delete target/sqlx before invoking cargo in cargo sqlx prepare 2020-10-13 09:51:10 -07:00
Kramer Hampton
2e1658e08b feat: adds the setup command to the sqlx-cli
The reset command is the equivalent of `sqlx db create`,
and `sqlx migrate run`.
2020-09-10 21:32:04 -07:00
Kramer Hampton
916f1fccf2 feat: adds the reset command to the sqlx-cli
The reset command is the equivalent of `sqlx db drop`, `sqlx db create`,
and `sqlx migrate run`. Unless the `-y` parameter is specified, it will
prompt confirmation before dropping the database.
2020-09-10 21:32:04 -07:00
LMJW
48a55a407b fix(issue #558)
- check the existance of `Cargo.toml` at current working directory
  before checking 'DATABASE_URL' environment variable
2020-08-19 18:00:40 -07:00
Stuart Hinson
2ec5ff06b0 Add --database-url to command line 2020-08-17 20:06:26 -07:00
Matt Paul
9ed6428c8e Fix incorrect bash command 2020-08-10 18:22:10 -07:00
aspen
94413bd830 sqlx-cli: Exit with code 1 on error. 2020-07-29 12:04:12 -07:00
Max Countryman
904ba018da ensure installation instructions account for prerelease 2020-07-29 07:09:48 -07:00
Ryan Leckey
22f1f93b79 chore: prepare sqlx v0.4.0-beta.1 and sqlx-cli v0.1.0-beta.1 2020-07-27 01:43:02 -07:00
Ryan Leckey
f298eb3cf1 Merge remote-tracking branch 'raftario/embedded-migrations' 2020-07-26 18:03:59 -07:00
Jonas Platte
adfa2d2161 sqlx-cli: Upgrade console dependency 2020-07-24 07:54:06 -07:00
Jonas Platte
979ddeb222 cargo-sqlx-cli: Fix exiting with 0 on failure 2020-07-24 07:54:06 -07:00
Raphaël Thériault
92646e00b8 Fix migrate! and add migration test 2020-07-23 17:46:27 -04:00
Raphaël Thériault
e5e9665bd9 Add migrate! macro for embedded migrations 2020-07-23 14:22:50 -04:00
Jonas Platte
d79335d955 Add an openssl-vendored feature to sqlx-cli
… to allow building for musl targets
2020-07-21 08:01:55 -07:00
Jonas Platte
4c394de70b Add SQLX_OFFLINE env variable to force metadata usage 2020-07-17 01:12:07 -07:00
Ryan Leckey
8de2419b14 style: rustfmt 2020-07-14 05:05:50 -07:00
Ryan Leckey
c0dd364e58 Add a warning if there were no queries found 2020-07-14 05:05:11 -07:00
Ryan Leckey
61e4a4f566 feat: finish v1 of both cli and embedded migrations 2020-07-12 03:43:55 -07:00
Austin Bonander
37e59f1494
doc(readme): note requirement of offline feature
for `cargo sqlx prepare`
2020-06-17 12:50:56 -07:00
Austin Bonander
1a83f1bdc1
fix(format): fix formatting in sqlx-cli/README.md 2020-06-17 12:46:57 -07:00
Ryan Leckey
51ae9f00e7
chore: bump version to 0.4.0-pre 2020-05-30 23:15:52 -07:00
Ryan Leckey
990466ec02
fix(cli): fix core usage in sqlx-cli 2020-05-30 23:12:53 -07:00
Austin Bonander
1bdc3e9057 cargo sqlx prepare: fix to consistently trigger recompile 2020-05-30 16:02:37 -07:00
Austin Bonander
119167e13a cargo sqlx prepare: delete query-*.json files as they're read 2020-05-30 16:02:37 -07:00
Austin Bonander
07639a61ac sqlx-cli/README.md: document that <command> --help exists 2020-05-30 16:02:37 -07:00
Austin Bonander
9729385257 sqlx_cli::db::run_drop: actually print the database name in confirm 2020-05-30 16:02:37 -07:00
Austin Bonander
35fd6f64cc allow cargo sqlx prepare to pass trailing args to Cargo
remove unused import
2020-05-30 16:02:37 -07:00
Austin Bonander
41dd286356 set sqlx-cli license to MIT/Apache 2.0 2020-05-30 16:02:37 -07:00
Austin Bonander
7dae3dbf57 rename cargo-sqlx -> sqlx-cli
edit README
2020-05-30 16:02:37 -07:00