-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add script and instructions to apply local migrations. (#58)
* make: add `make apply_migration name=folder-name` entrypoint. * docs: add README instructions to apply migrations.
- Loading branch information
Showing
3 changed files
with
52 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -71,3 +71,6 @@ shell: | |
|
||
shell_clean: | ||
iex -S mix run --no-start | ||
|
||
apply_migration: | ||
./apply-local-migration.sh $(name) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
if [ -z "$1" ] | ||
then | ||
echo "Specify the migration using \`make apply_migration name=<migration folder name>\`." | ||
|
||
exit 1 | ||
fi | ||
|
||
data="{\"vsn\":\"$1\"}" | ||
json='Content-Type: application/json' | ||
|
||
curl -v -X PUT http://localhost:5050/api/migrations/postgres_1 -H $json -d $data | ||
curl -v -X PUT http://localhost:5050/api/migrations/postgres_2 -H $json -d $data |