models: Make realm.name no longer nullable.

This was likely initiall created with null=True in
5c5ffd6ea3 just because we didn't have a
plan for backfilling this field, but I verified that Zulip Cloud has
no realms without a name set, and that's the place most likely to have
any form of super-legacy nameless realms.

So we can clean up this aspect of the data model without a special
migration to do something with existing realms with name=None (which I
suspect would have resulted in a 500 anyway).
This commit is contained in:
Tim Abbott
2021-09-08 15:36:08 -07:00
parent a65af97692
commit 517c2ed39d
2 changed files with 19 additions and 1 deletions

View File

@@ -0,0 +1,18 @@
# Generated by Django 3.2.6 on 2021-09-08 22:35
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("zerver", "0344_alter_emojiset_default_value"),
]
operations = [
migrations.AlterField(
model_name="realm",
name="name",
field=models.CharField(max_length=40),
),
]

View File

@@ -207,7 +207,7 @@ class Realm(models.Model):
id: int = models.AutoField(auto_created=True, primary_key=True, verbose_name="ID")
# User-visible display name and description used on e.g. the organization homepage
name: Optional[str] = models.CharField(max_length=MAX_REALM_NAME_LENGTH, null=True)
name: str = models.CharField(max_length=MAX_REALM_NAME_LENGTH)
description: str = models.TextField(default="")
# A short, identifier-like name for the organization. Used in subdomains;