summaryrefslogtreecommitdiffstats
path: root/db
diff options
context:
space:
mode:
authorGo MAEDA <maeda@farend.jp>2020-10-23 00:13:38 +0000
committerGo MAEDA <maeda@farend.jp>2020-10-23 00:13:38 +0000
commitfdba424d77ef3d835f89d37f3f04840fbc2c839f (patch)
tree2cc93e4773177357bb42223840ebb3f201f5ab7e /db
parent5280861cf309652d0ebf64658ef9cf2563ef8745 (diff)
downloadredmine-fdba424d77ef3d835f89d37f3f04840fbc2c839f.tar.gz
redmine-fdba424d77ef3d835f89d37f3f04840fbc2c839f.zip
Use match? instead of =~ when MatchData is not used (#34150).
Patch by Go MAEDA. git-svn-id: http://svn.redmine.org/redmine/trunk@20168 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'db')
-rw-r--r--db/migrate/20120422150750_change_repositories_to_full_sti.rb2
-rw-r--r--db/migrate/20180923082945_change_sqlite_booleans_to_0_and_1.rb4
-rw-r--r--db/migrate/20180923091603_change_sqlite_booleans_default.rb4
3 files changed, 5 insertions, 5 deletions
diff --git a/db/migrate/20120422150750_change_repositories_to_full_sti.rb b/db/migrate/20120422150750_change_repositories_to_full_sti.rb
index 101ecbc12..f97d47cf1 100644
--- a/db/migrate/20120422150750_change_repositories_to_full_sti.rb
+++ b/db/migrate/20120422150750_change_repositories_to_full_sti.rb
@@ -3,7 +3,7 @@ class ChangeRepositoriesToFullSti < ActiveRecord::Migration[4.2]
Repository.connection.
select_rows("SELECT id, type FROM #{Repository.table_name}").
each do |repository_id, repository_type|
- unless repository_type =~ /^Repository::/
+ unless /^Repository::/.match?(repository_type)
Repository.where(["id = ?", repository_id]).
update_all(["type = ?", "Repository::#{repository_type}"])
end
diff --git a/db/migrate/20180923082945_change_sqlite_booleans_to_0_and_1.rb b/db/migrate/20180923082945_change_sqlite_booleans_to_0_and_1.rb
index fb789ae10..769ea7a51 100644
--- a/db/migrate/20180923082945_change_sqlite_booleans_to_0_and_1.rb
+++ b/db/migrate/20180923082945_change_sqlite_booleans_to_0_and_1.rb
@@ -23,7 +23,7 @@ class ChangeSqliteBooleansTo0And1 < ActiveRecord::Migration[5.2]
}
def up
- if ActiveRecord::Base.connection.adapter_name =~ /sqlite/i
+ if /sqlite/i.match?(ActiveRecord::Base.connection.adapter_name)
COLUMNS.each do |klass, columns|
columns.each do |column|
klass.where("#{column} = 't'").update_all(column => 1)
@@ -34,7 +34,7 @@ class ChangeSqliteBooleansTo0And1 < ActiveRecord::Migration[5.2]
end
def down
- if ActiveRecord::Base.connection.adapter_name =~ /sqlite/i
+ if /sqlite/i.match?(ActiveRecord::Base.connection.adapter_name)
COLUMNS.each do |klass, columns|
columns.each do |column|
klass.where("#{column} = 1").update_all(column => 't')
diff --git a/db/migrate/20180923091603_change_sqlite_booleans_default.rb b/db/migrate/20180923091603_change_sqlite_booleans_default.rb
index 563bf3237..e72917b12 100644
--- a/db/migrate/20180923091603_change_sqlite_booleans_default.rb
+++ b/db/migrate/20180923091603_change_sqlite_booleans_default.rb
@@ -74,7 +74,7 @@ class ChangeSqliteBooleansDefault < ActiveRecord::Migration[5.2]
}
def up
- if ActiveRecord::Base.connection.adapter_name =~ /sqlite/i
+ if /sqlite/i.match?(ActiveRecord::Base.connection.adapter_name)
DEFAULTS.each do |table, defaults|
defaults.each do |column, value|
# Reset default values for boolean column (t/f => 1/0)
@@ -85,7 +85,7 @@ class ChangeSqliteBooleansDefault < ActiveRecord::Migration[5.2]
end
def down
- if ActiveRecord::Base.connection.adapter_name =~ /sqlite/i
+ if /sqlite/i.match?(ActiveRecord::Base.connection.adapter_name)
# Cannot restore default values as t/f
raise ActiveRecord::IrreversibleMigration
end