summaryrefslogtreecommitdiff
path: root/lib/gitlab/database/schema_cleaner.rb
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-06-18 11:18:50 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-06-18 11:18:50 +0000
commit8c7f4e9d5f36cff46365a7f8c4b9c21578c1e781 (patch)
treea77e7fe7a93de11213032ed4ab1f33a3db51b738 /lib/gitlab/database/schema_cleaner.rb
parent00b35af3db1abfe813a778f643dad221aad51fca (diff)
downloadgitlab-ce-8c7f4e9d5f36cff46365a7f8c4b9c21578c1e781.tar.gz
Add latest changes from gitlab-org/gitlab@13-1-stable-ee
Diffstat (limited to 'lib/gitlab/database/schema_cleaner.rb')
-rw-r--r--lib/gitlab/database/schema_cleaner.rb18
1 files changed, 3 insertions, 15 deletions
diff --git a/lib/gitlab/database/schema_cleaner.rb b/lib/gitlab/database/schema_cleaner.rb
index c1436d3e7ca..ae9d77e635e 100644
--- a/lib/gitlab/database/schema_cleaner.rb
+++ b/lib/gitlab/database/schema_cleaner.rb
@@ -12,27 +12,15 @@ module Gitlab
def clean(io)
structure = original_schema.dup
- # Postgres compat fix for PG 9.6 (which doesn't support (AS datatype) syntax for sequences)
- structure.gsub!(/CREATE SEQUENCE [^.]+\.\S+\n(\s+AS integer\n)/) { |m| m.gsub(Regexp.last_match[1], '') }
-
- # Also a PG 9.6 compatibility fix, see below.
- structure.gsub!(/^CREATE EXTENSION IF NOT EXISTS plpgsql.*/, '')
- structure.gsub!(/^COMMENT ON EXTENSION.*/, '')
-
# Remove noise
+ structure.gsub!(/^COMMENT ON EXTENSION.*/, '')
structure.gsub!(/^SET.+/, '')
structure.gsub!(/^SELECT pg_catalog\.set_config\('search_path'.+/, '')
structure.gsub!(/^--.*/, "\n")
- structure.gsub!(/\n{3,}/, "\n\n")
- io << "SET search_path=public;\n\n"
+ structure = "SET search_path=public;\n" + structure
- # Adding plpgsql explicitly is again a compatibility fix for PG 9.6
- # In more recent versions of pg_dump, the extension isn't explicitly dumped anymore.
- # We use PG 9.6 still on CI and for schema checks - here this is still the case.
- io << <<~SQL.strip
- CREATE EXTENSION IF NOT EXISTS plpgsql WITH SCHEMA pg_catalog;
- SQL
+ structure.gsub!(/\n{3,}/, "\n\n")
io << structure