"""
Patch Django to support MariaDB 10.4
"""
import django.db.backends.mysql.base
import django.db.backends.base.base

# Monkey patch the version check
original_check = django.db.backends.base.base.BaseDatabaseWrapper.check_database_version_supported

def patched_check(self):
    """Skip version check for MariaDB 10.4"""
    try:
        original_check(self)
    except Exception as e:
        if "MariaDB 10.5" in str(e) or "10.4" in str(e):
            print(f"⚠️  Warning: {e}")
            print("⚠️  Continuing anyway with MariaDB 10.4...")
            return
        raise

django.db.backends.base.base.BaseDatabaseWrapper.check_database_version_supported = patched_check

print("✓ Django patched to support MariaDB 10.4")
