CostHive/backend/migrations/versions/2be4d1ae5493_create_views.py
Lunaresk 2e33f9b5a8 major: improvements and functions
Features:
- Added page for an overview of establishments with a possibility to
request a membership.
- Added page for admins of an establishment to accept or deny those
candidates. This is currently only usable via URL, the navigation to
this site is not yet implemented in the HTML files.
- Added page to add new establishments by providing a name.

Improvements:
- Better folder structure.
- The establishment-specific overview can now be viewed with another
URL, as well as some other pages.

Bugfixes:
- Seriously I don't know anymore what I fixed and what not. But it works
just better now :)

Future:
- Angular has been added to separate the Flask-Backend with the
frontend. Angular is currently not connected to the backend, but this
will change in the future.
2023-03-19 12:31:10 +01:00

41 lines
1013 B
Python

"""create views
Revision ID: 2be4d1ae5493
Revises: 05fce74b56cb
Create Date: 2022-02-20 16:33:01.900378
"""
from alembic import op
import sqlalchemy as sa
from src import db
from src.utils.view_utils import selectable_price_per_amount_view, selectable_bought_with_prices_view
from sqlalchemy_utils import create_view
# revision identifiers, used by Alembic.
revision = '2be4d1ae5493'
down_revision = '05fce74b56cb'
branch_labels = None
depends_on = None
def upgrade():
op.rename_table("item_receipt", "receipt_item")
metadata = sa.MetaData()
create_view('price_per_amount',
selectable_price_per_amount_view(),
metadata
)
create_view('bought_with_prices',
selectable_bought_with_prices_view(),
metadata
)
metadata.create_all(db.engine)
def downgrade():
with db.engine.connect() as con:
con.execute("DROP VIEW bought_with_prices;")
con.execute("DROP VIEW price_per_amount;")
op.rename_table("receipt_item", "item_receipt")