Improve Alembic documentation
Currently, in migrations/README
, there is some documentation regarding creating changes to our schema and creating migrations.
Some of this documentation, however, is a bit misleading, as it hints to a user that they must both modify the schema and create a migration at the same time. These do not always couple together.
As far as the schema is concerned; it is used in two places. First, it is used to create the initial database schema via aurweb.initdb
. Secondly, it is used for SQLAlchemy ORM mappings (see aurweb/models/user.py
).
That being said, SQLAlchemy ORM mappings allow its user to define more columns in the class definition: https://docs.sqlalchemy.org/en/13/orm/mapping_columns.html
Now, there's a bit of a problem with always modifying the schema AND creating a migration -- sometimes these two things can collide.
Proposal: The tables defined in aurweb.schema
should ONLY be used for database initialization. If modifications to the database or tables are created, those modifications need to be reflected in our SQLAlchemy ORM models. We should probably keep a log of comments regarding migration changes to a table within aurweb.schema
whenever a migration is written, so that users can back reference to that in the future to know the entirety of the schema table's columns (after Alembic migrations). ORM models can then be molded to fit the tables properly.