Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/db
diff options
context:
space:
mode:
authorLin Jen-Shin <godfat@godfat.org>2017-02-06 16:51:19 +0300
committerLin Jen-Shin <godfat@godfat.org>2017-02-14 15:13:54 +0300
commit887aeefba63429b6603c75e385148a2c6be34be1 (patch)
tree422cdb8c93eede3f9b63a62af4354abfc2fe98e0 /db
parent25cd5aa228ebe10ce9eabb17c75eb86e9d8c152c (diff)
Use IS FALSE for both pg and mysql; Handle connections
by ourselves so that even if the setting has 1 connection we could still use more connections.
Diffstat (limited to 'db')
-rw-r--r--db/post_migrate/20170206040400_remove_inactive_default_email_services.rb20
1 files changed, 11 insertions, 9 deletions
diff --git a/db/post_migrate/20170206040400_remove_inactive_default_email_services.rb b/db/post_migrate/20170206040400_remove_inactive_default_email_services.rb
index dc7750f3244..b107d9204d2 100644
--- a/db/post_migrate/20170206040400_remove_inactive_default_email_services.rb
+++ b/db/post_migrate/20170206040400_remove_inactive_default_email_services.rb
@@ -7,14 +7,14 @@ class RemoveInactiveDefaultEmailServices < ActiveRecord::Migration
builds_service = spawn <<-SQL.strip_heredoc
DELETE FROM services
WHERE type = 'BuildsEmailService'
- AND active = #{false_value}
+ AND active IS FALSE
AND properties = '{"notify_only_broken_builds":true}';
SQL
pipelines_service = spawn <<-SQL.strip_heredoc
DELETE FROM services
WHERE type = 'PipelinesEmailService'
- AND active = #{false_value}
+ AND active IS FALSE
AND properties = '{"notify_only_broken_pipelines":true}';
SQL
@@ -25,17 +25,19 @@ class RemoveInactiveDefaultEmailServices < ActiveRecord::Migration
def spawn(query)
Thread.new do
- ActiveRecord::Base.connection_pool.with_connection do
- ActiveRecord::Base.connection.execute(query)
+ with_connection do |connection|
+ connection.execute(query)
end
end
end
- def quote(value)
- ActiveRecord::Base.connection.quote(value)
- end
+ def with_connection
+ pool = ActiveRecord::Base.establish_connection
+ connection = pool.connection
+
+ yield(connection)
- def false_value
- quote(false)
+ ensure
+ connection.close
end
end