Skip to content

Commit b1b6ba3

Browse files
authored
Merge pull request #148 from codeforboston/dev_postgres
Flagging website 1.2
2 parents bdbf257 + c3baa3f commit b1b6ba3

41 files changed

Lines changed: 7427 additions & 477 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

docs/README.md

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,7 @@ All of these tools are added and configured inside `mkdocs.yml`. Note you need t
1919
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:
2020

2121
```shell script
22-
python3 -m venv mkdocs_env
23-
source mkdocs_env/bin/activate
24-
pip install mkdocs pymdown-extensions mkdocs-material mkdocs-macros-plugin pygments
2522
mkdocs gh-deploy --remote-name upstream
26-
deactivate
27-
source ../venv/bin/activate
2823
```
2924

3025
If you do not have write permission to the upstream repository, you can do one of the following:

docs/docs/cloud/heroku_deployment.md

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,3 +196,49 @@ git remote -v
196196
```
197197
git push staging master
198198
```
199+
200+
## Updating the database schema
201+
202+
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.
203+
204+
Here are the steps to do that:
205+
206+
1. Make your changes to the database schema.
207+
208+
```shell
209+
flask create-db --overwrite
210+
flask init-db
211+
```
212+
213+
2. Reset the database. You'll be asked if you're sure you want to reset, and go through that prompt.
214+
215+
```shell
216+
heroku pg:reset -a crwa-flagging
217+
```
218+
219+
3. Get a list of add-ons for the Heroku app. You'll need it for the final step.
220+
221+
```shell
222+
heroku addons -a crwa-flagging
223+
```
224+
225+
???+ success
226+
You should see something like this:
227+
228+
```
229+
Add-on Plan Price State
230+
──────────────────────────────────────────── ───────── ───── ───────
231+
heroku-postgresql (postgresql-ukulele-12345) hobby-dev free created
232+
└─ as DATABASE
233+
234+
scheduler (scheduler-banjo-67890) standard free created
235+
└─ as SCHEDULER
236+
237+
The table above shows add-ons and the attachments to the current app (crwa-flagging) or other apps.
238+
```
239+
240+
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:
241+
242+
```shell
243+
heroku pg:push flagging postgresql-ukulele-12345 -a crwa-flagging
244+
```

0 commit comments

Comments
 (0)