-
Notifications
You must be signed in to change notification settings - Fork 58
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
LIN-381 database migration script #704
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
joshpoll
changed the title
Lin 381 database migration script
LIN-381 database migration script
Jun 21, 2022
To clarify, where should I put the user-facing docs? In the main readme (and if so where) or somewhere else? |
lionsardesai
reviewed
Jul 5, 2022
lionsardesai
reviewed
Jul 5, 2022
lionsardesai
reviewed
Jul 5, 2022
lionsardesai
reviewed
Jul 5, 2022
…c use our databaseurl. also set the default options on config init instead of waiting for cli to call for defaults.
…ence to the alembic doc for details. [skip ci]
lionsardesai
approved these changes
Jul 6, 2022
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ship it!!!!
lionsardesai
approved these changes
Jul 8, 2022
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shit it 😂
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Implements database migration using alembic.
Fixes LIN-381 and LIN-471
(For Lineapy users) To upgrade a Lineapy database
Nothing! When you use a lineapy db it will be upgraded automatically.
(For Lineapy developers) To create a migration
Run
alembic revision -m "<description of change>"
. This will generate a migration template in thealembic/versions
directory.Then implement the migration scripts using the
alembic
package in the the bodies of theupgrade
anddowngrade
functions.See https://alembic.sqlalchemy.org/en/latest/tutorial.html#create-a-migration-script for more information.
Alternately, we can also use alembic's autogeneration feature and run
alembic revision --autogenerate -m "<description of change>"
. More details at: https://alembic.sqlalchemy.org/en/latest/autogenerate.htmlNote: The alembic version of a DB is stored in the
alembic_version
table, which has a single column namedversion_num
.Type of change
How Has This Been Tested?
Currently I have tested this by running a small example migration that adds a python version to the table, and I have run the CLI to upgrade it. I have not yet created more involved tests.