first commit

This commit is contained in:
Koncept Kit
2025-12-05 16:43:37 +07:00
commit 6ef7685ade
26 changed files with 2191 additions and 0 deletions

View File

@@ -0,0 +1,40 @@
"""
Migration script to add manual payment columns to subscriptions table.
Run this once to update the database schema.
"""
from database import engine
from sqlalchemy import text
def add_manual_payment_columns():
"""Add manual payment columns to subscriptions table"""
migrations = [
"ALTER TABLE subscriptions ADD COLUMN IF NOT EXISTS manual_payment BOOLEAN NOT NULL DEFAULT FALSE",
"ALTER TABLE subscriptions ADD COLUMN IF NOT EXISTS manual_payment_notes TEXT",
"ALTER TABLE subscriptions ADD COLUMN IF NOT EXISTS manual_payment_admin_id UUID REFERENCES users(id)",
"ALTER TABLE subscriptions ADD COLUMN IF NOT EXISTS manual_payment_date TIMESTAMP",
"ALTER TABLE subscriptions ADD COLUMN IF NOT EXISTS payment_method VARCHAR"
]
try:
print("Adding manual payment columns to subscriptions table...")
with engine.connect() as conn:
for sql in migrations:
print(f" Executing: {sql[:60]}...")
conn.execute(text(sql))
conn.commit()
print("✅ Migration completed successfully!")
print("\nAdded columns:")
print(" - manual_payment (BOOLEAN)")
print(" - manual_payment_notes (TEXT)")
print(" - manual_payment_admin_id (UUID)")
print(" - manual_payment_date (TIMESTAMP)")
print(" - payment_method (VARCHAR)")
except Exception as e:
print(f"❌ Migration failed: {e}")
raise
if __name__ == "__main__":
add_manual_payment_columns()