Open ansrivas opened 3 years ago
NOTE: In case others are following different methods to run migrations, please feel free to recommend here.
You know you can embedded migrations with sqlx::migrate!("./migrations")
within you program binary? That's the best way to do it in my opinion and deploy, since you don't even need to push the migrations files into the container.
NOTE: In case others are following different methods to run migrations, please feel free to recommend here.
You know you can embedded migrations with
sqlx::migrate!("./migrations")
within you program binary? That's the best way to do it in my opinion and deploy, since you don't even need to push the migrations files into the container.
@dragonnn oh thanks, I didn't know this. In fact, this solves this completely.
Some people use kube and would like to run migrations on deploy using init or helm charts so this would be useful.
Being able to download a pre-compiled binary would be way faster in CI workflows such as GitHub Actions. Currently, it takes around 4m 30sec to install the CLI while downloading a binary would be a matter of seconds.
I'd like binaries, building sqlx-cli takes up a decent chunk of my runner's time.
is there a github action that does this automatically?
is there a github action that does this automatically?
Not to my knowledge, but you can cache the ~/.cargo/bin folder in between workflow runs so it doesn't need to install after the first build, e.g.:
- name: Cache Cargo binaries
uses: actions/cache@v3
with:
path: ~/.cargo/bin
key: ${{ runner.os }}-cargo-bin
...
- name: Install sqlx-cli
run: cargo install sqlx-cli --no-default-features --features native-tls,postgres
cargo install
will skip installing if the latest version is already in the cache-restored ~/.cargo/bin
.
Hi, I was wondering if it would make sense to release the binary of
sqlx-cli
probably statically compiled?The use case is to simply wrap it up in a docker-container and use it for migrations. The motivation here is, this just makes it very easy to fetch the binary and use it as it is.
I did something similar in my fork here - https://github.com/ansrivas/sqlx/releases/tag/v0.5.5
NOTE: In case others are following different methods to run migrations, please feel free to recommend here. Thanks