diff --git a/apiserver/paasng/paasng/platform/applications/migrations/0013_applicationdeploymentmoduleorder.py b/apiserver/paasng/paasng/platform/applications/migrations/0013_applicationdeploymentmoduleorder.py index 1b22c87fb..d14d70f81 100644 --- a/apiserver/paasng/paasng/platform/applications/migrations/0013_applicationdeploymentmoduleorder.py +++ b/apiserver/paasng/paasng/platform/applications/migrations/0013_applicationdeploymentmoduleorder.py @@ -1,4 +1,4 @@ -# Generated by Django 4.2.16 on 2024-11-21 09:59 +# Generated by Django 4.2.16 on 2024-11-28 08:22 from django.db import migrations, models import django.db.models.deletion @@ -7,20 +7,36 @@ class Migration(migrations.Migration): dependencies = [ - ('modules', '0016_auto_20240904_1439'), - ('applications', '0012_application_is_ai_agent_app'), + ("modules", "0016_auto_20240904_1439"), + ("applications", "0012_application_is_ai_agent_app"), ] operations = [ migrations.CreateModel( - name='ApplicationDeploymentModuleOrder', + name="ApplicationDeploymentModuleOrder", fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('order', models.IntegerField(verbose_name='顺序')), - ('module', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='modules.module', unique=True, verbose_name='模块')), + ( + "id", + models.AutoField( + auto_created=True, + primary_key=True, + serialize=False, + verbose_name="ID", + ), + ), + ("order", models.IntegerField(verbose_name="顺序")), + ( + "module", + models.OneToOneField( + db_constraint=False, + on_delete=django.db.models.deletion.CASCADE, + to="modules.module", + verbose_name="模块", + ), + ), ], options={ - 'verbose_name': '模块顺序', + "verbose_name": "模块顺序", }, ), ] diff --git a/apiserver/paasng/paasng/platform/applications/models.py b/apiserver/paasng/paasng/platform/applications/models.py index cff103769..272df61f7 100644 --- a/apiserver/paasng/paasng/platform/applications/models.py +++ b/apiserver/paasng/paasng/platform/applications/models.py @@ -606,7 +606,7 @@ def code(self): class ApplicationDeploymentModuleOrder(models.Model): - module = models.ForeignKey(Module, on_delete=models.CASCADE, verbose_name="模块", unique=True) + module = models.OneToOneField(Module, on_delete=models.CASCADE, verbose_name="模块", db_constraint=False) order = models.IntegerField(verbose_name="顺序") class Meta: