Fred808 commited on
Commit
4697437
·
verified ·
1 Parent(s): 6e41c55

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -103,12 +103,12 @@ async_session = sessionmaker(engine, class_=AsyncSession, expire_on_commit=False
103
  # --- Migration Functions ---
104
  async def add_order_ids_column():
105
  async with engine.connect() as conn:
106
- # You can add an existence check if needed.
107
  await conn.execute(
108
  text("ALTER TABLE user_profiles ADD COLUMN IF NOT EXISTS order_ids TEXT DEFAULT ''")
109
  )
110
  await conn.commit()
111
- print("Column 'order_ids' added successfully.")
112
 
113
  async def init_db():
114
  async with engine.begin() as conn:
 
103
  # --- Migration Functions ---
104
  async def add_order_ids_column():
105
  async with engine.connect() as conn:
106
+ # Ensure the column exists (PostgreSQL 9.6+ supports IF NOT EXISTS)
107
  await conn.execute(
108
  text("ALTER TABLE user_profiles ADD COLUMN IF NOT EXISTS order_ids TEXT DEFAULT ''")
109
  )
110
  await conn.commit()
111
+ print("Column 'order_ids' ensured on user_profiles.")
112
 
113
  async def init_db():
114
  async with engine.begin() as conn: