Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add better instructions for flask migrate #19

Merged
merged 1 commit into from
Jul 12, 2023
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
17 changes: 16 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,14 +68,29 @@ curl http://localhost:5000/connectors

## Database changes

If there any changes made to the model run the migrate command (example commment)
If there any changes made to the model first ensure that it is added to the list of imports in
`backend/app/__init_.py` before the following line

```
migrate = Migrate(app, db)
```

This allows alembic and flask migrate to see all the models in use so the migrations can be
generated correctly.

Once that is done, then you need to run the migrate command (example commment)
and if any changes were detected, update your local DB instance.

```
FLASK_APP=copilot.py flask db migrate -m "Add User model."
FLASK_APP=copilot.py flask db upgrade
```

Review the generated migration file to make sure the changes to the databse make sense in terms
of what is needed to upgrade from the previous state, and then to downgrade to remove this migration.

Don't forget to commit the new migration file into git.

See https://flask-migrate.readthedocs.io/en/latest/ for further information

# Deployment
Expand Down
File renamed without changes.