mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-07-25 03:58:39 +02:00
Merge pull request #627 from cisagov/rjm/document-local-migrations
Document local migrations, mention --wait for cf migrations
This commit is contained in:
commit
9b2c6ca045
1 changed files with 18 additions and 3 deletions
|
@ -12,19 +12,34 @@ to get a `psql` shell on the sandbox environment's database.
|
|||
|
||||
## Running Migrations
|
||||
|
||||
When new code changes the database schema, we need to apply Django's migrations.
|
||||
When new code changes the database schema (ie, you change a model or pull some
|
||||
code that has), we need to apply Django's migrations.
|
||||
|
||||
### On Local
|
||||
|
||||
```shell
|
||||
docker-compose exec app bash
|
||||
./manage.py makemigrations
|
||||
```
|
||||
|
||||
Then perform docker-compose down & docker-compose up to run with the new migrations.
|
||||
|
||||
### On Cloud.gov
|
||||
|
||||
We can run these using CloudFoundry's tasks to run the `manage.py migrate`
|
||||
command in the correct environment. For any developer environment, developers
|
||||
can manually run the task with
|
||||
|
||||
```shell
|
||||
cf run-task getgov-ENVIRONMENT --command 'python manage.py migrate' --name migrate
|
||||
cf run-task getgov-ENVIRONMENT --wait --command 'python manage.py migrate' --name migrate
|
||||
```
|
||||
|
||||
(The optional 'wait' argument will wait until the environment is stable)
|
||||
|
||||
Optionally, load data from fixtures as well
|
||||
|
||||
```shell
|
||||
cf run-task getgov-ENVIRONMENT --command 'python manage.py load' --name loaddata
|
||||
cf run-task getgov-ENVIRONMENT --wait --command 'python manage.py load' --name loaddata
|
||||
```
|
||||
|
||||
For the `stable` environment, developers don't have credentials so we need to
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue