From: simonbrandhof Date: Sun, 2 Jan 2011 21:29:10 +0000 (+0000) Subject: fix derby migration X-Git-Tag: 2.6~208 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=92c661f4dade61e67a33482536d473f5ea298b62;p=sonarqube.git fix derby migration --- diff --git a/sonar-server/src/main/webapp/WEB-INF/db/migrate/163_add_variation_columns.rb b/sonar-server/src/main/webapp/WEB-INF/db/migrate/163_add_variation_columns.rb index 00b079eb6f3..62048e4bfba 100644 --- a/sonar-server/src/main/webapp/WEB-INF/db/migrate/163_add_variation_columns.rb +++ b/sonar-server/src/main/webapp/WEB-INF/db/migrate/163_add_variation_columns.rb @@ -45,8 +45,13 @@ class AddVariationColumns < ActiveRecord::Migration add_measures_column('variation_value_2') add_measures_column('variation_value_3') add_measures_column('variation_value_4') - add_measures_column('variation_value_5') + add_measures_column('variation_value_5') + + add_snapshots_columns() end + + ProjectMeasure.reset_column_information() + Snapshot.reset_column_information() end private @@ -202,4 +207,34 @@ class AddVariationColumns < ActiveRecord::Migration ProjectMeasure.reset_column_information() end end + + def self.add_snapshots_columns() + Snapshot.reset_column_information() + + add_period_column('period1_mode', :string, :null => true, :limit => 100) + add_period_column('period1_param', :string, :null => true, :limit => 100) + add_period_column('period1_date', :datetime, :null => true) + + add_period_column('period2_mode', :string, :null => true, :limit => 100) + add_period_column('period2_param', :string, :null => true, :limit => 100) + add_period_column('period2_date', :datetime, :null => true) + + add_period_column('period3_mode', :string, :null => true, :limit => 100) + add_period_column('period3_param', :string, :null => true, :limit => 100) + add_period_column('period3_date', :datetime, :null => true) + + add_period_column('period4_mode', :string, :null => true, :limit => 100) + add_period_column('period4_param', :string, :null => true, :limit => 100) + add_period_column('period4_date', :datetime, :null => true) + + add_period_column('period5_mode', :string, :null => true, :limit => 100) + add_period_column('period5_param', :string, :null => true, :limit => 100) + add_period_column('period5_date', :datetime, :null => true) + end + + def self.add_period_column(name, type, options={}) + unless Snapshot.column_names.include?(name) + add_column(:snapshots, name, type, options) + end + end end