Looks like this is the only way: https://github.com/sqlalchemy/alembic/discussions/1086main
| @@ -55,7 +55,7 @@ version_path_separator = os # Use os.pathsep. Default configuration used for ne | |||||
| # are written from script.py.mako | # are written from script.py.mako | ||||
| # output_encoding = utf-8 | # output_encoding = utf-8 | ||||
| sqlalchemy.url = sqlite+pysqlite:///:memory: | |||||
| sqlalchemy.url = sqlite+pysqlite:///autogen.db.sqlite3 | |||||
| [post_write_hooks] | [post_write_hooks] | ||||
| @@ -3,9 +3,9 @@ New Version | |||||
| To create a revision, update the ORM in medashare/orm.py. | To create a revision, update the ORM in medashare/orm.py. | ||||
| Then run: | |||||
| Then in the medashare directory, run: | |||||
| ``` | ``` | ||||
| alembic revision --autogenerate -m 'what you did' | |||||
| ./autogen.sh "message of what you did" | |||||
| ``` | ``` | ||||
| This will create a version file. Edit the version file to support the | This will create a version file. Edit the version file to support the | ||||
| @@ -0,0 +1,22 @@ | |||||
| # | |||||
| # Script to auto generate any orm changes. | |||||
| # | |||||
| if [ -z "$*" ]; then | |||||
| echo "Provide the upgrade message as an argument." | |||||
| exit 1 | |||||
| fi | |||||
| set -e | |||||
| # Make sure we start clean | |||||
| rm -f autogen.db.sqlite3 | |||||
| # Upgrade the database to head | |||||
| alembic upgrade head | |||||
| # Autogenerate the migrations | |||||
| alembic revision --autogenerate -m "$*" | |||||
| # Clean up | |||||
| rm -f autogen.db.sqlite3 | |||||