Skip to content

Commit 1237e7f

Browse files
authored
Use common prefix for db-migrate commands (#189)
1 parent 5297c13 commit 1237e7f

File tree

2 files changed

+16
-15
lines changed

2 files changed

+16
-15
lines changed

app/Makefile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ check: format-check lint test
116116
# Docker starts the image for the DB but it's not quite
117117
# fully ready, so add a 5 second sleep so upgrade doesn't
118118
# fail because the DB hasn't started yet.
119-
init-db: start-db sleep-5 db-upgrade
119+
init-db: start-db sleep-5 db-migrate
120120

121121
start-db:
122122
docker-compose up --detach main-db
@@ -131,13 +131,13 @@ db-recreate: clean-volumes init-db
131131
alembic_config := ./src/db/migrations/alembic.ini
132132
alembic_cmd := $(PY_RUN_CMD) alembic --config $(alembic_config)
133133

134-
db-upgrade: ## Apply pending migrations to db
134+
db-migrate: ## Apply pending migrations to db
135135
$(PY_RUN_CMD) db-migrate
136136

137-
db-downgrade: ## Rollback last migration in db
137+
db-migrate-down: ## Rollback last migration in db
138138
$(PY_RUN_CMD) db-migrate-down
139139

140-
db-downgrade-all: ## Rollback all migrations
140+
db-migrate-down-all: ## Rollback all migrations
141141
$(PY_RUN_CMD) db-migrate-down-all
142142

143143
check-migrate-msg:

docs/app/database/database-management.md

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
# Database Management
22

3-
- [Basic operations](#basic-operations)
4-
- [Initialize](#initialize)
5-
- [Start](#start)
6-
- [Destroy and reinitialize](#destroy-and-reinitialize)
7-
- [Running migrations](#running-migrations)
8-
- [Creating new migrations](#creating-new-migrations)
9-
- [Multi-head situations](#multi-head-situations)
3+
- [Database Management](#database-management)
4+
- [Basic operations](#basic-operations)
5+
- [Initialize](#initialize)
6+
- [Start](#start)
7+
- [Destroy and reinitialize](#destroy-and-reinitialize)
8+
- [Running migrations](#running-migrations)
9+
- [Creating new migrations](#creating-new-migrations)
10+
- [Multi-head situations](#multi-head-situations)
1011

1112
## Basic operations
1213
### Initialize
@@ -43,9 +44,9 @@ against your db so it has all the required tables. `make init` does this, but if
4344
needing to work with the migrations directly, some common commands:
4445

4546
```sh
46-
make db-upgrade # Apply pending migrations to db
47-
make db-downgrade # Rollback last migration to db
48-
make db-downgrade-all # Rollback all migrations
47+
make db-migrate # Apply pending migrations to db
48+
make db-migrate-down # Rollback last migration to db
49+
make db-migrate-down-all # Rollback all migrations
4950
```
5051

5152
## Creating new migrations
@@ -54,7 +55,7 @@ If you've changed a python object model, auto-generate a migration file for the
5455

5556
```sh
5657
$ make db-migrate-create MIGRATE_MSG="<brief description of change>"
57-
$ make db-upgrade
58+
$ make db-migrate
5859
```
5960

6061
<details>

0 commit comments

Comments
 (0)