Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ start-db:
docker-compose up --detach main-db

## Destroy current DB, setup new one
db-recreate: clean-docker-volumes init-db
db-recreate: clean-volumes init-db

#########################
# DB Migrations
Expand Down
2 changes: 1 addition & 1 deletion docs/app/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ root
## Information

* [API Technical Overview](./technical-overview.md)
* [Database Migrations](./database/database-migrations.md)
* [Database Management](./database/database-management.md)
* [Formatting and Linting](./formatting-and-linting.md)
* [Writing Tests](./writing-tests.md)

Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,40 @@
# Database Migrations
# Database Management

- [Basic operations](#basic-operations)
- [Initialize](#initialize)
- [Start](#start)
- [Destroy and reinitialize](#destroy-and-reinitialize)
- [Running migrations](#running-migrations)
- [Creating new migrations](#creating-new-migrations)
- [Multi-head situations](#multi-head-situations)
- [Deployment](#deployment)
- [Removing a column](#removing-a-column)
- [Removing a table](#removing-a-table)

## Basic operations
### Initialize

To start a local Postgres database container in a detached state and run any
pending migrations, run `make init-db`. During initial setup, `init-db` is called
automatically when running `make init`.

### Start

To only start the database container, run the following command:

```sh
make start-db
```
This command is not needed when starting the application with `make start`

### Destroy and reinitialize

To clean the database, use the following command:

```sh
make db-recreate
```

This will remove _all_ docker project volumes, rebuild the database volume, and
run all pending migrations. Once completed, only the database container will be
running. Simply run `make start` to bring up all other project containers.

## Running migrations

Expand Down