1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
|
#
# 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
#
class InitialSchema < ActiveRecord::Migration
def self.up
create_table :projects do |t|
t.column :name, :string, :null => true, :limit => 256
t.column :description, :string, :null => true, :limit => 2000
t.column :enabled, :boolean, :null => false, :default => true
t.column 'scope', :string, :limit => 3
t.column 'qualifier', :string, :limit => 3
t.column 'kee', :string, :limit => 400
t.column 'root_id', :integer
t.column :profile_id, :integer, :null => true
t.column :language, :string, :null => true, :limit => 5
t.column :copy_resource_id, :integer, :null => true
t.column :long_name, :string, :null => true, :limit => 256
end
create_table :snapshots do |t|
t.column :created_at, :datetime, :null => true, :default => nil
t.column :project_id, :integer, :null => false
t.column :parent_snapshot_id, :integer, :null => true
t.column :status, :string, :null => false, :default => 'U', :limit => 4
t.column :islast, :boolean, :null => false, :default => false
t.column 'scope', :string, :limit => 3
t.column 'qualifier', :string, :limit => 3
t.column 'root_snapshot_id', :integer
t.column 'version', :string, :limit => 60, :null => true
t.column :path, :string, :null => true, :limit => 96
t.column :depth, :integer, :null => true
t.column :root_project_id, :integer, :nullable => true
end
create_table :metrics do |t|
t.column :name, :string, :null => false, :limit => 64
t.column :description, :string, :null => true, :limit => 255
t.column :direction, :integer, :null => false, :default => 0
t.column :domain, :string, :null => true, :limit => 64
t.column :short_name, :string, :null => true, :limit => 64
t.column :qualitative, :boolean, :null => false, :default => false
t.column :val_type, :string, :null => true, :limit => 8
t.column :user_managed, :boolean, :null => true, :default => false
t.column :enabled, :boolean, :null => true, :default => true
t.column :origin, :string, :null => true, :limit => 3
t.column 'worst_value', :decimal, :null => true, :precision => 30, :scale => 20
t.column 'best_value', :decimal, :null => true, :precision => 30, :scale => 20
t.column 'optimized_best_value', :boolean, :null => true
t.column 'hidden', :boolean, :null => true
end
create_table :project_measures do |t|
t.column :value, :decimal, :null => true, :precision => 30, :scale => 20
t.column :metric_id, :integer, :null => false
t.column :snapshot_id, :integer, :null => true
t.column :rule_id, :integer
t.column :rules_category_id, :integer
t.column :text_value, :string, :limit => 96, :null => true
t.column :tendency, :integer, :null => true
t.column :measure_date, :datetime, :null => true
t.column :project_id, :integer, :null => true
t.column :alert_status, :string, :limit => 5, :null => true
t.column :alert_text, :string, :null => true, :limit => 4000
t.column :url, :string, :null => true, :limit => 2000
t.column :description, :string, :null => true, :limit => 4000
t.column :rule_priority, :integer, :null => true
t.column :diff_value_1, :decimal, :null => true, :precision => 30, :scale => 20
t.column :diff_value_2, :decimal, :null => true, :precision => 30, :scale => 20
t.column :diff_value_3, :decimal, :null => true, :precision => 30, :scale => 20
end
create_table :rules_categories do |t|
t.column :name, :string, :null => false, :limit => 255
t.column :description, :string, :null => false, :limit => 1000
end
create_table :rules do |t|
t.column :name, :string, :null => false, :limit => 192
t.column :rules_category_id, :integer, :null => false
t.column :plugin_rule_key, :string, :null => false, :limit => 200
t.column :plugin_config_key, :string, :null => false, :limit => 200
t.column :plugin_name, :string, :null => false, :limit => 255
t.column :description, :text, :null => true
t.column :priority, :integer, :null => true
end
create_table :rule_failures do |t|
t.column :snapshot_id, :integer, :null => false
t.column :rule_id, :integer, :null => false
t.column :failure_level, :integer, :null => false
t.column :message, :string, :limit => 500
t.column :line, :integer, :null => true
end
create_table :rules_parameters do |t|
t.column :rule_id, :integer, :null => false
t.column :name, :string, :null => false, :limit => 128
t.column :description, :string, :null => false, :limit => 4000
t.column :param_type, :string, :null => false, :limit => 512
end
create_table :project_links do |t|
t.column :project_id, :integer, :null => false
t.column :link_type, :string, :null => true, :limit => 20
t.column :name, :string, :null => true, :limit => 128
t.column :href, :string, :null => false, :limit => 2048
end
end
end
|