Fix a CASCADE on shops

This commit is contained in:
2025-01-27 23:22:08 +01:00
parent b10e1f3952
commit c971ff9601
2 changed files with 26 additions and 1 deletions

View File

@@ -0,0 +1,25 @@
# Generated by Django 5.1.4 on 2025-01-27 22:21
import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("metadata", "0023_shop"),
("roster", "0034_rollingstock_shop"),
]
operations = [
migrations.AlterField(
model_name="rollingstock",
name="shop",
field=models.ForeignKey(
blank=True,
null=True,
on_delete=django.db.models.deletion.SET_NULL,
to="metadata.shop",
),
),
]

View File

@@ -104,7 +104,7 @@ class RollingStock(BaseModel):
)
production_year = models.SmallIntegerField(null=True, blank=True)
shop = models.ForeignKey(
Shop, on_delete=models.CASCADE, null=True, blank=True
Shop, on_delete=models.SET_NULL, null=True, blank=True
)
purchase_date = models.DateField(null=True, blank=True)
price = models.DecimalField(