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

How to extend the DB schema? #43

Open
flopp opened this issue Jul 12, 2020 · 3 comments
Open

How to extend the DB schema? #43

flopp opened this issue Jul 12, 2020 · 3 comments

Comments

@flopp
Copy link
Owner

flopp commented Jul 12, 2020

For #42 the DB schema needs to be extended. How to do this in Sqlalchemy such that old DB files can still be loaded (and extended on the fly)?

@Djailla
Copy link

Djailla commented Jul 12, 2020

Sqlalchemy does it automatically

@flopp
Copy link
Owner Author

flopp commented Jul 12, 2020

Hm, I just added an average_heartrate column to the Activity class in db.py. Running the normal (non-reset) sync results in an exception sqlalchemy.exc.OperationalError: (sqlite3.OperationalError) no such column: activities.average_heartrate...

-> Either I'm missing a required step, or DB migration is not done automatically...

But that's ok, since one could just use the --reset flag to regenerate the whole DB from scratch.

@Djailla
Copy link

Djailla commented Jul 15, 2020

In fact, it requires to use Alembic :

https://alembic.sqlalchemy.org/en/latest/

I will take a look

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants