Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
pgroonga: Remove unnecessary code from first migration.
Tim Abbott1103720f4549
diff --git a/pgroonga/migrations/0001_enable.py b/pgroonga/migrations/0001_enable.pyindex 6156b41625c..b3d9fa64017 100644--- a/pgroonga/migrations/0001_enable.py+++ b/pgroonga/migrations/0001_enable.py@@ -11,43 +11,11 @@ class Migration(migrations.Migration):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(- [- (- """-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;--ALTER TABLE zerver_message ADD COLUMN search_pgroonga text;---- TODO: We want to use CREATE INDEX CONCURRENTLY but it can't be used in--- transaction. Django uses transaction implicitly.--- Django 1.10 may solve the problem.-CREATE INDEX zerver_message_search_pgroonga ON zerver_message- USING pgroonga(search_pgroonga pgroonga.text_full_text_search_ops);-END$$-""",- database_setting,- )- ],- [- (- """-DO $$BEGIN-SET search_path = %(SCHEMA)s,public,pgroonga,pg_catalog;--DROP INDEX zerver_message_search_pgroonga;-ALTER TABLE zerver_message DROP COLUMN search_pgroonga;--SET search_path = %(SCHEMA)s,public;--EXECUTE format('ALTER ROLE %%I SET search_path TO %%L,public', %(USER)s, %(SCHEMA)s);-END$$-""",- database_setting,- )- ],+ sql="ALTER TABLE zerver_message ADD COLUMN search_pgroonga text;",+ reverse_sql="ALTER TABLE zerver_message DROP COLUMN search_pgroonga;",),]diff --git a/pgroonga/migrations/0003_v2_api_upgrade.py b/pgroonga/migrations/0003_v2_api_upgrade.pyindex 5c0d04bacfc..618021fbc05 100644--- a/pgroonga/migrations/0003_v2_api_upgrade.py+++ b/pgroonga/migrations/0003_v2_api_upgrade.py@@ -11,6 +11,16 @@ class Migration(migrations.Migration):database_setting = settings.DATABASES["default"]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([(@@ -20,7 +30,7 @@ EXECUTE format('ALTER ROLE %%I SET search_path TO %%L,public', %(USER)s, %(SCHEMSET search_path = %(SCHEMA)s,public;-DROP INDEX zerver_message_search_pgroonga;+DROP INDEX IF EXISTS zerver_message_search_pgroonga;END$$""",database_setting,@@ -39,7 +49,7 @@ EXECUTE format('ALTER ROLE %%I SET search_path TO %%L,public,pgroonga,pg_catalogSET search_path = %(SCHEMA)s,public,pgroonga,pg_catalog;-DROP INDEX zerver_message_search_pgroonga;+DROP INDEX IF EXISTS zerver_message_search_pgroonga;END$$""",database_setting,