mirror of https://github.com/zulip/zulip.git
models: Fix incorrect on_delete=CASCADE values for deleted streams.
In theory, we never delete streams, but if we did delete the notifications stream for a realm, we certainly shouldn't delete the realm.
This commit is contained in:
parent
37b265495b
commit
18595fac58
|
@ -0,0 +1,56 @@
|
||||||
|
# Generated by Django 3.2 on 2021-05-07 01:00
|
||||||
|
|
||||||
|
import django.db.models.deletion
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
("zerver", "0323_show_starred_message_counts"),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="realm",
|
||||||
|
name="notifications_stream",
|
||||||
|
field=models.ForeignKey(
|
||||||
|
blank=True,
|
||||||
|
null=True,
|
||||||
|
on_delete=django.db.models.deletion.SET_NULL,
|
||||||
|
related_name="+",
|
||||||
|
to="zerver.stream",
|
||||||
|
),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="realm",
|
||||||
|
name="signup_notifications_stream",
|
||||||
|
field=models.ForeignKey(
|
||||||
|
blank=True,
|
||||||
|
null=True,
|
||||||
|
on_delete=django.db.models.deletion.SET_NULL,
|
||||||
|
related_name="+",
|
||||||
|
to="zerver.stream",
|
||||||
|
),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="userprofile",
|
||||||
|
name="default_events_register_stream",
|
||||||
|
field=models.ForeignKey(
|
||||||
|
null=True,
|
||||||
|
on_delete=django.db.models.deletion.SET_NULL,
|
||||||
|
related_name="+",
|
||||||
|
to="zerver.stream",
|
||||||
|
),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="userprofile",
|
||||||
|
name="default_sending_stream",
|
||||||
|
field=models.ForeignKey(
|
||||||
|
null=True,
|
||||||
|
on_delete=django.db.models.deletion.SET_NULL,
|
||||||
|
related_name="+",
|
||||||
|
to="zerver.stream",
|
||||||
|
),
|
||||||
|
),
|
||||||
|
]
|
|
@ -375,14 +375,14 @@ class Realm(models.Model):
|
||||||
related_name="+",
|
related_name="+",
|
||||||
null=True,
|
null=True,
|
||||||
blank=True,
|
blank=True,
|
||||||
on_delete=CASCADE,
|
on_delete=models.SET_NULL,
|
||||||
)
|
)
|
||||||
signup_notifications_stream: Optional["Stream"] = models.ForeignKey(
|
signup_notifications_stream: Optional["Stream"] = models.ForeignKey(
|
||||||
"Stream",
|
"Stream",
|
||||||
related_name="+",
|
related_name="+",
|
||||||
null=True,
|
null=True,
|
||||||
blank=True,
|
blank=True,
|
||||||
on_delete=CASCADE,
|
on_delete=models.SET_NULL,
|
||||||
)
|
)
|
||||||
|
|
||||||
MESSAGE_RETENTION_SPECIAL_VALUES_MAP = {
|
MESSAGE_RETENTION_SPECIAL_VALUES_MAP = {
|
||||||
|
@ -1266,13 +1266,13 @@ class UserProfile(AbstractBaseUser, PermissionsMixin):
|
||||||
"zerver.Stream",
|
"zerver.Stream",
|
||||||
null=True,
|
null=True,
|
||||||
related_name="+",
|
related_name="+",
|
||||||
on_delete=CASCADE,
|
on_delete=models.SET_NULL,
|
||||||
)
|
)
|
||||||
default_events_register_stream: Optional["Stream"] = models.ForeignKey(
|
default_events_register_stream: Optional["Stream"] = models.ForeignKey(
|
||||||
"zerver.Stream",
|
"zerver.Stream",
|
||||||
null=True,
|
null=True,
|
||||||
related_name="+",
|
related_name="+",
|
||||||
on_delete=CASCADE,
|
on_delete=models.SET_NULL,
|
||||||
)
|
)
|
||||||
default_all_public_streams: bool = models.BooleanField(default=False)
|
default_all_public_streams: bool = models.BooleanField(default=False)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue