From 212bf53932efe5f5bdf3a40509978b59ae802045 Mon Sep 17 00:00:00 2001 From: usmannasir Date: Fri, 19 Sep 2025 09:40:01 +0500 Subject: [PATCH] debian 12 --- .../0002_usernotificationpreferences.py | 32 ------------------ install/install.py | 33 +++---------------- 2 files changed, 5 insertions(+), 60 deletions(-) delete mode 100644 baseTemplate/migrations/0002_usernotificationpreferences.py diff --git a/baseTemplate/migrations/0002_usernotificationpreferences.py b/baseTemplate/migrations/0002_usernotificationpreferences.py deleted file mode 100644 index 3db48ac84..000000000 --- a/baseTemplate/migrations/0002_usernotificationpreferences.py +++ /dev/null @@ -1,32 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.11.29 on 2024-01-01 00:00 - -from django.conf import settings -from django.db import migrations, models -import django.db.models.deletion - - -class Migration(migrations.Migration): - - dependencies = [ - migrations.swappable_dependency(settings.AUTH_USER_MODEL), - ('baseTemplate', '0001_initial'), - ] - - operations = [ - migrations.CreateModel( - name='UserNotificationPreferences', - fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('backup_notification_dismissed', models.BooleanField(default=False, help_text='Whether user has dismissed the backup notification')), - ('ai_scanner_notification_dismissed', models.BooleanField(default=False, help_text='Whether user has dismissed the AI scanner notification')), - ('created_at', models.DateTimeField(auto_now_add=True)), - ('updated_at', models.DateTimeField(auto_now=True)), - ('user', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, related_name='notification_preferences', to=settings.AUTH_USER_MODEL)), - ], - options={ - 'verbose_name': 'User Notification Preferences', - 'verbose_name_plural': 'User Notification Preferences', - }, - ), - ] diff --git a/install/install.py b/install/install.py index 50b165258..dda808fdd 100644 --- a/install/install.py +++ b/install/install.py @@ -661,36 +661,13 @@ password="%s" os.chdir("/usr/local/CyberCP") - # Try makemigrations first + # Create fresh migrations for all apps command = "/usr/local/CyberPanel/bin/python manage.py makemigrations" - result = preFlightsChecks.call(command, self.distro, command, command, 1, 0, os.EX_OSERR) + preFlightsChecks.call(command, self.distro, command, command, 1, 1, os.EX_OSERR) - # If makemigrations fails due to migration dependency issues, try to fix it - if result != 1: - preFlightsChecks.stdOut("Migration dependency issue detected, attempting to fix...") - - # Reset baseTemplate migrations to resolve dependency issues - command = "/usr/local/CyberPanel/bin/python manage.py migrate baseTemplate zero --fake" - preFlightsChecks.call(command, self.distro, command, command, 1, 0, os.EX_OSERR) - - # Create a new initial migration for baseTemplate - command = "/usr/local/CyberPanel/bin/python manage.py makemigrations baseTemplate --empty" - preFlightsChecks.call(command, self.distro, command, command, 1, 0, os.EX_OSERR) - - # Try makemigrations again - command = "/usr/local/CyberPanel/bin/python manage.py makemigrations" - preFlightsChecks.call(command, self.distro, command, command, 1, 1, os.EX_OSERR) - - ## - - # Apply migrations with fake-initial to handle missing initial migrations - command = "/usr/local/CyberPanel/bin/python manage.py migrate --fake-initial" - result = preFlightsChecks.call(command, self.distro, command, command, 1, 0, os.EX_OSERR) - - # If fake-initial fails, try regular migrate - if result != 1: - command = "/usr/local/CyberPanel/bin/python manage.py migrate" - preFlightsChecks.call(command, self.distro, command, command, 1, 1, os.EX_OSERR) + # Apply all migrations + command = "/usr/local/CyberPanel/bin/python manage.py migrate" + preFlightsChecks.call(command, self.distro, command, command, 1, 1, os.EX_OSERR) if not os.path.exists("/usr/local/CyberCP/public"): os.mkdir("/usr/local/CyberCP/public")