A platform for community discussion. Free, open, simple.
DEV: Strip `COMMENT ON EXTENSION` from `structure.sql` (#40034)
David Taylor7468730373cc
diff --git a/db/structure.sql b/db/structure.sqlindex ef5adf19dfd..a2492d4c4f2 100644--- a/db/structure.sql+++ b/db/structure.sql@@ -23,13 +23,6 @@ CREATE SCHEMA discourse_functions;CREATE EXTENSION IF NOT EXISTS hstore WITH SCHEMA public;------ Name: EXTENSION hstore; Type: COMMENT; Schema: -; Owner: ------COMMENT ON EXTENSION hstore IS 'data type for storing sets of (key, value) pairs';------ Name: pg_trgm; Type: EXTENSION; Schema: -; Owner: ---@@ -37,13 +30,6 @@ COMMENT ON EXTENSION hstore IS 'data type for storing sets of (key, value) pairsCREATE EXTENSION IF NOT EXISTS pg_trgm WITH SCHEMA public;------ Name: EXTENSION pg_trgm; Type: COMMENT; Schema: -; Owner: ------COMMENT ON EXTENSION pg_trgm IS 'text similarity measurement and index searching based on trigrams';------ Name: unaccent; Type: EXTENSION; Schema: -; Owner: ---@@ -51,13 +37,6 @@ COMMENT ON EXTENSION pg_trgm IS 'text similarity measurement and index searchingCREATE EXTENSION IF NOT EXISTS unaccent WITH SCHEMA public;------ Name: EXTENSION unaccent; Type: COMMENT; Schema: -; Owner: ------COMMENT ON EXTENSION unaccent IS 'text search dictionary that removes accents';------ Name: vector; Type: EXTENSION; Schema: -; Owner: ---@@ -65,13 +44,6 @@ COMMENT ON EXTENSION unaccent IS 'text search dictionary that removes accents';CREATE EXTENSION IF NOT EXISTS vector WITH SCHEMA public;------ Name: EXTENSION vector; Type: COMMENT; Schema: -; Owner: ------COMMENT ON EXTENSION vector IS 'vector data type and ivfflat and hnsw access methods';------ Name: ai_moderation_setting_type; Type: TYPE; Schema: public; Owner: ---diff --git a/lib/tasks/db_structure.rake b/lib/tasks/db_structure.rakeindex f28d5422cac..aaf3752a749 100644--- a/lib/tasks/db_structure.rake+++ b/lib/tasks/db_structure.rake@@ -104,3 +104,18 @@ task "db:check_structure_dump:assert_no_unexpected_rows" => :environment do- #{unexpected.join("\n - ")}MSGend++Rake::Task["db:schema:dump"].enhance do+ filename = ENV["SCHEMA"] || "db/structure.sql"+ next unless File.exist?(filename)++ contents = File.read(filename)++ # `COMMENT ON EXTENSION` requires extension ownership, which we might not have.+ # It's not essential - strip it out.+ contents.gsub!(+ /^--\n-- Name: EXTENSION [^;]+; Type: COMMENT;[^\n]*\n--\n\nCOMMENT ON EXTENSION [^\n]+\n\n\n/,+ "",+ )+ File.write(filename, contents)+end