2024-08-13 23:43:04 +02:00
|
|
|
# Generated by Django 5.0.7 on 2024-08-13 21:48
|
|
|
|
|
2017-06-22 11:27:41 +02:00
|
|
|
import bitfield.models
|
|
|
|
import django.contrib.auth.models
|
2024-08-13 23:43:04 +02:00
|
|
|
import django.contrib.postgres.indexes
|
|
|
|
import django.contrib.postgres.search
|
2017-06-22 11:27:41 +02:00
|
|
|
import django.core.validators
|
|
|
|
import django.db.models.deletion
|
2024-08-13 23:43:04 +02:00
|
|
|
import django.db.models.functions.text
|
2017-06-22 11:27:41 +02:00
|
|
|
import django.utils.timezone
|
2017-11-16 00:44:00 +01:00
|
|
|
from django.conf import settings
|
|
|
|
from django.db import migrations, models
|
2017-06-22 11:27:41 +02:00
|
|
|
|
2023-12-15 03:57:04 +01:00
|
|
|
from zerver.models.streams import generate_email_token_for_stream
|
2017-11-16 00:44:00 +01:00
|
|
|
|
2020-01-14 21:59:46 +01:00
|
|
|
|
2017-06-22 11:27:41 +02:00
|
|
|
class Migration(migrations.Migration):
|
|
|
|
initial = True
|
|
|
|
|
|
|
|
dependencies = [
|
2021-02-12 08:20:45 +01:00
|
|
|
("auth", "0001_initial"),
|
2017-06-22 11:27:41 +02:00
|
|
|
]
|
|
|
|
|
2020-10-26 22:35:47 +01:00
|
|
|
if settings.POSTGRESQL_MISSING_DICTIONARIES:
|
2019-12-12 10:50:04 +01:00
|
|
|
fts_sql = """
|
|
|
|
CREATE TEXT SEARCH CONFIGURATION zulip.english_us_search (COPY=pg_catalog.english);
|
|
|
|
"""
|
|
|
|
else:
|
|
|
|
fts_sql = """
|
|
|
|
CREATE TEXT SEARCH DICTIONARY english_us_hunspell
|
|
|
|
(template = ispell, DictFile = en_us, AffFile = en_us, StopWords = zulip_english);
|
|
|
|
CREATE TEXT SEARCH CONFIGURATION zulip.english_us_search (COPY=pg_catalog.english);
|
|
|
|
ALTER TEXT SEARCH CONFIGURATION zulip.english_us_search
|
|
|
|
ALTER MAPPING FOR asciiword, asciihword, hword_asciipart, word, hword, hword_part
|
|
|
|
WITH english_us_hunspell, english_stem;
|
|
|
|
"""
|
|
|
|
|
|
|
|
fts_sql += """
|
|
|
|
|
|
|
|
CREATE FUNCTION escape_html(text) RETURNS text IMMUTABLE LANGUAGE 'sql' AS $$
|
|
|
|
SELECT replace(replace(replace(replace(replace($1, '&', '&'), '<', '<'),
|
|
|
|
'>', '>'), '"', '"'), '''', ''');
|
|
|
|
$$ ;
|
|
|
|
|
|
|
|
CREATE TABLE fts_update_log (id SERIAL PRIMARY KEY, message_id INTEGER NOT NULL);
|
|
|
|
CREATE FUNCTION do_notify_fts_update_log() RETURNS trigger LANGUAGE plpgsql AS
|
|
|
|
$$ BEGIN NOTIFY fts_update_log; RETURN NEW; END $$;
|
|
|
|
CREATE TRIGGER fts_update_log_notify AFTER INSERT ON fts_update_log
|
|
|
|
FOR EACH STATEMENT EXECUTE PROCEDURE do_notify_fts_update_log();
|
|
|
|
CREATE FUNCTION append_to_fts_update_log() RETURNS trigger LANGUAGE plpgsql AS
|
|
|
|
$$ BEGIN INSERT INTO fts_update_log (message_id) VALUES (NEW.id); RETURN NEW; END $$;
|
|
|
|
CREATE TRIGGER zerver_message_update_search_tsvector_async
|
|
|
|
BEFORE INSERT OR UPDATE OF subject, rendered_content ON zerver_message
|
|
|
|
FOR EACH ROW EXECUTE PROCEDURE append_to_fts_update_log();
|
|
|
|
"""
|
2024-08-13 23:43:04 +02:00
|
|
|
|
2017-06-22 11:27:41 +02:00
|
|
|
operations = [
|
2024-08-13 23:34:16 +02:00
|
|
|
migrations.CreateModel(
|
|
|
|
name="Recipient",
|
|
|
|
fields=[
|
|
|
|
(
|
|
|
|
"id",
|
|
|
|
models.AutoField(
|
|
|
|
auto_created=True, primary_key=True, serialize=False, verbose_name="ID"
|
|
|
|
),
|
|
|
|
),
|
|
|
|
("type_id", models.IntegerField(db_index=True)),
|
|
|
|
("type", models.PositiveSmallIntegerField(db_index=True)),
|
|
|
|
],
|
2024-08-13 23:43:04 +02:00
|
|
|
options={
|
|
|
|
"unique_together": {("type", "type_id")},
|
|
|
|
},
|
2024-08-13 23:34:16 +02:00
|
|
|
),
|
|
|
|
migrations.CreateModel(
|
|
|
|
name="Huddle",
|
|
|
|
fields=[
|
|
|
|
(
|
|
|
|
"id",
|
|
|
|
models.AutoField(
|
|
|
|
auto_created=True, primary_key=True, serialize=False, verbose_name="ID"
|
|
|
|
),
|
|
|
|
),
|
|
|
|
("huddle_hash", models.CharField(db_index=True, max_length=40, unique=True)),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
migrations.CreateModel(
|
|
|
|
name="Realm",
|
|
|
|
fields=[
|
|
|
|
(
|
|
|
|
"id",
|
|
|
|
models.AutoField(
|
|
|
|
auto_created=True, primary_key=True, serialize=False, verbose_name="ID"
|
|
|
|
),
|
|
|
|
),
|
|
|
|
("domain", models.CharField(db_index=True, max_length=40, unique=True)),
|
|
|
|
("name", models.CharField(max_length=40, null=True)),
|
|
|
|
("restricted_to_domain", models.BooleanField(default=True)),
|
|
|
|
("invite_required", models.BooleanField(default=False)),
|
|
|
|
("invite_by_admins_only", models.BooleanField(default=False)),
|
|
|
|
("mandatory_topics", models.BooleanField(default=False)),
|
|
|
|
("show_digest_email", models.BooleanField(default=True)),
|
|
|
|
("name_changes_disabled", models.BooleanField(default=False)),
|
|
|
|
("date_created", models.DateTimeField(default=django.utils.timezone.now)),
|
|
|
|
("deactivated", models.BooleanField(default=False)),
|
2024-08-13 23:43:04 +02:00
|
|
|
("create_stream_by_admins_only", models.BooleanField(default=False)),
|
|
|
|
("allow_message_editing", models.BooleanField(default=True)),
|
|
|
|
("message_content_edit_limit_seconds", models.IntegerField(default=600)),
|
|
|
|
("default_language", models.CharField(default="en", max_length=50)),
|
2024-08-13 23:34:16 +02:00
|
|
|
],
|
|
|
|
options={
|
2024-08-13 23:43:04 +02:00
|
|
|
"permissions": (
|
|
|
|
("administer", "Administer a realm"),
|
|
|
|
("api_super_user", "Can send messages as other users for mirroring"),
|
|
|
|
),
|
2024-08-13 23:34:16 +02:00
|
|
|
},
|
|
|
|
),
|
|
|
|
migrations.CreateModel(
|
|
|
|
name="RealmAlias",
|
|
|
|
fields=[
|
|
|
|
(
|
|
|
|
"id",
|
|
|
|
models.AutoField(
|
|
|
|
auto_created=True, primary_key=True, serialize=False, verbose_name="ID"
|
|
|
|
),
|
|
|
|
),
|
|
|
|
("domain", models.CharField(db_index=True, max_length=80, unique=True)),
|
|
|
|
(
|
|
|
|
"realm",
|
|
|
|
models.ForeignKey(
|
2024-08-13 23:43:04 +02:00
|
|
|
null=True, on_delete=django.db.models.deletion.CASCADE, to="zerver.realm"
|
2024-08-13 23:34:16 +02:00
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
migrations.CreateModel(
|
|
|
|
name="ScheduledJob",
|
|
|
|
fields=[
|
|
|
|
(
|
|
|
|
"id",
|
|
|
|
models.AutoField(
|
|
|
|
auto_created=True, primary_key=True, serialize=False, verbose_name="ID"
|
|
|
|
),
|
|
|
|
),
|
|
|
|
("scheduled_timestamp", models.DateTimeField()),
|
|
|
|
("type", models.PositiveSmallIntegerField()),
|
|
|
|
("data", models.TextField()),
|
|
|
|
("filter_id", models.IntegerField(null=True)),
|
|
|
|
("filter_string", models.CharField(max_length=100)),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
migrations.CreateModel(
|
|
|
|
name="Client",
|
|
|
|
fields=[
|
|
|
|
(
|
|
|
|
"id",
|
|
|
|
models.AutoField(
|
|
|
|
auto_created=True, primary_key=True, serialize=False, verbose_name="ID"
|
|
|
|
),
|
|
|
|
),
|
|
|
|
("name", models.CharField(db_index=True, max_length=30, unique=True)),
|
|
|
|
],
|
|
|
|
),
|
2017-06-22 11:27:41 +02:00
|
|
|
migrations.CreateModel(
|
2021-02-12 08:20:45 +01:00
|
|
|
name="UserProfile",
|
2017-06-22 11:27:41 +02:00
|
|
|
fields=[
|
2021-02-12 08:19:30 +01:00
|
|
|
(
|
2021-02-12 08:20:45 +01:00
|
|
|
"id",
|
2021-02-12 08:19:30 +01:00
|
|
|
models.AutoField(
|
2021-02-12 08:20:45 +01:00
|
|
|
auto_created=True, primary_key=True, serialize=False, verbose_name="ID"
|
2021-02-12 08:19:30 +01:00
|
|
|
),
|
|
|
|
),
|
2021-02-12 08:20:45 +01:00
|
|
|
("password", models.CharField(max_length=128, verbose_name="password")),
|
2021-02-12 08:19:30 +01:00
|
|
|
(
|
2021-02-12 08:20:45 +01:00
|
|
|
"last_login",
|
2024-08-13 23:43:04 +02:00
|
|
|
models.DateTimeField(blank=True, null=True, verbose_name="last login"),
|
2021-02-12 08:19:30 +01:00
|
|
|
),
|
|
|
|
(
|
2021-02-12 08:20:45 +01:00
|
|
|
"is_superuser",
|
2021-02-12 08:19:30 +01:00
|
|
|
models.BooleanField(
|
|
|
|
default=False,
|
2021-02-12 08:20:45 +01:00
|
|
|
help_text="Designates that this user has all permissions without explicitly assigning them.",
|
|
|
|
verbose_name="superuser status",
|
|
|
|
),
|
|
|
|
),
|
2024-08-13 23:43:04 +02:00
|
|
|
("email", models.EmailField(db_index=True, max_length=254, unique=True)),
|
2021-02-12 08:20:45 +01:00
|
|
|
("is_staff", models.BooleanField(default=False)),
|
2024-08-13 23:43:04 +02:00
|
|
|
("is_active", models.BooleanField(db_index=True, default=True)),
|
|
|
|
("is_bot", models.BooleanField(db_index=True, default=False)),
|
2021-02-12 08:20:45 +01:00
|
|
|
("date_joined", models.DateTimeField(default=django.utils.timezone.now)),
|
|
|
|
("is_mirror_dummy", models.BooleanField(default=False)),
|
|
|
|
("full_name", models.CharField(max_length=100)),
|
|
|
|
("short_name", models.CharField(max_length=100)),
|
|
|
|
("pointer", models.IntegerField()),
|
|
|
|
("last_pointer_updater", models.CharField(max_length=64)),
|
|
|
|
("api_key", models.CharField(max_length=32)),
|
2024-08-13 23:43:04 +02:00
|
|
|
("enable_stream_desktop_notifications", models.BooleanField(default=False)),
|
|
|
|
("enable_stream_sounds", models.BooleanField(default=False)),
|
2021-02-12 08:20:45 +01:00
|
|
|
("enable_desktop_notifications", models.BooleanField(default=True)),
|
|
|
|
("enable_sounds", models.BooleanField(default=True)),
|
|
|
|
("enable_offline_email_notifications", models.BooleanField(default=True)),
|
|
|
|
("enable_offline_push_notifications", models.BooleanField(default=True)),
|
|
|
|
("enable_digest_emails", models.BooleanField(default=True)),
|
|
|
|
("default_desktop_notifications", models.BooleanField(default=True)),
|
|
|
|
(
|
|
|
|
"last_reminder",
|
2021-02-12 08:19:30 +01:00
|
|
|
models.DateTimeField(default=django.utils.timezone.now, null=True),
|
|
|
|
),
|
2021-02-12 08:20:45 +01:00
|
|
|
("rate_limits", models.CharField(default="", max_length=100)),
|
|
|
|
("default_all_public_streams", models.BooleanField(default=False)),
|
2024-08-13 23:43:04 +02:00
|
|
|
("enter_sends", models.BooleanField(default=True, null=True)),
|
2021-02-12 08:20:45 +01:00
|
|
|
("autoscroll_forever", models.BooleanField(default=False)),
|
|
|
|
("twenty_four_hour_time", models.BooleanField(default=False)),
|
2021-02-12 08:19:30 +01:00
|
|
|
(
|
2021-02-12 08:20:45 +01:00
|
|
|
"avatar_source",
|
2021-02-12 08:19:30 +01:00
|
|
|
models.CharField(
|
|
|
|
choices=[
|
2021-02-12 08:20:45 +01:00
|
|
|
("G", "Hosted by Gravatar"),
|
|
|
|
("U", "Uploaded by user"),
|
|
|
|
("S", "System generated"),
|
2021-02-12 08:19:30 +01:00
|
|
|
],
|
2021-02-12 08:20:45 +01:00
|
|
|
default="G",
|
2021-02-12 08:19:30 +01:00
|
|
|
max_length=1,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
(
|
2021-02-12 08:20:45 +01:00
|
|
|
"tutorial_status",
|
2021-02-12 08:19:30 +01:00
|
|
|
models.CharField(
|
2021-02-12 08:20:45 +01:00
|
|
|
choices=[("W", "Waiting"), ("S", "Started"), ("F", "Finished")],
|
|
|
|
default="W",
|
2021-02-12 08:19:30 +01:00
|
|
|
max_length=1,
|
|
|
|
),
|
|
|
|
),
|
2021-02-12 08:20:45 +01:00
|
|
|
("onboarding_steps", models.TextField(default="[]")),
|
|
|
|
("invites_granted", models.IntegerField(default=0)),
|
|
|
|
("invites_used", models.IntegerField(default=0)),
|
|
|
|
("alert_words", models.TextField(default="[]")),
|
|
|
|
("muted_topics", models.TextField(default="[]")),
|
2021-02-12 08:19:30 +01:00
|
|
|
(
|
2021-02-12 08:20:45 +01:00
|
|
|
"bot_owner",
|
2021-02-12 08:19:30 +01:00
|
|
|
models.ForeignKey(
|
|
|
|
null=True,
|
|
|
|
on_delete=django.db.models.deletion.SET_NULL,
|
|
|
|
to=settings.AUTH_USER_MODEL,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
(
|
2024-08-13 23:43:04 +02:00
|
|
|
"groups",
|
|
|
|
models.ManyToManyField(
|
|
|
|
blank=True,
|
|
|
|
help_text="The groups this user belongs to. A user will get all permissions granted to each of their groups.",
|
|
|
|
related_name="user_set",
|
|
|
|
related_query_name="user",
|
|
|
|
to="auth.group",
|
|
|
|
verbose_name="groups",
|
2021-02-12 08:19:30 +01:00
|
|
|
),
|
|
|
|
),
|
2024-08-13 23:43:04 +02:00
|
|
|
(
|
|
|
|
"realm",
|
|
|
|
models.ForeignKey(
|
|
|
|
on_delete=django.db.models.deletion.CASCADE, to="zerver.realm"
|
|
|
|
),
|
|
|
|
),
|
|
|
|
(
|
|
|
|
"user_permissions",
|
|
|
|
models.ManyToManyField(
|
|
|
|
blank=True,
|
|
|
|
help_text="Specific permissions for this user.",
|
|
|
|
related_name="user_set",
|
|
|
|
related_query_name="user",
|
|
|
|
to="auth.permission",
|
|
|
|
verbose_name="user permissions",
|
|
|
|
),
|
|
|
|
),
|
|
|
|
("left_side_userlist", models.BooleanField(default=False)),
|
|
|
|
("is_api_super_user", models.BooleanField(db_index=True, default=False)),
|
|
|
|
("is_realm_admin", models.BooleanField(db_index=True, default=False)),
|
|
|
|
("bot_type", models.PositiveSmallIntegerField(db_index=True, null=True)),
|
|
|
|
("default_language", models.CharField(default="en", max_length=50)),
|
|
|
|
("tos_version", models.CharField(max_length=10, null=True)),
|
2017-06-22 11:27:41 +02:00
|
|
|
],
|
2024-08-13 23:43:04 +02:00
|
|
|
options={
|
|
|
|
"abstract": False,
|
|
|
|
},
|
2017-06-22 11:27:41 +02:00
|
|
|
),
|
|
|
|
migrations.CreateModel(
|
2021-02-12 08:20:45 +01:00
|
|
|
name="Message",
|
2017-06-22 11:27:41 +02:00
|
|
|
fields=[
|
2021-02-12 08:19:30 +01:00
|
|
|
(
|
2021-02-12 08:20:45 +01:00
|
|
|
"id",
|
2021-02-12 08:19:30 +01:00
|
|
|
models.AutoField(
|
2021-02-12 08:20:45 +01:00
|
|
|
auto_created=True, primary_key=True, serialize=False, verbose_name="ID"
|
|
|
|
),
|
|
|
|
),
|
|
|
|
("subject", models.CharField(db_index=True, max_length=60)),
|
|
|
|
("content", models.TextField()),
|
|
|
|
("rendered_content", models.TextField(null=True)),
|
|
|
|
("rendered_content_version", models.IntegerField(null=True)),
|
|
|
|
("pub_date", models.DateTimeField(db_index=True, verbose_name="date published")),
|
|
|
|
("last_edit_time", models.DateTimeField(null=True)),
|
|
|
|
("edit_history", models.TextField(null=True)),
|
|
|
|
("has_attachment", models.BooleanField(db_index=True, default=False)),
|
|
|
|
("has_image", models.BooleanField(db_index=True, default=False)),
|
|
|
|
("has_link", models.BooleanField(db_index=True, default=False)),
|
2021-02-12 08:19:30 +01:00
|
|
|
(
|
2024-08-13 23:43:04 +02:00
|
|
|
"recipient",
|
|
|
|
models.ForeignKey(
|
|
|
|
on_delete=django.db.models.deletion.CASCADE, to="zerver.recipient"
|
2021-02-12 08:19:30 +01:00
|
|
|
),
|
|
|
|
),
|
|
|
|
(
|
2024-08-13 23:43:04 +02:00
|
|
|
"sender",
|
|
|
|
models.ForeignKey(
|
|
|
|
on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL
|
|
|
|
),
|
2021-02-12 08:19:30 +01:00
|
|
|
),
|
|
|
|
(
|
2024-08-13 23:43:04 +02:00
|
|
|
"sending_client",
|
2021-02-12 08:19:30 +01:00
|
|
|
models.ForeignKey(
|
2024-08-13 23:43:04 +02:00
|
|
|
on_delete=django.db.models.deletion.CASCADE, to="zerver.client"
|
2021-02-12 08:19:30 +01:00
|
|
|
),
|
|
|
|
),
|
2024-08-13 23:43:04 +02:00
|
|
|
("search_tsvector", django.contrib.postgres.search.SearchVectorField(null=True)),
|
2017-06-22 11:27:41 +02:00
|
|
|
],
|
|
|
|
),
|
|
|
|
migrations.CreateModel(
|
2024-08-13 23:43:04 +02:00
|
|
|
name="UserActivityInterval",
|
2017-06-22 11:27:41 +02:00
|
|
|
fields=[
|
2021-02-12 08:19:30 +01:00
|
|
|
(
|
2021-02-12 08:20:45 +01:00
|
|
|
"id",
|
2021-02-12 08:19:30 +01:00
|
|
|
models.AutoField(
|
2021-02-12 08:20:45 +01:00
|
|
|
auto_created=True, primary_key=True, serialize=False, verbose_name="ID"
|
2021-02-12 08:19:30 +01:00
|
|
|
),
|
|
|
|
),
|
2024-08-13 23:43:04 +02:00
|
|
|
("start", models.DateTimeField(db_index=True, verbose_name="start time")),
|
|
|
|
("end", models.DateTimeField(db_index=True, verbose_name="end time")),
|
2021-02-12 08:19:30 +01:00
|
|
|
(
|
2021-02-12 08:20:45 +01:00
|
|
|
"user_profile",
|
2021-02-12 08:19:30 +01:00
|
|
|
models.ForeignKey(
|
|
|
|
on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL
|
|
|
|
),
|
|
|
|
),
|
2017-06-22 11:27:41 +02:00
|
|
|
],
|
|
|
|
),
|
|
|
|
migrations.CreateModel(
|
2024-08-13 23:43:04 +02:00
|
|
|
name="UserPresence",
|
2017-06-22 11:27:41 +02:00
|
|
|
fields=[
|
2021-02-12 08:19:30 +01:00
|
|
|
(
|
2021-02-12 08:20:45 +01:00
|
|
|
"id",
|
2021-02-12 08:19:30 +01:00
|
|
|
models.AutoField(
|
2021-02-12 08:20:45 +01:00
|
|
|
auto_created=True, primary_key=True, serialize=False, verbose_name="ID"
|
2021-02-12 08:19:30 +01:00
|
|
|
),
|
|
|
|
),
|
2024-08-13 23:43:04 +02:00
|
|
|
("timestamp", models.DateTimeField(verbose_name="presence changed")),
|
|
|
|
("status", models.PositiveSmallIntegerField(default=1)),
|
2021-02-12 08:19:30 +01:00
|
|
|
(
|
2024-08-13 23:43:04 +02:00
|
|
|
"client",
|
|
|
|
models.ForeignKey(
|
|
|
|
on_delete=django.db.models.deletion.CASCADE, to="zerver.client"
|
|
|
|
),
|
2021-02-12 08:19:30 +01:00
|
|
|
),
|
|
|
|
(
|
2024-08-13 23:43:04 +02:00
|
|
|
"user_profile",
|
2021-02-12 08:19:30 +01:00
|
|
|
models.ForeignKey(
|
2024-08-13 23:43:04 +02:00
|
|
|
on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL
|
2021-02-12 08:19:30 +01:00
|
|
|
),
|
|
|
|
),
|
2017-06-22 11:27:41 +02:00
|
|
|
],
|
2024-08-13 23:43:04 +02:00
|
|
|
options={
|
|
|
|
"unique_together": {("user_profile", "client")},
|
|
|
|
},
|
2017-06-22 11:27:41 +02:00
|
|
|
),
|
|
|
|
migrations.CreateModel(
|
2024-08-13 23:43:04 +02:00
|
|
|
name="UserMessage",
|
2017-06-22 11:27:41 +02:00
|
|
|
fields=[
|
2021-02-12 08:19:30 +01:00
|
|
|
(
|
2021-02-12 08:20:45 +01:00
|
|
|
"id",
|
2021-02-12 08:19:30 +01:00
|
|
|
models.AutoField(
|
2021-02-12 08:20:45 +01:00
|
|
|
auto_created=True, primary_key=True, serialize=False, verbose_name="ID"
|
2021-02-12 08:19:30 +01:00
|
|
|
),
|
|
|
|
),
|
|
|
|
(
|
2024-08-13 23:43:04 +02:00
|
|
|
"flags",
|
|
|
|
bitfield.models.BitField(
|
|
|
|
[
|
|
|
|
"read",
|
|
|
|
"starred",
|
|
|
|
"collapsed",
|
|
|
|
"mentioned",
|
|
|
|
"wildcard_mentioned",
|
|
|
|
"summarize_in_home",
|
|
|
|
"summarize_in_stream",
|
|
|
|
"force_expand",
|
|
|
|
"force_collapse",
|
|
|
|
"has_alert_word",
|
|
|
|
"historical",
|
|
|
|
"is_me_message",
|
|
|
|
],
|
|
|
|
default=0,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
(
|
|
|
|
"message",
|
2021-02-12 08:19:30 +01:00
|
|
|
models.ForeignKey(
|
2024-08-13 23:43:04 +02:00
|
|
|
on_delete=django.db.models.deletion.CASCADE, to="zerver.message"
|
2021-02-12 08:19:30 +01:00
|
|
|
),
|
|
|
|
),
|
|
|
|
(
|
2021-02-12 08:20:45 +01:00
|
|
|
"user_profile",
|
2021-02-12 08:19:30 +01:00
|
|
|
models.ForeignKey(
|
|
|
|
on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL
|
|
|
|
),
|
|
|
|
),
|
2017-06-22 11:27:41 +02:00
|
|
|
],
|
2024-08-13 23:43:04 +02:00
|
|
|
options={
|
|
|
|
"unique_together": {("user_profile", "message")},
|
|
|
|
},
|
2017-06-22 11:27:41 +02:00
|
|
|
),
|
|
|
|
migrations.CreateModel(
|
2021-02-12 08:20:45 +01:00
|
|
|
name="UserActivity",
|
2017-06-22 11:27:41 +02:00
|
|
|
fields=[
|
2021-02-12 08:19:30 +01:00
|
|
|
(
|
2021-02-12 08:20:45 +01:00
|
|
|
"id",
|
2021-02-12 08:19:30 +01:00
|
|
|
models.AutoField(
|
2021-02-12 08:20:45 +01:00
|
|
|
auto_created=True, primary_key=True, serialize=False, verbose_name="ID"
|
2021-02-12 08:19:30 +01:00
|
|
|
),
|
|
|
|
),
|
2021-02-12 08:20:45 +01:00
|
|
|
("query", models.CharField(db_index=True, max_length=50)),
|
|
|
|
("count", models.IntegerField()),
|
|
|
|
("last_visit", models.DateTimeField(verbose_name="last visit")),
|
2021-02-12 08:19:30 +01:00
|
|
|
(
|
2021-02-12 08:20:45 +01:00
|
|
|
"client",
|
2021-02-12 08:19:30 +01:00
|
|
|
models.ForeignKey(
|
2024-08-13 23:43:04 +02:00
|
|
|
on_delete=django.db.models.deletion.CASCADE, to="zerver.client"
|
2021-02-12 08:19:30 +01:00
|
|
|
),
|
|
|
|
),
|
|
|
|
(
|
2021-02-12 08:20:45 +01:00
|
|
|
"user_profile",
|
2021-02-12 08:19:30 +01:00
|
|
|
models.ForeignKey(
|
|
|
|
on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL
|
|
|
|
),
|
|
|
|
),
|
2017-06-22 11:27:41 +02:00
|
|
|
],
|
2024-08-13 23:43:04 +02:00
|
|
|
options={
|
|
|
|
"unique_together": {("user_profile", "client", "query")},
|
|
|
|
},
|
2017-06-22 11:27:41 +02:00
|
|
|
),
|
|
|
|
migrations.CreateModel(
|
2024-08-13 23:43:04 +02:00
|
|
|
name="Stream",
|
2017-06-22 11:27:41 +02:00
|
|
|
fields=[
|
2021-02-12 08:19:30 +01:00
|
|
|
(
|
2021-02-12 08:20:45 +01:00
|
|
|
"id",
|
2021-02-12 08:19:30 +01:00
|
|
|
models.AutoField(
|
2021-02-12 08:20:45 +01:00
|
|
|
auto_created=True, primary_key=True, serialize=False, verbose_name="ID"
|
2021-02-12 08:19:30 +01:00
|
|
|
),
|
|
|
|
),
|
2024-08-13 23:43:04 +02:00
|
|
|
("name", models.CharField(db_index=True, max_length=60)),
|
|
|
|
("invite_only", models.BooleanField(default=False, null=True)),
|
2021-02-12 08:19:30 +01:00
|
|
|
(
|
2024-08-13 23:43:04 +02:00
|
|
|
"email_token",
|
|
|
|
models.CharField(default=generate_email_token_for_stream, max_length=32),
|
|
|
|
),
|
|
|
|
("description", models.CharField(default="", max_length=1024)),
|
|
|
|
("date_created", models.DateTimeField(default=django.utils.timezone.now)),
|
|
|
|
("deactivated", models.BooleanField(default=False)),
|
|
|
|
(
|
|
|
|
"realm",
|
2021-02-12 08:19:30 +01:00
|
|
|
models.ForeignKey(
|
2024-08-13 23:43:04 +02:00
|
|
|
on_delete=django.db.models.deletion.CASCADE, to="zerver.realm"
|
2021-02-12 08:19:30 +01:00
|
|
|
),
|
|
|
|
),
|
2017-06-22 11:27:41 +02:00
|
|
|
],
|
2024-08-13 23:43:04 +02:00
|
|
|
options={
|
|
|
|
"unique_together": {("name", "realm")},
|
|
|
|
},
|
2017-06-22 11:27:41 +02:00
|
|
|
),
|
|
|
|
migrations.CreateModel(
|
2024-08-13 23:43:04 +02:00
|
|
|
name="RealmFilter",
|
2017-06-22 11:27:41 +02:00
|
|
|
fields=[
|
2021-02-12 08:19:30 +01:00
|
|
|
(
|
2021-02-12 08:20:45 +01:00
|
|
|
"id",
|
2021-02-12 08:19:30 +01:00
|
|
|
models.AutoField(
|
2021-02-12 08:20:45 +01:00
|
|
|
auto_created=True, primary_key=True, serialize=False, verbose_name="ID"
|
2021-02-12 08:19:30 +01:00
|
|
|
),
|
|
|
|
),
|
2024-08-13 23:43:04 +02:00
|
|
|
("pattern", models.TextField()),
|
|
|
|
("url_format_string", models.TextField()),
|
2021-02-12 08:19:30 +01:00
|
|
|
(
|
2024-08-13 23:43:04 +02:00
|
|
|
"realm",
|
|
|
|
models.ForeignKey(
|
|
|
|
on_delete=django.db.models.deletion.CASCADE, to="zerver.realm"
|
2021-02-12 08:19:30 +01:00
|
|
|
),
|
|
|
|
),
|
2024-08-13 23:43:04 +02:00
|
|
|
],
|
|
|
|
options={
|
|
|
|
"unique_together": {("realm", "pattern")},
|
|
|
|
},
|
|
|
|
),
|
|
|
|
migrations.CreateModel(
|
|
|
|
name="DefaultStream",
|
|
|
|
fields=[
|
2021-02-12 08:19:30 +01:00
|
|
|
(
|
2024-08-13 23:43:04 +02:00
|
|
|
"id",
|
|
|
|
models.AutoField(
|
|
|
|
auto_created=True, primary_key=True, serialize=False, verbose_name="ID"
|
|
|
|
),
|
|
|
|
),
|
|
|
|
(
|
|
|
|
"realm",
|
2021-02-12 08:19:30 +01:00
|
|
|
models.ForeignKey(
|
2024-08-13 23:43:04 +02:00
|
|
|
on_delete=django.db.models.deletion.CASCADE, to="zerver.realm"
|
2021-02-12 08:19:30 +01:00
|
|
|
),
|
|
|
|
),
|
|
|
|
(
|
2024-08-13 23:43:04 +02:00
|
|
|
"stream",
|
2021-02-12 08:19:30 +01:00
|
|
|
models.ForeignKey(
|
2024-08-13 23:43:04 +02:00
|
|
|
on_delete=django.db.models.deletion.CASCADE, to="zerver.stream"
|
2021-02-12 08:19:30 +01:00
|
|
|
),
|
|
|
|
),
|
2017-06-22 11:27:41 +02:00
|
|
|
],
|
2024-08-13 23:43:04 +02:00
|
|
|
options={
|
|
|
|
"unique_together": {("realm", "stream")},
|
|
|
|
},
|
2017-06-22 11:27:41 +02:00
|
|
|
),
|
|
|
|
migrations.CreateModel(
|
2024-08-13 23:43:04 +02:00
|
|
|
name="PushDeviceToken",
|
2017-06-22 11:27:41 +02:00
|
|
|
fields=[
|
2021-02-12 08:19:30 +01:00
|
|
|
(
|
2021-02-12 08:20:45 +01:00
|
|
|
"id",
|
2021-02-12 08:19:30 +01:00
|
|
|
models.AutoField(
|
2021-02-12 08:20:45 +01:00
|
|
|
auto_created=True, primary_key=True, serialize=False, verbose_name="ID"
|
2021-02-12 08:19:30 +01:00
|
|
|
),
|
|
|
|
),
|
2024-08-13 23:43:04 +02:00
|
|
|
("kind", models.PositiveSmallIntegerField(choices=[(1, "apns"), (2, "gcm")])),
|
|
|
|
("token", models.CharField(max_length=4096, unique=True)),
|
|
|
|
("last_updated", models.DateTimeField(auto_now=True)),
|
|
|
|
("ios_app_id", models.TextField(null=True)),
|
2021-02-12 08:19:30 +01:00
|
|
|
(
|
2024-08-13 23:43:04 +02:00
|
|
|
"user",
|
2021-02-12 08:19:30 +01:00
|
|
|
models.ForeignKey(
|
2024-08-13 23:43:04 +02:00
|
|
|
on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
migrations.CreateModel(
|
|
|
|
name="Referral",
|
|
|
|
fields=[
|
|
|
|
(
|
|
|
|
"id",
|
|
|
|
models.AutoField(
|
|
|
|
auto_created=True, primary_key=True, serialize=False, verbose_name="ID"
|
2021-02-12 08:19:30 +01:00
|
|
|
),
|
|
|
|
),
|
2024-08-13 23:43:04 +02:00
|
|
|
("email", models.EmailField(max_length=254)),
|
|
|
|
("timestamp", models.DateTimeField(auto_now_add=True)),
|
2021-02-12 08:19:30 +01:00
|
|
|
(
|
2021-02-12 08:20:45 +01:00
|
|
|
"user_profile",
|
2021-02-12 08:19:30 +01:00
|
|
|
models.ForeignKey(
|
|
|
|
on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL
|
|
|
|
),
|
|
|
|
),
|
2017-06-22 11:27:41 +02:00
|
|
|
],
|
|
|
|
),
|
2024-08-13 23:43:04 +02:00
|
|
|
migrations.CreateModel(
|
|
|
|
name="RealmEmoji",
|
|
|
|
fields=[
|
|
|
|
(
|
|
|
|
"id",
|
|
|
|
models.AutoField(
|
|
|
|
auto_created=True, primary_key=True, serialize=False, verbose_name="ID"
|
|
|
|
),
|
|
|
|
),
|
|
|
|
(
|
|
|
|
"name",
|
|
|
|
models.TextField(
|
|
|
|
validators=[
|
|
|
|
django.core.validators.MinLengthValidator(1),
|
|
|
|
django.core.validators.RegexValidator(
|
|
|
|
message="Invalid characters in emoji name",
|
|
|
|
regex="^[0-9a-zA-Z.\\-_]+(?<![.\\-_])$",
|
|
|
|
),
|
|
|
|
]
|
|
|
|
),
|
|
|
|
),
|
|
|
|
("img_url", models.URLField(max_length=1000)),
|
|
|
|
(
|
|
|
|
"realm",
|
|
|
|
models.ForeignKey(
|
|
|
|
on_delete=django.db.models.deletion.CASCADE, to="zerver.realm"
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
2021-02-12 08:19:30 +01:00
|
|
|
options={
|
2024-08-13 23:43:04 +02:00
|
|
|
"unique_together": {("realm", "name")},
|
2021-02-12 08:19:30 +01:00
|
|
|
},
|
2017-06-22 11:27:41 +02:00
|
|
|
),
|
2024-08-13 23:43:04 +02:00
|
|
|
migrations.CreateModel(
|
|
|
|
name="PreregistrationUser",
|
|
|
|
fields=[
|
|
|
|
(
|
|
|
|
"id",
|
|
|
|
models.AutoField(
|
|
|
|
auto_created=True, primary_key=True, serialize=False, verbose_name="ID"
|
|
|
|
),
|
|
|
|
),
|
|
|
|
("email", models.EmailField(max_length=254)),
|
|
|
|
("invited_at", models.DateTimeField(auto_now=True)),
|
|
|
|
("status", models.IntegerField(default=0)),
|
|
|
|
(
|
|
|
|
"realm",
|
|
|
|
models.ForeignKey(
|
|
|
|
null=True, on_delete=django.db.models.deletion.CASCADE, to="zerver.realm"
|
|
|
|
),
|
|
|
|
),
|
|
|
|
(
|
|
|
|
"referred_by",
|
|
|
|
models.ForeignKey(
|
|
|
|
null=True,
|
|
|
|
on_delete=django.db.models.deletion.CASCADE,
|
|
|
|
to=settings.AUTH_USER_MODEL,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
("realm_creation", models.BooleanField(default=False)),
|
|
|
|
],
|
2017-06-22 11:27:41 +02:00
|
|
|
),
|
|
|
|
migrations.CreateModel(
|
2021-02-12 08:20:45 +01:00
|
|
|
name="Attachment",
|
2017-06-22 11:27:41 +02:00
|
|
|
fields=[
|
2021-02-12 08:19:30 +01:00
|
|
|
(
|
2021-02-12 08:20:45 +01:00
|
|
|
"id",
|
2021-02-12 08:19:30 +01:00
|
|
|
models.AutoField(
|
2021-02-12 08:20:45 +01:00
|
|
|
auto_created=True, primary_key=True, serialize=False, verbose_name="ID"
|
2021-02-12 08:19:30 +01:00
|
|
|
),
|
|
|
|
),
|
2021-02-12 08:20:45 +01:00
|
|
|
("file_name", models.CharField(db_index=True, max_length=100)),
|
|
|
|
("path_id", models.TextField(db_index=True)),
|
2021-02-12 08:19:30 +01:00
|
|
|
(
|
2021-02-12 08:20:45 +01:00
|
|
|
"create_time",
|
2021-02-12 08:19:30 +01:00
|
|
|
models.DateTimeField(db_index=True, default=django.utils.timezone.now),
|
|
|
|
),
|
2024-08-13 23:43:04 +02:00
|
|
|
("messages", models.ManyToManyField(to="zerver.message")),
|
2021-02-12 08:19:30 +01:00
|
|
|
(
|
2021-02-12 08:20:45 +01:00
|
|
|
"owner",
|
2021-02-12 08:19:30 +01:00
|
|
|
models.ForeignKey(
|
|
|
|
on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL
|
|
|
|
),
|
|
|
|
),
|
2021-02-12 08:20:45 +01:00
|
|
|
("is_realm_public", models.BooleanField(default=False)),
|
2024-08-13 23:43:04 +02:00
|
|
|
(
|
|
|
|
"realm",
|
|
|
|
models.ForeignKey(
|
|
|
|
blank=True,
|
|
|
|
null=True,
|
|
|
|
on_delete=django.db.models.deletion.CASCADE,
|
|
|
|
to="zerver.realm",
|
|
|
|
),
|
|
|
|
),
|
2017-06-22 11:27:41 +02:00
|
|
|
],
|
|
|
|
),
|
2024-08-13 23:43:04 +02:00
|
|
|
migrations.CreateModel(
|
|
|
|
name="Subscription",
|
|
|
|
fields=[
|
|
|
|
(
|
|
|
|
"id",
|
|
|
|
models.AutoField(
|
|
|
|
auto_created=True, primary_key=True, serialize=False, verbose_name="ID"
|
|
|
|
),
|
|
|
|
),
|
|
|
|
("active", models.BooleanField(default=True)),
|
|
|
|
("in_home_view", models.BooleanField(default=True, null=True)),
|
|
|
|
("color", models.CharField(default="#c2c2c2", max_length=10)),
|
|
|
|
("desktop_notifications", models.BooleanField(default=True)),
|
|
|
|
("audible_notifications", models.BooleanField(default=True)),
|
|
|
|
("notifications", models.BooleanField(default=False)),
|
|
|
|
(
|
|
|
|
"recipient",
|
|
|
|
models.ForeignKey(
|
|
|
|
on_delete=django.db.models.deletion.CASCADE, to="zerver.recipient"
|
|
|
|
),
|
|
|
|
),
|
|
|
|
(
|
|
|
|
"user_profile",
|
|
|
|
models.ForeignKey(
|
|
|
|
on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL
|
|
|
|
),
|
|
|
|
),
|
|
|
|
("pin_to_top", models.BooleanField(default=False)),
|
|
|
|
],
|
|
|
|
options={
|
|
|
|
"unique_together": {("user_profile", "recipient")},
|
|
|
|
},
|
2017-06-22 11:27:41 +02:00
|
|
|
),
|
2024-08-13 23:43:04 +02:00
|
|
|
# These indexes seem to not squash properly.
|
|
|
|
migrations.AddIndex(
|
2021-02-12 08:20:45 +01:00
|
|
|
model_name="userprofile",
|
2024-08-13 23:43:04 +02:00
|
|
|
index=models.Index(
|
|
|
|
django.db.models.functions.text.Upper("email"), name="upper_userprofile_email_idx"
|
2021-02-12 08:19:30 +01:00
|
|
|
),
|
2017-06-22 11:27:41 +02:00
|
|
|
),
|
2024-08-13 23:43:04 +02:00
|
|
|
migrations.AddIndex(
|
2021-02-12 08:20:45 +01:00
|
|
|
model_name="preregistrationuser",
|
2024-08-13 23:43:04 +02:00
|
|
|
index=models.Index(
|
|
|
|
django.db.models.functions.text.Upper("email"),
|
|
|
|
name="upper_preregistration_email_idx",
|
2021-02-12 08:19:30 +01:00
|
|
|
),
|
2017-06-22 11:27:41 +02:00
|
|
|
),
|
2024-08-13 23:43:04 +02:00
|
|
|
migrations.AddIndex(
|
|
|
|
model_name="message",
|
|
|
|
index=django.contrib.postgres.indexes.GinIndex(
|
|
|
|
models.F("search_tsvector"), fastupdate=False, name="zerver_message_search_tsvector"
|
|
|
|
),
|
2017-06-22 11:27:41 +02:00
|
|
|
),
|
2024-08-13 23:43:04 +02:00
|
|
|
migrations.AddIndex(
|
|
|
|
model_name="message",
|
|
|
|
index=models.Index(
|
|
|
|
django.db.models.functions.text.Upper("subject"), name="upper_subject_idx"
|
|
|
|
),
|
2017-06-22 11:27:41 +02:00
|
|
|
),
|
2024-08-13 23:43:04 +02:00
|
|
|
migrations.AddIndex(
|
|
|
|
model_name="stream",
|
|
|
|
index=models.Index(
|
|
|
|
django.db.models.functions.text.Upper("name"), name="upper_stream_name_idx"
|
|
|
|
),
|
2017-06-22 11:27:41 +02:00
|
|
|
),
|
2024-08-13 23:43:04 +02:00
|
|
|
migrations.AlterModelManagers(
|
|
|
|
name="userprofile",
|
|
|
|
managers=[
|
|
|
|
("objects", django.contrib.auth.models.UserManager()),
|
|
|
|
],
|
2017-06-22 11:27:41 +02:00
|
|
|
),
|
2024-08-13 23:34:16 +02:00
|
|
|
migrations.AddField(
|
|
|
|
model_name="preregistrationuser",
|
|
|
|
name="streams",
|
2024-08-13 23:43:04 +02:00
|
|
|
field=models.ManyToManyField(to="zerver.stream"),
|
2024-08-13 23:34:16 +02:00
|
|
|
),
|
2024-08-13 23:43:04 +02:00
|
|
|
# AddField operations that create import cycles should happen
|
|
|
|
# after those that can be squashed.
|
2024-08-13 23:34:16 +02:00
|
|
|
migrations.AddField(
|
|
|
|
model_name="realm",
|
|
|
|
name="notifications_stream",
|
|
|
|
field=models.ForeignKey(
|
|
|
|
blank=True,
|
|
|
|
null=True,
|
|
|
|
on_delete=django.db.models.deletion.CASCADE,
|
|
|
|
related_name="+",
|
2024-08-13 23:43:04 +02:00
|
|
|
to="zerver.stream",
|
2024-08-13 23:34:16 +02:00
|
|
|
),
|
|
|
|
),
|
|
|
|
migrations.AddField(
|
|
|
|
model_name="userprofile",
|
|
|
|
name="default_events_register_stream",
|
|
|
|
field=models.ForeignKey(
|
|
|
|
null=True,
|
|
|
|
on_delete=django.db.models.deletion.CASCADE,
|
|
|
|
related_name="+",
|
2024-08-13 23:43:04 +02:00
|
|
|
to="zerver.stream",
|
2024-08-13 23:34:16 +02:00
|
|
|
),
|
|
|
|
),
|
|
|
|
migrations.AddField(
|
|
|
|
model_name="userprofile",
|
|
|
|
name="default_sending_stream",
|
|
|
|
field=models.ForeignKey(
|
|
|
|
null=True,
|
|
|
|
on_delete=django.db.models.deletion.CASCADE,
|
|
|
|
related_name="+",
|
2024-08-13 23:43:04 +02:00
|
|
|
to="zerver.stream",
|
2024-08-13 23:34:16 +02:00
|
|
|
),
|
|
|
|
),
|
|
|
|
# Set up full-text search indexes.
|
|
|
|
migrations.RunSQL(
|
|
|
|
sql=fts_sql,
|
|
|
|
),
|
2017-06-22 11:27:41 +02:00
|
|
|
]
|