Skip to content

Commit

Permalink
Merge pull request #148 from codeforboston/dev_postgres
Browse files Browse the repository at this point in the history
Flagging website 1.2
  • Loading branch information
dwreeves authored Dec 16, 2020
2 parents bdbf257 + c3baa3f commit b1b6ba3
Show file tree
Hide file tree
Showing 41 changed files with 7,427 additions and 477 deletions.
5 changes: 0 additions & 5 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,7 @@ All of these tools are added and configured inside `mkdocs.yml`. Note you need t
If you have write permission to the upstream repository (i.e. you are a project manager), point your terminal to this directory and run the following:

```shell script
python3 -m venv mkdocs_env
source mkdocs_env/bin/activate
pip install mkdocs pymdown-extensions mkdocs-material mkdocs-macros-plugin pygments
mkdocs gh-deploy --remote-name upstream
deactivate
source ../venv/bin/activate
```

If you do not have write permission to the upstream repository, you can do one of the following:
Expand Down
46 changes: 46 additions & 0 deletions docs/docs/cloud/heroku_deployment.md
Original file line number Diff line number Diff line change
Expand Up @@ -196,3 +196,49 @@ git remote -v
```
git push staging master
```

## Updating the database schema

We do not use Alembic or any other tools to handle database migrations. Our database is relatively simple and does not store information that cannot be trivially rewritten, so we can migrate to a new database schema by simply creating the new database locally and completely overwriting the database in production.

Here are the steps to do that:

1. Make your changes to the database schema.

```shell
flask create-db --overwrite
flask init-db
```

2. Reset the database. You'll be asked if you're sure you want to reset, and go through that prompt.

```shell
heroku pg:reset -a crwa-flagging
```

3. Get a list of add-ons for the Heroku app. You'll need it for the final step.

```shell
heroku addons -a crwa-flagging
```

???+ success
You should see something like this:

```
Add-on Plan Price State
──────────────────────────────────────────── ───────── ───── ───────
heroku-postgresql (postgresql-ukulele-12345) hobby-dev free created
└─ as DATABASE

scheduler (scheduler-banjo-67890) standard free created
└─ as SCHEDULER

The table above shows add-ons and the attachments to the current app (crwa-flagging) or other apps.
```

4. Take the add-on name for the DATABASE in parentheses (in the above case, `postgresql-ukulele-12345`) as the target for the Postgres push command:

```shell
heroku pg:push flagging postgresql-ukulele-12345 -a crwa-flagging
```
Loading

0 comments on commit b1b6ba3

Please sign in to comment.