Update hina template
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
This commit is contained in:
parent
668f796a05
commit
5c4bb0d3fa
50
backend/delete_hina_invitation.py
Normal file
50
backend/delete_hina_invitation.py
Normal file
@ -0,0 +1,50 @@
|
||||
#!/usr/bin/env python
|
||||
"""
|
||||
Delete the custom hina_invitation template from the database.
|
||||
This allows us to recreate it with the correct button configuration.
|
||||
"""
|
||||
|
||||
import os
|
||||
import sys
|
||||
from sqlalchemy import create_engine
|
||||
from sqlalchemy.orm import sessionmaker
|
||||
|
||||
# Import database config
|
||||
from database import DATABASE_URL, Base
|
||||
from models import WhatsAppTemplate
|
||||
|
||||
def delete_hina():
|
||||
"""Delete custom hina_invitation template from database."""
|
||||
|
||||
# Create engine and session
|
||||
engine = create_engine(DATABASE_URL)
|
||||
SessionLocal = sessionmaker(autocommit=False, autoflush=False, bind=engine)
|
||||
db = SessionLocal()
|
||||
|
||||
try:
|
||||
# Find and delete hina_invitation
|
||||
template = db.query(WhatsAppTemplate).filter(
|
||||
WhatsAppTemplate.template_key == 'hina_invitation'
|
||||
).first()
|
||||
|
||||
if template:
|
||||
print(f"✓ Found custom 'hina_invitation' in database")
|
||||
print(f" - meta_name: {template.meta_name}")
|
||||
print(f" - body_params: {template.body_params}")
|
||||
|
||||
db.delete(template)
|
||||
db.commit()
|
||||
print(f"✓ Deleted custom 'hina_invitation'")
|
||||
print(f"✓ Ready to create corrected version")
|
||||
else:
|
||||
print(f"✓ No custom 'hina_invitation' found (already deleted or doesn't exist)")
|
||||
|
||||
except Exception as e:
|
||||
print(f"✗ Error: {e}")
|
||||
db.rollback()
|
||||
sys.exit(1)
|
||||
finally:
|
||||
db.close()
|
||||
|
||||
if __name__ == "__main__":
|
||||
delete_hina()
|
||||
Loading…
x
Reference in New Issue
Block a user