class IndexDatabase < ActiveRecord::Migration
def self.up
- add_index :project_measures, :snapshot_id, :name => 'project_measure_snapshot_id'
-
add_index :rule_failures, :snapshot_id, :name => 'rule_failure_snapshot_id'
add_index :rule_failures, :rule_id, :name => 'rule_failure_rule_id'
add_index :rules_parameters, :rule_id, :name => 'rules_parameters_rule_id'
t.column :event_date, :datetime, :null => true
t.column :created_at, :datetime, :null => true
t.column :description, :string, :limit => 3072, :null => true
+ t.column :data, :string, :null => true, :limit => 4000
end
add_index :events, :resource_id, :name => 'events_resource_id'
add_index :events, :snapshot_id, :name => 'events_snapshot_id'
t.column :prop_key, :string, :limit => 512
t.column :resource_id, :integer, :null => true
t.column :text_value, :text, :null => true
+ t.column :user_id, :integer, :null => true
end
add_index :properties, :prop_key, :name => 'properties_key'
end
+++ /dev/null
-#
-# Sonar, entreprise quality control tool.
-# Copyright (C) 2008-2012 SonarSource
-# mailto:contact AT sonarsource DOT com
-#
-# Sonar is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Lesser General Public
-# License as published by the Free Software Foundation; either
-# version 3 of the License, or (at your option) any later version.
-#
-# Sonar is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with Sonar; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02
-#
-# sonar 2.0
-class SetDefaultProjectRoles < ActiveRecord::Migration
-
- def self.up
- end
-
-end
+++ /dev/null
-#
-# Sonar, entreprise quality control tool.
-# Copyright (C) 2008-2012 SonarSource
-# mailto:contact AT sonarsource DOT com
-#
-# Sonar is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Lesser General Public
-# License as published by the Free Software Foundation; either
-# version 3 of the License, or (at your option) any later version.
-#
-# Sonar is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with Sonar; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02
-#
-# sonar 2.1.2
-class RemoveNullSnapshotCreatedAt < ActiveRecord::Migration
-
- class Snapshot < ActiveRecord::Base
- end
-
- def self.up
- Snapshot.reset_column_information
- Snapshot.find(:all, :conditions => ["scope=? and created_at IS NULL and status=?", 'PRJ', 'P']).each do |s|
- s.created_at = Time.now
- s.save
- end
- end
-end
+++ /dev/null
-#
-# Sonar, entreprise quality control tool.
-# Copyright (C) 2008-2012 SonarSource
-# mailto:contact AT sonarsource DOT com
-#
-# Sonar is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Lesser General Public
-# License as published by the Free Software Foundation; either
-# version 3 of the License, or (at your option) any later version.
-#
-# Sonar is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with Sonar; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02
-#
-
-#
-# Sonar 2.2
-#
-class AddEventsData < ActiveRecord::Migration
-
- def self.up
- add_column 'events', 'data', :string, :null => true, :limit => 4000
- end
-
-end
+++ /dev/null
- #
- # Sonar, entreprise quality control tool.
- # Copyright (C) 2008-2012 SonarSource
- # mailto:contact AT sonarsource DOT com
- #
- # Sonar is free software; you can redistribute it and/or
- # modify it under the terms of the GNU Lesser General Public
- # License as published by the Free Software Foundation; either
- # version 3 of the License, or (at your option) any later version.
- #
- # Sonar is distributed in the hope that it will be useful,
- # but WITHOUT ANY WARRANTY; without even the implied warranty of
- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- # Lesser General Public License for more details.
- #
- # You should have received a copy of the GNU Lesser General Public
- # License along with Sonar; if not, write to the Free Software
- # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02
- #
-
-#
-# Sonar 2.2
-#
-class DeleteCheckstyleJeeRules < ActiveRecord::Migration
-
- class Rule < ActiveRecord::Base
- end
-
- class ActiveRule < ActiveRecord::Base
- end
-
- def self.up
- Rule.reset_column_information
- ActiveRule.reset_column_information
-
- delete_rule('com.puppycrawl.tools.checkstyle.checks.j2ee.EntityBeanCheck')
- delete_rule('com.puppycrawl.tools.checkstyle.checks.j2ee.FinalStaticCheck')
- delete_rule('com.puppycrawl.tools.checkstyle.checks.j2ee.LocalHomeInterfaceCheck')
- delete_rule('com.puppycrawl.tools.checkstyle.checks.j2ee.LocalInterfaceCheck')
- delete_rule('com.puppycrawl.tools.checkstyle.checks.j2ee.MessageBeanCheck')
- delete_rule('com.puppycrawl.tools.checkstyle.checks.j2ee.RemoteHomeInterfaceCheck')
- delete_rule('com.puppycrawl.tools.checkstyle.checks.j2ee.RemoteInterfaceCheck')
- delete_rule('com.puppycrawl.tools.checkstyle.checks.j2ee.SessionBeanCheck')
- delete_rule('com.puppycrawl.tools.checkstyle.checks.j2ee.ThisParameterCheck')
- delete_rule('com.puppycrawl.tools.checkstyle.checks.j2ee.ThisReturnCheck')
- delete_rule('com.puppycrawl.tools.checkstyle.checks.whitespace.TabCharacterCheck')
- delete_rule('com.puppycrawl.tools.checkstyle.checks.RequiredRegexpCheck')
- delete_rule('com.puppycrawl.tools.checkstyle.checks.javadoc.PackageHtmlCheck')
- end
-
- def self.down
-
- end
-
- private
- def self.delete_rule(rule_key)
- rule=Rule.find(:first, :conditions => {:plugin_name => 'checkstyle', :plugin_rule_key => rule_key})
- if rule
- say_with_time "Deleting Checkstyle rule #{rule_key}..." do
- rule_id=rule.id
- ActiveRule.destroy_all(["rule_id=?", rule_id])
- rule.destroy
- end
- end
- end
-end
\ No newline at end of file
+++ /dev/null
-#
-# Sonar, entreprise quality control tool.
-# Copyright (C) 2008-2012 SonarSource
-# mailto:contact AT sonarsource DOT com
-#
-# Sonar is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Lesser General Public
-# License as published by the Free Software Foundation; either
-# version 3 of the License, or (at your option) any later version.
-#
-# Sonar is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with Sonar; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02
-#
-
-#
-# Sonar 2.2
-#
-class RenameCloverProperties < ActiveRecord::Migration
-
- class Property < ActiveRecord::Base
- end
-
- def self.up
- Property.reset_column_information
- property=Property.find_by_prop_key('sonar.clover.licenseV2.secured')
- if property
- Property.create(:prop_key => 'sonar.clover.license.secured', :text_value => property.text_value)
- property.delete
- end
- end
-
-end
+++ /dev/null
-#
-# Sonar, entreprise quality control tool.
-# Copyright (C) 2008-2012 SonarSource
-# mailto:contact AT sonarsource DOT com
-#
-# Sonar is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Lesser General Public
-# License as published by the Free Software Foundation; either
-# version 3 of the License, or (at your option) any later version.
-#
-# Sonar is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with Sonar; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02
-#
-
-#
-# Sonar 2.2
-#
-class AddUserProperties < ActiveRecord::Migration
-
- def self.up
- add_column 'properties', 'user_id', :integer, :null => true
- end
-end
#
class CreateFilters < ActiveRecord::Migration
- class Property < ActiveRecord::Base
- end
-
- class ActiveFilter < ActiveRecord::Base
- belongs_to :filter
- end
-
def self.up
create_table 'filters' do |t|
t.column 'name', :string, :limit => 100
t.column 'order_index', :integer, :null => true
end
- add_default_filters()
- end
-
- private
-
- def self.add_default_filters
- ActiveFilter.reset_column_information
- Filter.reset_column_information
-
- projects_filter=create_projects_filter()
- ActiveFilter.create(:filter => projects_filter, :user_id => nil, :order_index => 1)
-
- treemap_filter=create_treemap_filter()
- if treemap_filter
- ActiveFilter.create(:filter => treemap_filter, :user_id => nil, :order_index => 2)
- end
-
- favourites_filter=create_favourites_filter
- ActiveFilter.create(:filter => favourites_filter, :user_id => nil, :order_index => (treemap_filter ? 3 : 2))
end
- def self.create_projects_filter
- projects_filter=::Filter.new(:name => 'Projects', :kee => 'Projects', :shared => true, :favourites => false, :default_view => ::Filter::VIEW_LIST)
- projects_filter.criteria<<Criterion.new_for_qualifiers([Project::QUALIFIER_PROJECT])
- projects_filter.columns.build(:family => 'metric', :kee => 'alert_status', :order_index => 1)
- projects_filter.columns.build(:family => 'name', :order_index => 2, :sort_direction => 'ASC')
-
- prop=property_value('sonar.core.projectsdashboard.columns')
- if prop
- index=3
- prop.split(";").each do |col|
- fields=col.split('.')
- if fields[0]=='METRIC'
- projects_filter.columns.build(:family => 'metric', :kee => fields[1], :order_index => index)
- index+=1
- elsif fields[0]=='BUILD_TIME'
- projects_filter.columns.build(:family => 'date', :order_index => index)
- index+=1
- elsif fields[0]=='LINKS'
- projects_filter.columns.build(:family => 'links', :order_index => index)
- index+=1
- elsif fields[0]=='LANGUAGE'
- projects_filter.columns.build(:family => 'language', :order_index => index)
- index+=1
- elsif fields[0]=='VERSION'
- projects_filter.columns.build(:family => 'version', :order_index => index)
- index+=1
- end
- end
- else
- projects_filter.columns.build(:family => 'version', :order_index => 3)
- projects_filter.columns.build(:family => 'metric', :kee => 'ncloc', :order_index => 4)
- projects_filter.columns.build(:family => 'metric', :kee => 'violations_density', :order_index => 5)
- projects_filter.columns.build(:family => 'date', :order_index => 6)
- projects_filter.columns.build(:family => 'links', :order_index => 7)
- end
- projects_filter.save
- projects_filter
- end
-
- def self.create_treemap_filter
- show_treemap=property_value('sonar.core.projectsdashboard.showTreemap', 'true')
- if show_treemap=='true'
- size_metric=property_value('sonar.core.treemap.sizemetric', 'ncloc')
- color_metric=property_value('sonar.core.treemap.colormetric', 'violations_density')
-
- treemap_filter=::Filter.new(:name => 'Treemap', :kee => 'Treemap', :shared => true, :favourites => false, :default_view => ::Filter::VIEW_TREEMAP)
- treemap_filter.criteria<<Criterion.new_for_qualifiers([Project::QUALIFIER_PROJECT])
- treemap_filter.columns.build(:family => 'name', :order_index => 1)
- treemap_filter.columns.build(:family => 'metric', :kee => size_metric, :order_index => 2)
- treemap_filter.columns.build(:family => 'metric', :kee => color_metric, :order_index => 3)
- treemap_filter.save
- treemap_filter
- else
- nil
- end
- end
-
- def self.create_favourites_filter
- favourites_filter=::Filter.new(:name => 'My favourites', :kee => 'My favourites', :shared => true, :favourites => true, :default_view => ::Filter::VIEW_LIST)
- favourites_filter.criteria<<Criterion.new_for_qualifiers(Project::QUALIFIERS)
- favourites_filter.columns.build(:family => 'metric', :kee => 'alert_status', :order_index => 1)
- favourites_filter.columns.build(:family => 'name', :order_index => 2, :sort_direction => 'ASC')
- favourites_filter.columns.build(:family => 'metric', :kee => 'ncloc', :order_index => 3)
- favourites_filter.columns.build(:family => 'metric', :kee => 'violations_density', :order_index => 4)
- favourites_filter.columns.build(:family => 'date', :order_index => 5)
- favourites_filter.save
- favourites_filter
- end
-
- def self.property_value(key, default_value=nil)
- prop = Property.find(:first, :conditions => {'prop_key' => key, 'resource_id' => nil, 'user_id' => nil})
- if prop
- prop.text_value || default_value
- else
- default_value
- end
- end
-end
+end
\ No newline at end of file
+++ /dev/null
-#
-# Sonar, entreprise quality control tool.
-# Copyright (C) 2008-2012 SonarSource
-# mailto:contact AT sonarsource DOT com
-#
-# Sonar is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Lesser General Public
-# License as published by the Free Software Foundation; either
-# version 3 of the License, or (at your option) any later version.
-#
-# Sonar is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with Sonar; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02
-#
-
-#
-# Sonar 2.2
-#
-class SetResourceLongNames < ActiveRecord::Migration
-
- class Project < ActiveRecord::Base
- end
-
- def self.up
- Project.reset_column_information
- update('TRK')
- update('BRC')
- update('PAC')
- update('DIR')
- update('LIB')
- update('CLA')
- update('FIL')
- update('UTS')
- update('VW')
- update('SVW')
- end
-
- private
-
- def self.update(qualifier)
- Project.connection.update("update projects set long_name=name where long_name is null and qualifier='#{qualifier}'")
- end
-end
+++ /dev/null
-#
-# Sonar, entreprise quality control tool.
-# Copyright (C) 2008-2012 SonarSource
-# mailto:contact AT sonarsource DOT com
-#
-# Sonar is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Lesser General Public
-# License as published by the Free Software Foundation; either
-# version 3 of the License, or (at your option) any later version.
-#
-# Sonar is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with Sonar; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02
-#
-
-#
-# Sonar 2.2
-#
-class RemoveMeasureSidIndex < ActiveRecord::Migration
-
- def self.up
- remove_index :project_measures, :name => 'project_measure_snapshot_id'
- end
-
-end