use flask-sqlalchemy for the main db
- added the Flask-SqlAlchemy and Flask-Migrate dependencies to replace session and migration boilerplate code
- Updated all the orm queries to the new SqlAlchemy 2 API
Merge request reports
Activity
added 12 commits
-
6e62575f...b7fe7e0f - 11 commits from branch
develop
- 538048a9 - Merge branch 'develop' into feature/COMP-170_part_2_introduce_flask_sqlalchemy
-
6e62575f...b7fe7e0f - 11 commits from branch
When I run
flask db migrate
it detects that the enum name for charging structure feetype is different because of the naming changes:def upgrade(): # ### commands auto generated by Alembic - please adjust! ### with op.batch_alter_table('charging_structure', schema=None) as batch_op: batch_op.alter_column('fee_type', existing_type=postgresql.ENUM('flat_fee', 'usage_based_fee', 'combination', 'no_charge', 'other', name='fee_type'), type_=sa.Enum('flat_fee', 'usage_based_fee', 'combination', 'no_charge', 'other', name='feetype'), existing_nullable=True) # ### end Alembic commands ### def downgrade(): # ### commands auto generated by Alembic - please adjust! ### with op.batch_alter_table('charging_structure', schema=None) as batch_op: batch_op.alter_column('fee_type', existing_type=sa.Enum('flat_fee', 'usage_based_fee', 'combination', 'no_charge', 'other', name='feetype'), type_=postgresql.ENUM('flat_fee', 'usage_based_fee', 'combination', 'no_charge', 'other', name='fee_type'), existing_nullable=True) # ### end Alembic commands ###
..either we should keep the old name, or reapply migrations to fix the enum in postgres - you can make a decision and I will follow
Other than this, the changes look good to me and can be merged
Edited by Bjarke MadsenYes; this is just the enum in the db metadata though and it doesnt have any functional effect, so I was thinking to just include this migration in the next useful one as to not have an unnecessary migration. The reason its detected now is that in Flask-SqlAlchemy the compare-type setting defaults to true while in bare SqlAlchemy it defaults to false. The alternative would be to rename the python enum from FeeType to Fee_Type but I dont want to do that.
mentioned in commit 41de7f69