]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-7676 rename_table must drop and create Oracle triggers
authorSébastien Lesaint <sebastien.lesaint@sonarsource.com>
Wed, 7 Sep 2016 13:34:14 +0000 (15:34 +0200)
committerSébastien Lesaint <sebastien.lesaint@sonarsource.com>
Fri, 9 Sep 2016 07:11:42 +0000 (09:11 +0200)
server/sonar-web/src/main/webapp/WEB-INF/config/environment.rb

index 2c11674da9549acb50a8b42d7f2e48371c693220..c074b06be766c7922ecf7569dbe2ffc53fec3f2b 100644 (file)
@@ -242,6 +242,12 @@ class ActiveRecord::Migration
     drop_id_trigger(table_name) if dialect()=='oracle'
   end
 
+  def self.rename_table(old_table_name, new_table_name, options = {})
+    drop_id_trigger(old_table_name) if dialect()=='oracle' && options[:id] != false
+    super(old_table_name, new_table_name)
+    create_id_trigger(new_table_name) if dialect()=='oracle' && options[:id] != false
+  end
+
   def self.create_id_trigger(table)
       execute_ddl("create trigger for table #{table}",