snapshot of https://github.com/zulip/zulip.git @ 48c69911c7dd4e03b20552eb3bd77ad8151c1357 (2026-09-15)
Some checks failed
Code scanning / CodeQL (push) Failing after 15s
Zulip production suite / Ubuntu 22.04 production build (push) Failing after 26s
Zulip production suite / Debian 12 production install with custom db name and user (push) Has been skipped
Zulip production suite / Ubuntu 22.04 production install and PostgreSQL upgrade with pgroonga (push) Has been skipped
Zulip production suite / Ubuntu 24.04 production install (push) Has been skipped
Zulip production suite / Ubuntu 26.04 production install (push) Has been skipped
Zulip production suite / Debian 13 production install (push) Has been skipped
Zulip production suite / 7.0 Version Upgrade (push) Has been skipped
Zulip production suite / 8.0 Version Upgrade (push) Has been skipped
Zulip production suite / 6.0 Version Upgrade (push) Has been skipped
Zulip production suite / 10.0 Version Upgrade (push) Has been skipped
Zulip production suite / 9.0 Version Upgrade (push) Has been skipped
Zulip production suite / 12.0 Version Upgrade (push) Has been skipped
Zulip production suite / 11.0 Version Upgrade (push) Has been skipped
GitHub Actions Security Analysis with zizmor / zizmor (push) Failing after 3s
Zulip CI / Debian 12 (Python 3.11, backend + documentation) (push) Failing after 26s
Zulip CI / Ubuntu 22.04 (Python 3.10, backend + frontend) (push) Failing after 3s
Zulip CI / Ubuntu 24.04 (Python 3.12, backend) (push) Failing after 25s
Zulip CI / Ubuntu 26.04 (Python 3.14, backend) (push) Failing after 25s
Zulip CI / Debian 13 (Python 3.13, backend) (push) Failing after 28s
Zulip production suite / Required jobs (push) Has been cancelled
Zulip CI / Required jobs (push) Has been cancelled
API Documentation Update Check / check-feature-level-updated (push) Has been cancelled
API Documentation Update Check / notify-if-api-docs-changed (push) Has been cancelled
Some checks failed
Code scanning / CodeQL (push) Failing after 15s
Zulip production suite / Ubuntu 22.04 production build (push) Failing after 26s
Zulip production suite / Debian 12 production install with custom db name and user (push) Has been skipped
Zulip production suite / Ubuntu 22.04 production install and PostgreSQL upgrade with pgroonga (push) Has been skipped
Zulip production suite / Ubuntu 24.04 production install (push) Has been skipped
Zulip production suite / Ubuntu 26.04 production install (push) Has been skipped
Zulip production suite / Debian 13 production install (push) Has been skipped
Zulip production suite / 7.0 Version Upgrade (push) Has been skipped
Zulip production suite / 8.0 Version Upgrade (push) Has been skipped
Zulip production suite / 6.0 Version Upgrade (push) Has been skipped
Zulip production suite / 10.0 Version Upgrade (push) Has been skipped
Zulip production suite / 9.0 Version Upgrade (push) Has been skipped
Zulip production suite / 12.0 Version Upgrade (push) Has been skipped
Zulip production suite / 11.0 Version Upgrade (push) Has been skipped
GitHub Actions Security Analysis with zizmor / zizmor (push) Failing after 3s
Zulip CI / Debian 12 (Python 3.11, backend + documentation) (push) Failing after 26s
Zulip CI / Ubuntu 22.04 (Python 3.10, backend + frontend) (push) Failing after 3s
Zulip CI / Ubuntu 24.04 (Python 3.12, backend) (push) Failing after 25s
Zulip CI / Ubuntu 26.04 (Python 3.14, backend) (push) Failing after 25s
Zulip CI / Debian 13 (Python 3.13, backend) (push) Failing after 28s
Zulip production suite / Required jobs (push) Has been cancelled
Zulip CI / Required jobs (push) Has been cancelled
API Documentation Update Check / check-feature-level-updated (push) Has been cancelled
API Documentation Update Check / notify-if-api-docs-changed (push) Has been cancelled
This commit is contained in:
0
pgroonga/__init__.py
Normal file
0
pgroonga/__init__.py
Normal file
20
pgroonga/migrations/0001_enable.py
Normal file
20
pgroonga/migrations/0001_enable.py
Normal file
@@ -0,0 +1,20 @@
|
||||
from django.conf import settings
|
||||
from django.db import migrations
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
dependencies = [
|
||||
("zerver", "0001_initial"),
|
||||
]
|
||||
|
||||
database_setting = settings.DATABASES["default"]
|
||||
|
||||
operations = [
|
||||
# This previously had additional operations, but they are all
|
||||
# undone in migration 0003 because we switched to using the
|
||||
# PGroonga v2 API.
|
||||
migrations.RunSQL(
|
||||
sql="ALTER TABLE zerver_message ADD COLUMN search_pgroonga text;",
|
||||
reverse_sql="ALTER TABLE zerver_message DROP COLUMN search_pgroonga;",
|
||||
),
|
||||
]
|
||||
28
pgroonga/migrations/0002_html_escape_subject.py
Normal file
28
pgroonga/migrations/0002_html_escape_subject.py
Normal file
@@ -0,0 +1,28 @@
|
||||
from django.db import connection, migrations
|
||||
from django.db.backends.base.schema import BaseDatabaseSchemaEditor
|
||||
from django.db.migrations.state import StateApps
|
||||
from psycopg2.sql import SQL
|
||||
|
||||
from zerver.lib.migrate import do_batch_update
|
||||
|
||||
|
||||
def rebuild_pgroonga_index(apps: StateApps, schema_editor: BaseDatabaseSchemaEditor) -> None:
|
||||
with connection.cursor() as cursor:
|
||||
do_batch_update(
|
||||
cursor,
|
||||
"zerver_message",
|
||||
[SQL("search_pgroonga = escape_html(subject) || ' ' || rendered_content")],
|
||||
batch_size=10000,
|
||||
)
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
atomic = False
|
||||
|
||||
dependencies = [
|
||||
("pgroonga", "0001_enable"),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.RunPython(rebuild_pgroonga_index, reverse_code=migrations.RunPython.noop),
|
||||
]
|
||||
42
pgroonga/migrations/0003_v2_api_upgrade.py
Normal file
42
pgroonga/migrations/0003_v2_api_upgrade.py
Normal file
@@ -0,0 +1,42 @@
|
||||
from django.db import migrations
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
atomic = False
|
||||
|
||||
dependencies = [
|
||||
("pgroonga", "0002_html_escape_subject"),
|
||||
]
|
||||
|
||||
operations = [
|
||||
# This migration does the following things:
|
||||
# * Undoes the `search_path` changes from the original migration 0001,
|
||||
# which are no longer necessary with the modern PGroonga API.
|
||||
# (Note that we've deleted those changes from the current version of the
|
||||
# 0001 migration).
|
||||
# * Drops a legacy-format v1 index if present (will be only if upgrading
|
||||
# an old server).
|
||||
# * Does a CREATE INDEX CONCURRENTLY to add a PGroonga v2 search index
|
||||
# on the message.search_pgroonga column (which was populated in
|
||||
# migration 0002).
|
||||
migrations.RunSQL(
|
||||
sql=[
|
||||
"ALTER ROLE CURRENT_USER SET search_path TO zulip,public",
|
||||
"SET search_path = zulip,public",
|
||||
"DROP INDEX IF EXISTS zerver_message_search_pgroonga",
|
||||
(
|
||||
"CREATE INDEX CONCURRENTLY zerver_message_search_pgroonga ON zerver_message "
|
||||
"USING pgroonga(search_pgroonga pgroonga_text_full_text_search_ops_v2)"
|
||||
),
|
||||
],
|
||||
reverse_sql=[
|
||||
"ALTER ROLE CURRENT_USER SET search_path TO zulip,public,pgroonga,pg_catalog",
|
||||
"SET search_path = zulip,public,pgroonga,pg_catalog",
|
||||
"DROP INDEX IF EXISTS zerver_message_search_pgroonga",
|
||||
(
|
||||
"CREATE INDEX CONCURRENTLY zerver_message_search_pgroonga ON zerver_message "
|
||||
"USING pgroonga(search_pgroonga pgroonga.text_full_text_search_ops)"
|
||||
),
|
||||
],
|
||||
),
|
||||
]
|
||||
0
pgroonga/migrations/__init__.py
Normal file
0
pgroonga/migrations/__init__.py
Normal file
Reference in New Issue
Block a user