]> source.dussan.org Git - redmine.git/commitdiff
Replaces find(:first) calls in migrations.
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Mon, 3 Dec 2012 18:25:57 +0000 (18:25 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Mon, 3 Dec 2012 18:25:57 +0000 (18:25 +0000)
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@10929 e93f8b46-1217-0410-a6f0-8f06a7374b81

db/migrate/002_issue_move.rb
db/migrate/003_issue_add_note.rb
db/migrate/004_export_pdf.rb
db/migrate/006_calendar_and_activity.rb
db/migrate/007_create_journals.rb
db/migrate/012_add_comments_permissions.rb
db/migrate/014_add_queries_permissions.rb
db/migrate/016_add_repositories_permissions.rb
db/migrate/024_add_roadmap_permission.rb

index 085593e08ae641d466c56738c9722f0641dd54e3..98e95d3b9655c753ca2d01181d861d43ec10f650 100644 (file)
@@ -7,6 +7,6 @@ class IssueMove < ActiveRecord::Migration
   end
 
   def self.down
-    Permission.find(:first, :conditions => ["controller=? and action=?", 'projects', 'move_issues']).destroy
+    Permission.where("controller=? and action=?", 'projects', 'move_issues').first.destroy
   end
 end
index a2ab756ee78729f5a1ce3ebb164e361cbaa65fdb..dabdb858f35f317e805852e52a6d5989bb16a472 100644 (file)
@@ -7,6 +7,6 @@ class IssueAddNote < ActiveRecord::Migration
   end
 
   def self.down
-    Permission.find(:first, :conditions => ["controller=? and action=?", 'issues', 'add_note']).destroy
+    Permission.where("controller=? and action=?", 'issues', 'add_note').first.destroy
   end
 end
index 6ccd67eae9d999359554fd606af7f955dd392c65..8d4ba0b3a5eaad88103af41e68e2a76aee14dc24 100644 (file)
@@ -8,7 +8,7 @@ class ExportPdf < ActiveRecord::Migration
   end
 
   def self.down
-    Permission.find(:first, :conditions => ["controller=? and action=?", 'projects', 'export_issues_pdf']).destroy
-    Permission.find(:first, :conditions => ["controller=? and action=?", 'issues', 'export_pdf']).destroy
+    Permission.where("controller=? and action=?", 'projects', 'export_issues_pdf').first.destroy
+    Permission.where("controller=? and action=?", 'issues', 'export_pdf').first.destroy
   end
 end
index 1cdc91d8e73c317371d1d7197f50354aa1249fc9..a30979a21d3fc437977e62091f33e1b57b882f03 100644 (file)
@@ -9,8 +9,8 @@ class CalendarAndActivity < ActiveRecord::Migration
   end
 
   def self.down
-    Permission.find(:first, :conditions => ["controller=? and action=?", 'projects', 'activity']).destroy
-    Permission.find(:first, :conditions => ["controller=? and action=?", 'projects', 'calendar']).destroy
-    Permission.find(:first, :conditions => ["controller=? and action=?", 'projects', 'gantt']).destroy
+    Permission.where("controller=? and action=?", 'projects', 'activity').first.destroy
+    Permission.where("controller=? and action=?", 'projects', 'calendar').first.destroy
+    Permission.where("controller=? and action=?", 'projects', 'gantt').first.destroy
   end
 end
index e219ef67a8b2b879ec271b7785521c22582c6c45..63bdd2374a776b1cde68e265d98e4c870aba6a79 100644 (file)
@@ -51,6 +51,6 @@ class CreateJournals < ActiveRecord::Migration
 
     add_index "issue_histories", ["issue_id"], :name => "issue_histories_issue_id"
 
-    Permission.find(:first, :conditions => ["controller=? and action=?", 'issues', 'history']).destroy
+    Permission.where("controller=? and action=?", 'issues', 'history').first.destroy
   end
 end
index 2bbf87b02744d33f20b15600d02332dd542d2069..91eed64437480b83b7bfb8a766ad02eedb177242 100644 (file)
@@ -8,7 +8,7 @@ class AddCommentsPermissions < ActiveRecord::Migration
   end
 
   def self.down
-    Permission.find(:first, :conditions => ["controller=? and action=?", 'news', 'add_comment']).destroy
-    Permission.find(:first, :conditions => ["controller=? and action=?", 'news', 'destroy_comment']).destroy
+    Permission.where("controller=? and action=?", 'news', 'add_comment').first.destroy
+    Permission.where("controller=? and action=?", 'news', 'destroy_comment').first.destroy
   end
 end
index 34eba1e26665e97353eb719036ba6478b8672d31..ae1f2455d13b2f0971b523e6ec10b826934e7673 100644 (file)
@@ -7,6 +7,6 @@ class AddQueriesPermissions < ActiveRecord::Migration
   end
 
   def self.down
-    Permission.find(:first, :conditions => ["controller=? and action=?", 'projects', 'add_query']).destroy
+    Permission.where("controller=? and action=?", 'projects', 'add_query').first.destroy
   end
 end
index 341707639beeaf6929f4070684e9828a907b66a1..9fcddb09c8a25f42af8c9981ba963f1328db0ab8 100644 (file)
@@ -12,11 +12,11 @@ class AddRepositoriesPermissions < ActiveRecord::Migration
   end
 
   def self.down
-    Permission.find(:first, :conditions => ["controller=? and action=?", 'repositories', 'show']).destroy
-    Permission.find(:first, :conditions => ["controller=? and action=?", 'repositories', 'browse']).destroy
-    Permission.find(:first, :conditions => ["controller=? and action=?", 'repositories', 'entry']).destroy
-    Permission.find(:first, :conditions => ["controller=? and action=?", 'repositories', 'revisions']).destroy
-    Permission.find(:first, :conditions => ["controller=? and action=?", 'repositories', 'revision']).destroy
-    Permission.find(:first, :conditions => ["controller=? and action=?", 'repositories', 'diff']).destroy
+    Permission.where("controller=? and action=?", 'repositories', 'show').first.destroy
+    Permission.where("controller=? and action=?", 'repositories', 'browse').first.destroy
+    Permission.where("controller=? and action=?", 'repositories', 'entry').first.destroy
+    Permission.where("controller=? and action=?", 'repositories', 'revisions').first.destroy
+    Permission.where("controller=? and action=?", 'repositories', 'revision').first.destroy
+    Permission.where("controller=? and action=?", 'repositories', 'diff').first.destroy
   end
 end
index 5c37beac15c288fbf242404c2df00c6ce343cd60..f521e60259d8e91647ccf759b8d1cb248281f6c1 100644 (file)
@@ -7,6 +7,6 @@ class AddRoadmapPermission < ActiveRecord::Migration
   end
 
   def self.down
-    Permission.find(:first, :conditions => ["controller=? and action=?", 'projects', 'roadmap']).destroy
+    Permission.where("controller=? and action=?", 'projects', 'roadmap').first.destroy
   end
 end