Commit 5e3d4ef8 authored by Thong Kuah's avatar Thong Kuah

Skip sql queries generated by database_cleaner

parent 839a8400
...@@ -24,6 +24,10 @@ module Database ...@@ -24,6 +24,10 @@ module Database
def self.validate_cross_joins!(sql) def self.validate_cross_joins!(sql)
return if Thread.current[:allow_cross_joins_across_databases] return if Thread.current[:allow_cross_joins_across_databases]
# Allow spec/support/database_cleaner.rb queries to disable/enable triggers for many tables
# See https://gitlab.com/gitlab-org/gitlab/-/issues/339396
return if sql.include?("DISABLE TRIGGER") || sql.include?("ENABLE TRIGGER")
# PgQuery might fail in some cases due to limited nesting: # PgQuery might fail in some cases due to limited nesting:
# https://github.com/pganalyze/pg_query/issues/209 # https://github.com/pganalyze/pg_query/issues/209
tables = PgQuery.parse(sql).tables tables = PgQuery.parse(sql).tables
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment