fixes fixes fixes tenaancy

This commit is contained in:
IGNY8 VPS (Salman)
2025-12-09 02:43:51 +00:00
parent 92211f065b
commit 72d0b6b0fd
23 changed files with 1428 additions and 19 deletions

View File

@@ -0,0 +1,35 @@
# Generated migration for Payment status simplification
from django.db import migrations
def migrate_payment_statuses(apps, schema_editor):
"""
Migrate old payment statuses to new simplified statuses:
- pending, processing, completed, cancelled → map to new statuses
"""
Payment = apps.get_model('billing', 'Payment')
# Map old statuses to new statuses
status_mapping = {
'pending': 'pending_approval', # Treat as pending approval
'processing': 'pending_approval', # Treat as pending approval
'completed': 'succeeded', # completed = succeeded
'cancelled': 'failed', # cancelled = failed
# Keep existing: pending_approval, succeeded, failed, refunded
}
for old_status, new_status in status_mapping.items():
Payment.objects.filter(status=old_status).update(status=new_status)
class Migration(migrations.Migration):
dependencies = [
('billing', '0006_auto_20251209_payment_workflow'), # Adjust to your latest migration
]
operations = [
# Update status choices (Django will handle this in model)
migrations.RunPython(migrate_payment_statuses, reverse_code=migrations.RunPython.noop),
]