https://github.com/moralcode/newtrition
https://github.com/moralcode/newtrition
Last synced: 11 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/moralcode/newtrition
- Owner: MoralCode
- License: gpl-2.0
- Created: 2022-04-17T03:58:19.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2023-05-21T22:36:19.000Z (over 2 years ago)
- Last Synced: 2025-04-02T00:06:34.411Z (10 months ago)
- Language: Python
- Size: 85.9 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
## Setup and usage
Dependencies are managed with pipenv. To install them, run `pipenv install`. To run things within this environment, use `pipenv run` followed by the command to run, or `pipenv shell` to enter a shell inside this environment
The first time you use the script, you may also want to initialize a fresh database, which can be done by running the script and using the `--createdb` flag
## Unit tests
unit tests can be run with `pipenv run python3 -m unittest`
## Database versioning
This project uses [alembic](https://alembic.sqlalchemy.org/en/latest/) to keep track of schema changes to the database and allow for easy migration.
### Applying DB Upgrades
running `pipenv run alembic upgrade head` will upgrade your database to the latest version
### Creating DB Upgrades
The command for generating a database revision (i.e. if you change the schema) is `pipenv run alembic revision --autogenerate -m ""`. a file will be generated in the `migrations/versions` folder that will need review and some cleanup as there are [some things it cannot detect](https://alembic.sqlalchemy.org/en/latest/autogenerate.html#what-does-autogenerate-detect-and-what-does-it-not-detect)