Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

zproject: Remove mostly-unused SCHEMA in database config.

Alex Vandiverf0977a046f33
diff --git a/pgroonga/migrations/0003_v2_api_upgrade.py b/pgroonga/migrations/0003_v2_api_upgrade.py
index 618021fbc05..b76a1893452 100644
--- a/pgroonga/migrations/0003_v2_api_upgrade.py
+++ b/pgroonga/migrations/0003_v2_api_upgrade.py
@@ -1,4 +1,3 @@
-from django.conf import settings
from django.db import migrations
@@ -9,7 +8,6 @@ class Migration(migrations.Migration):
("pgroonga", "0002_html_escape_subject"),
]
- database_setting = settings.DATABASES["default"]
operations = [
# This migration does the following things:
# * Undoes the `search_path` changes from the original migration 0001,
@@ -22,43 +20,23 @@ class Migration(migrations.Migration):
# 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",
(
- """
-DO $$BEGIN
-EXECUTE format('ALTER ROLE %%I SET search_path TO %%L,public', %(USER)s, %(SCHEMA)s);
-
-SET search_path = %(SCHEMA)s,public;
-
-DROP INDEX IF EXISTS zerver_message_search_pgroonga;
-END$$
-""",
- database_setting,
+ "CREATE INDEX CONCURRENTLY zerver_message_search_pgroonga ON zerver_message "
+ "USING pgroonga(search_pgroonga pgroonga_text_full_text_search_ops_v2)"
),
- """
-
-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",
(
- """
-DO $$BEGIN
-EXECUTE format('ALTER ROLE %%I SET search_path TO %%L,public,pgroonga,pg_catalog', %(USER)s, %(SCHEMA)s);
-
-SET search_path = %(SCHEMA)s,public,pgroonga,pg_catalog;
-
-DROP INDEX IF EXISTS zerver_message_search_pgroonga;
-END$$
-""",
- database_setting,
+ "CREATE INDEX CONCURRENTLY zerver_message_search_pgroonga ON zerver_message "
+ "USING pgroonga(search_pgroonga pgroonga.text_full_text_search_ops)"
),
- """
-
-CREATE INDEX CONCURRENTLY zerver_message_search_pgroonga ON zerver_message
- USING pgroonga(search_pgroonga pgroonga.text_full_text_search_ops);
- """,
],
),
]
diff --git a/zproject/computed_settings.py b/zproject/computed_settings.py
index 7eece9162e7..ce930873711 100644
--- a/zproject/computed_settings.py
+++ b/zproject/computed_settings.py
@@ -353,7 +353,6 @@ DATABASES: dict[str, dict[str, Any]] = {
"PASSWORD": "",
# Host = '' => connect to localhost by default
"HOST": "",
- "SCHEMA": "zulip",
"CONN_MAX_AGE": 600,
"OPTIONS": {
"connection_factory": TimeTrackingConnection,
diff --git a/zproject/test_extra_settings.py b/zproject/test_extra_settings.py
index 6f3ec6ba500..1090ef50529 100644
--- a/zproject/test_extra_settings.py
+++ b/zproject/test_extra_settings.py
@@ -31,7 +31,6 @@ DATABASES["default"] = {
"USER": "zulip_test",
"PASSWORD": LOCAL_DATABASE_PASSWORD,
"HOST": "localhost",
- "SCHEMA": "zulip",
"ENGINE": "django.db.backends.postgresql",
"TEST_NAME": "django_zulip_tests",
"OPTIONS": {