Skip to content

Commit

Permalink
fix(zkstack): shouldn't attempt to create db on migrate command (#3468)
Browse files Browse the repository at this point in the history
## What ❔
`zkstack dev migrate` attempts to create a database first before
performing the migration. It should instead only try to perform the
migration, and fail if the database does not exist.

## Why ❔
Keeping the create database command may potentially drop and recreate
the database - the current behaviour of `cargo sqlx database create`
doesn't do this, but it may change in the future. Furthermore, even if
the database doesn't exist, it doesn't make sense for a migrate command
to perform database creation.

## Checklist
- [x] PR title corresponds to the body of PR (we generate changelog
entries from PRs).
- [x] Tests for the changes have been added / updated.
- [x] Documentation comments have been added / updated.
- [x] Code has been formatted via `zkstack dev fmt` and `zkstack dev
lint`.
  • Loading branch information
albertlai431 authored Jan 14, 2025
1 parent 8518b3e commit c156e79
Showing 1 changed file with 0 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,6 @@ fn migrate_database(shell: &Shell, link_to_code: impl AsRef<Path>, dal: Dal) ->
MSG_DATABASE_MIGRATE_GERUND,
&dal.path,
));
Cmd::new(cmd!(
shell,
"cargo sqlx database create --database-url {url}"
))
.run()?;
Cmd::new(cmd!(shell, "cargo sqlx migrate run --database-url {url}")).run()?;
spinner.finish();

Expand Down

0 comments on commit c156e79

Please sign in to comment.