mirror of
https://github.com/StefBuwalda/cal_counter.git
synced 2025-10-30 11:19:59 +00:00
Add user dashboard and per-user food item ownership
Introduces a user dashboard route and template, moving dashboard logic to a user blueprint. FoodItem now has an owner_id field and a unique constraint on (barcode, owner_id), with relationships set up in the User model. Updates food item creation to associate with the current user, and adds a utility script for dropping a temporary table.
This commit is contained in:
15
temp.py
Normal file
15
temp.py
Normal file
@@ -0,0 +1,15 @@
|
||||
from application import db, app
|
||||
from sqlalchemy import MetaData, Table
|
||||
|
||||
with app.app_context():
|
||||
table_name = "_alembic_tmp_food_item"
|
||||
engine = db.engine
|
||||
metadata = MetaData()
|
||||
metadata.reflect(bind=engine)
|
||||
|
||||
if table_name in metadata.tables:
|
||||
tmp_table = Table(table_name, metadata, autoload_with=engine)
|
||||
tmp_table.drop(engine)
|
||||
print(f"Table '{table_name}' dropped.")
|
||||
else:
|
||||
print(f"No table named '{table_name}' found.")
|
||||
Reference in New Issue
Block a user