+++ /dev/null
-<dataset>
-
- <metrics id="1"
- name="ncloc"
- short_name="ncloc"
- VAL_TYPE="INT"
- enabled="true"/>
- <metrics id="2"
- name="coverage"
- short_name="coverage"
- VAL_TYPE="PERCENT"
- enabled="true"/>
- <metrics id="3"
- name="file_complexity"
- short_name="file_complexity"
- VAL_TYPE="FLOAT"
- enabled="true"/>
- <metrics id="4"
- name="test_execution_time"
- short_name="test_execution_time"
- VAL_TYPE="MILLISEC"
- enabled="true"/>
-
- <rules id="30"
- name="Check Header"
- plugin_rule_key="com.puppycrawl.tools.checkstyle.checks.header.HeaderCheck"
- plugin_config_key="Checker/Treewalker/HeaderCheck"
- plugin_name="checkstyle"/>
-
- <rules id="31"
- name="Equals Avoid Null"
- plugin_rule_key="com.puppycrawl.tools.checkstyle.checks.coding.EqualsAvoidNullCheck"
- plugin_config_key="Checker/TreeWalker/EqualsAvoidNull"
- plugin_name="checkstyle"/>
-
- <!-- project -->
- <projects uuid="ABCD"
- uuid_path="NOT_USED"
- project_uuid="ABCD"
- module_uuid="[null]"
- module_uuid_path=".ABCD."
- enabled="true"
- id="1"
- scope="PRJ"
- qualifier="TRK"
- kee="PROJECT_KEY"
- name="project"
- root_id="[null]"/>
-
- <!-- directory -->
- <projects uuid="BCDE"
- uuid_path="NOT_USED"
- project_uuid="ABCD"
- module_uuid="ABCD"
- module_uuid_path=".ABCD."
- enabled="true"
- id="2"
- scope="DIR"
- qualifier="PAC"
- kee="DIRECTORY_KEY"
- name="org.foo"
- root_id="1"/>
-
- <!-- snapshots -->
- <snapshots id="1000"
- uuid="u1000"
- project_id="1"
- root_project_id="1"
-
- scope="PRJ"
- qualifier="TRK"
- created_at="1225544280000"
- build_date="1225544280000"
- status="P"
- islast="false"/>
- <snapshots id="1001"
- uuid="u1001"
- project_id="2"
- root_project_id="1"
- root_snapshot_id="1000"
- scope="DIR"
- qualifier="PAC"
- created_at="1225544280000"
- build_date="1225544280000"
- status="P"
- islast="false"/>
-
-
- <!-- project measures -->
- <project_measures id="1"
- VALUE="60"
- METRIC_ID="1"
- SNAPSHOT_ID="1000"
- analysis_uuid="u1000"
- text_value="[null]"
- project_id="[null]"
- person_id="[null]"/>
-
- <project_measures id="2"
- VALUE="80"
- METRIC_ID="2"
- SNAPSHOT_ID="1000"
- analysis_uuid="u1000"
- text_value="[null]"
- project_id="[null]"
- person_id="[null]"/>
-
- <!-- package measures -->
- <project_measures id="3"
- VALUE="20"
- METRIC_ID="1"
- SNAPSHOT_ID="1001"
- analysis_uuid="u1000"
- text_value="[null]"
- project_id="[null]"
- person_id="[null]"/>
-
- <project_measures id="4"
- VALUE="70"
- METRIC_ID="2"
- SNAPSHOT_ID="1001"
- analysis_uuid="u1000"
- text_value="[null]"
- project_id="[null]"
- person_id="[null]"/>
-
-</dataset>
<dataset>
<project_measures id="1"
- snapshot_id="1000"
analysis_uuid="u1000"
metric_id="10"
value="[null]"
variation_value_5="[null]"/>
<project_measures id="2"
- snapshot_id="1000"
analysis_uuid="u1000"
metric_id="10"
value="[null]"
<dataset>
- <project_measures snapshot_id="1000"
- analysis_uuid="u1000"
+ <project_measures analysis_uuid="u1000"
metric_id="10"
value="6.0"
project_id="[null]"
<dataset>
- <project_measures snapshot_id="1000"
- analysis_uuid="u1000"
+ <project_measures analysis_uuid="u1000"
metric_id="10"
value="3.0"
project_id="[null]"
+++ /dev/null
-<dataset>
- <!-- java project -->
- <projects long_name="java project" id="1" scope="PRJ" kee="project:java" qualifier="TRK" name="java project"
- root_id="[null]"
- description="[null]" enabled="true" language="java" copy_resource_id="[null]" person_id="[null]"/>
-
- <!-- views -->
- <projects long_name="Root view" id="2" scope="PRJ" kee="ROOT_VIEW" qualifier="VW" name="Root view"
- root_id="[null]"
- description="[null]" enabled="true" language="[null]" copy_resource_id="[null]" person_id="[null]"/>
-
- <projects long_name="Sub view" id="3" scope="PRJ" kee="SUB_VIEW" qualifier="SVW" name="Sub view"
- root_id="2"
- description="[null]" enabled="true" language="[null]" copy_resource_id="[null]" person_id="[null]"/>
-
- <!-- java project copy used in view -->
- <projects long_name="java project" id="4" scope="FIL" kee="cp-project:java" qualifier="TRK" name="java project"
- root_id="2"
- description="[null]" enabled="true" language="java" copy_resource_id="1"/>
-
-
- <!-- snapshots -->
- <snapshots purge_status="[null]" period1_mode="[null]" period1_param="[null]" period1_date="[null]" period2_mode="[null]" period2_param="[null]" period2_date="[null]" period3_mode="[null]" period3_param="[null]" period3_date="[null]" period4_mode="[null]" period4_param="[null]" period4_date="[null]" period5_mode="[null]" period5_param="[null]" period5_date="[null]"
- id="1"
- uuid="u1"
- created_at="1230163200000" build_date="1230163200000" version="1.0" project_id="1" scope="PRJ" qualifier="TRK"
- root_project_id="1" STATUS="P" ISLAST="true"
- path=""
- depth="0"/>
-
- <snapshots purge_status="[null]" period1_mode="[null]" period1_param="[null]" period1_date="[null]" period2_mode="[null]" period2_param="[null]" period2_date="[null]" period3_mode="[null]" period3_param="[null]" period3_date="[null]" period4_mode="[null]" period4_param="[null]" period4_date="[null]" period5_mode="[null]" period5_param="[null]" period5_date="[null]"
- id="2"
- uuid="u2"
- created_at="1230163201000" build_date="1230163201000" version="1.0" project_id="3" scope="PRJ" qualifier="VW"
- root_project_id="2" STATUS="P" ISLAST="true"
- path=""
- depth="0"/>
-
- <snapshots purge_status="[null]" period1_mode="[null]" period1_param="[null]" period1_date="[null]" period2_mode="[null]" period2_param="[null]" period2_date="[null]" period3_mode="[null]" period3_param="[null]" period3_date="[null]" period4_mode="[null]" period4_param="[null]" period4_date="[null]" period5_mode="[null]" period5_param="[null]" period5_date="[null]"
- id="3"
- uuid="u3"
- created_at="1230163201000" build_date="1230163201000" version="1.0" project_id="3" scope="PRJ" qualifier="SVW"
- root_project_id="2" root_snapshot_id="2" STATUS="P" ISLAST="true"
- path="2."
- depth="1"/>
-
- <snapshots purge_status="[null]" period1_mode="[null]" period1_param="[null]" period1_date="[null]" period2_mode="[null]" period2_param="[null]" period2_date="[null]" period3_mode="[null]" period3_param="[null]" period3_date="[null]" period4_mode="[null]" period4_param="[null]" period4_date="[null]" period5_mode="[null]" period5_param="[null]" period5_date="[null]"
- id="4"
- uuid="u4"
- created_at="1230163200000" build_date="1230163200000" version="1.0" project_id="4" scope="FIL" qualifier="TRK"
- root_project_id="2" root_snapshot_id="2" STATUS="P" ISLAST="true"
- path="2.3."
- depth="2"/>
-
-
-</dataset>
<project_measures id="1001"
metric_id="1"
value="500"
- snapshot_id="101"
analysis_uuid="u101"
person_id="[null]"
variation_value_1="[null]"
<project_measures id="1002"
metric_id="1"
value="300"
- snapshot_id="101"
analysis_uuid="u101"
person_id="30000"
variation_value_1="[null]"
<project_measures id="1003"
metric_id="1"
value="200"
- snapshot_id="101"
analysis_uuid="u101"
person_id="40000"
variation_value_1="[null]"
<project_measures id="1001"
metric_id="1"
value="500"
- snapshot_id="101"
analysis_uuid="u101"
variation_value_1="[null]"
variation_value_2="[null]"
person_id="[null]"/>
<!-- details of the measure by model characteristic -->
- <!--project_measures id="1002" metric_id="1" value="300" snapshot_id="101" characteristic_id="30000"
+ <!--project_measures id="1002" metric_id="1" value="300" characteristic_id="30000"
url="[null]" variation_value_1="[null]" variation_value_2="[null]" variation_value_3="[null]"
variation_value_4="[null]" variation_value_5="400"
rule_priority="[null]" alert_text="[null]" RULES_CATEGORY_ID="[null]"
component_uuid="ABCD"
alert_status="[null]" description="[null]" person_id="[null]"/>-->
- <!--project_measures id="1003" metric_id="1" value="200" snapshot_id="101" characteristic_id="40000"
+ <!--project_measures id="1003" metric_id="1" value="200" characteristic_id="40000"
url="[null]" variation_value_1="[null]" variation_value_2="[null]" variation_value_3="[null]"
variation_value_4="[null]" variation_value_5="400"
alert_text="[null]" RULES_CATEGORY_ID="[null]"
<project_measures id="1001"
metric_id="1"
value="510"
- snapshot_id="101"
analysis_uuid="u101"
variation_value_1="[null]"
variation_value_2="[null]"
<project_measures id="1002"
metric_id="1"
value="510"
- snapshot_id="102"
analysis_uuid="u101"
variation_value_1="[null]"
variation_value_2="[null]"
<project_measures id="1003"
metric_id="1"
value="500"
- snapshot_id="103"
analysis_uuid="u101"
variation_value_1="[null]"
variation_value_2="[null]"
<project_measures id="1004"
metric_id="1"
value="10"
- snapshot_id="104"
analysis_uuid="u101"
variation_value_1="[null]"
variation_value_2="[null]"
<project_measures id="1005"
metric_id="2"
value="[null]"
- snapshot_id="101"
analysis_uuid="u101"
variation_value_1="[null]"
variation_value_2="[null]"
<project_measures id="1006"
metric_id="3"
value="12.3"
- snapshot_id="101"
analysis_uuid="u101"
variation_value_1="[null]"
variation_value_2="[null]"
<project_measures id="1010"
metric_id="1"
value="5000"
- snapshot_id="110"
analysis_uuid="u110"
variation_value_1="[null]"
variation_value_2="[null]"
<project_measures id="1011"
metric_id="2"
value="[null]"
- snapshot_id="110"
analysis_uuid="u110"
variation_value_1="[null]"
variation_value_2="[null]"
<project_measures id="1001"
metric_id="5"
value="510"
- snapshot_id="101"
analysis_uuid="u101"
variation_value_1="[null]"
variation_value_2="[null]"
<project_measures id="1010"
metric_id="5"
value="5000"
- snapshot_id="110"
analysis_uuid="u110"
variation_value_1="[null]"
variation_value_2="[null]"
<project_measures id="1020"
metric_id="5"
value="5000"
- snapshot_id="120"
analysis_uuid="u120"
variation_value_1="[null]"
variation_value_2="[null]"
--- /dev/null
+#
+# SonarQube, open source software quality management tool.
+# Copyright (C) 2008-2014 SonarSource
+# mailto:contact AT sonarsource DOT com
+#
+# SonarQube 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.
+#
+# SonarQube 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 this program; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+
+#
+# SonarQube 6.0
+#
+class DropIndicesOnTreeColumnsOfSnapshots < ActiveRecord::Migration
+
+ def self.up
+ remove_index_quietly 'snapshots_qualifier'
+ remove_index_quietly 'snapshots_root'
+ remove_index_quietly 'snapshots_parent'
+ remove_index_quietly 'snapshot_root_component'
+ end
+
+ private
+ def self.remove_index_quietly(index_name)
+ begin
+ remove_index :snapshots, :name => index_name
+ rescue
+ #ignore
+ end
+ end
+end
+++ /dev/null
-#
-# SonarQube, open source software quality management tool.
-# Copyright (C) 2008-2014 SonarSource
-# mailto:contact AT sonarsource DOT com
-#
-# SonarQube 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.
-#
-# SonarQube 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 this program; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-#
-
-#
-# SonarQube 6.0
-#
-class DropTreeColumnsFromSnapshots < ActiveRecord::Migration
-
- def self.up
- remove_index_quietly 'snapshots_qualifier'
- remove_index_quietly 'snapshots_root'
- remove_index_quietly 'snapshots_parent'
- remove_index_quietly 'snapshot_root_component'
- execute_java_migration('org.sonar.db.version.v60.DropTreeColumnsFromSnapshots')
- end
-
- private
- def self.remove_index_quietly(index_name)
- begin
- remove_index :snapshots, :name => index_name
- rescue
- #ignore
- end
- end
-end
--- /dev/null
+#
+# SonarQube, open source software quality management tool.
+# Copyright (C) 2008-2014 SonarSource
+# mailto:contact AT sonarsource DOT com
+#
+# SonarQube 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.
+#
+# SonarQube 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 this program; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+
+#
+# SonarQube 6.0
+#
+class DropTreeColumnsFromSnapshots < ActiveRecord::Migration
+
+ def self.up
+ execute_java_migration('org.sonar.db.version.v60.DropTreeColumnsFromSnapshots')
+ end
+
+end
--- /dev/null
+#
+# SonarQube, open source software quality management tool.
+# Copyright (C) 2008-2014 SonarSource
+# mailto:contact AT sonarsource DOT com
+#
+# SonarQube 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.
+#
+# SonarQube 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 this program; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+
+#
+# SonarQube 6.0
+#
+class DropIndexOnSnapshotIdOfMeasures < ActiveRecord::Migration
+
+ def self.up
+ begin
+ remove_index :project_measures, :name => 'measures_sid_metric'
+ rescue
+ #ignore
+ end
+ end
+
+end
--- /dev/null
+#
+# SonarQube, open source software quality management tool.
+# Copyright (C) 2008-2014 SonarSource
+# mailto:contact AT sonarsource DOT com
+#
+# SonarQube 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.
+#
+# SonarQube 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 this program; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+
+#
+# SonarQube 6.0
+#
+class DropSnapshotIdColumnFromMeasures < ActiveRecord::Migration
+
+ def self.up
+ execute_java_migration('org.sonar.db.version.v60.DropSnapshotIdColumnFromMeasures')
+ end
+
+end
--- /dev/null
+#
+# SonarQube, open source software quality management tool.
+# Copyright (C) 2008-2014 SonarSource
+# mailto:contact AT sonarsource DOT com
+#
+# SonarQube 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.
+#
+# SonarQube 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 this program; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+
+#
+# SonarQube 6.0
+#
+class AddIndexOnAnalysisUuidOfMeasures < ActiveRecord::Migration
+
+ def self.up
+ add_index :project_measures, [:analysis_uuid, :metric_id], :name => 'measures_analysis_metric'
+ end
+end
public class DatabaseVersion {
- public static final int LAST_VERSION = 1_270;
+ public static final int LAST_VERSION = 1_274;
/**
* The minimum supported version which can be upgraded. Lower
import org.sonar.db.version.v60.DropRememberMeColumnsFromUsers;
import org.sonar.db.version.v60.DropSnapshotIdColumnFromCeActivity;
import org.sonar.db.version.v60.DropSnapshotIdColumnFromEvents;
+import org.sonar.db.version.v60.DropSnapshotIdColumnFromMeasures;
import org.sonar.db.version.v60.DropSnapshotIdColumnsFromDuplicationsIndex;
import org.sonar.db.version.v60.DropTreeColumnsFromSnapshots;
import org.sonar.db.version.v60.DropTreesOfSnapshots;
MakeAnalysisUuidNotNullOnMeasures.class,
DropTreesOfSnapshots.class,
- DropTreeColumnsFromSnapshots.class
+ DropTreeColumnsFromSnapshots.class,
+ DropSnapshotIdColumnFromMeasures.class
);
}
}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2016 SonarSource SA
+ * mailto:contact AT sonarsource DOT com
+ *
+ * This program 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.
+ *
+ * This program 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 this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+package org.sonar.db.version.v60;
+
+import java.sql.SQLException;
+import org.sonar.db.Database;
+import org.sonar.db.version.DdlChange;
+import org.sonar.db.version.DropColumnsBuilder;
+
+public class DropSnapshotIdColumnFromMeasures extends DdlChange {
+
+ private static final String TABLE = "project_measures";
+
+ public DropSnapshotIdColumnFromMeasures(Database db) {
+ super(db);
+ }
+
+ @Override
+ public void execute(Context context) throws SQLException {
+ context.execute(new DropColumnsBuilder(getDatabase().getDialect(), TABLE, "snapshot_id").build());
+ }
+
+}
INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('1268');
INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('1269');
INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('1270');
+INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('1271');
+INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('1272');
+INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('1273');
+INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('1274');
INSERT INTO USERS(ID, LOGIN, NAME, EMAIL, EXTERNAL_IDENTITY, EXTERNAL_IDENTITY_PROVIDER, USER_LOCAL, CRYPTED_PASSWORD, SALT, CREATED_AT, UPDATED_AT) VALUES (1, 'admin', 'Administrator', '', 'admin', 'sonarqube', true, 'a373a0e667abb2604c1fd571eb4ad47fe8cc0878', '48bc4b0d93179b5103fd3885ea9119498e9d161b', '1418215735482', '1418215735482');
ALTER TABLE USERS ALTER COLUMN ID RESTART WITH 2;
"METRIC_ID" INTEGER NOT NULL,
"COMPONENT_UUID" VARCHAR(50) NOT NULL,
"ANALYSIS_UUID" VARCHAR(50) NOT NULL,
- "SNAPSHOT_ID" INTEGER,
"TEXT_VALUE" VARCHAR(4000),
"ALERT_STATUS" VARCHAR(5),
"ALERT_TEXT" VARCHAR(4000),
CREATE UNIQUE INDEX "GROUPS_USERS_UNIQUE" ON "GROUPS_USERS" ("GROUP_ID", "USER_ID");
-CREATE INDEX "MEASURES_SID_METRIC" ON "PROJECT_MEASURES" ("SNAPSHOT_ID", "METRIC_ID");
+CREATE INDEX "MEASURES_ANALYSIS_METRIC" ON "PROJECT_MEASURES" ("ANALYSIS_UUID", "METRIC_ID");
CREATE INDEX "MEASURES_PERSON" ON "PROJECT_MEASURES" ("PERSON_ID");
public void verify_count_of_added_MigrationStep_types() {
ComponentContainer container = new ComponentContainer();
new MigrationStepModule().configure(container);
- assertThat(container.size()).isEqualTo(126);
+ assertThat(container.size()).isEqualTo(127);
}
}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2016 SonarSource SA
+ * mailto:contact AT sonarsource DOT com
+ *
+ * This program 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.
+ *
+ * This program 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 this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+package org.sonar.db.version.v60;
+
+import java.sql.SQLException;
+import org.junit.Test;
+import org.sonar.db.Database;
+import org.sonar.db.dialect.PostgreSql;
+import org.sonar.db.version.DdlChange;
+
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
+public class DropSnapshotIdColumnFromMeasuresTest {
+
+ private Database database = mock(Database.class);
+ private DropSnapshotIdColumnFromMeasures underTest = new DropSnapshotIdColumnFromMeasures(database);
+
+ @Test
+ public void verify_generated_sql_on_postgresql() throws SQLException {
+ when(database.getDialect()).thenReturn(new PostgreSql());
+
+ DdlChange.Context context = mock(DdlChange.Context.class);
+ underTest.execute(context);
+
+ verify(context).execute("ALTER TABLE project_measures DROP COLUMN snapshot_id");
+ }
+
+}
+++ /dev/null
-<dataset>
-
- <!-- Struts projects is authorized for all user -->
- <group_roles id="1"
- group_id="[null]"
- resource_id="1"
- role="user"/>
-
-
- <!-- root project -->
- <projects id="1"
- root_id="[null]"
- scope="PRJ"
- qualifier="TRK"
- kee="org.struts:struts"
- name="Struts"
- uuid="ABCD"
- project_uuid="ABCD"
- module_uuid="[null]"
- module_uuid_path="."
- description="the description"
- long_name="Apache Struts"
- enabled="[true]"
- language="java"
- copy_resource_id="[null]"
- person_id="[null]"
- path="[null]"
- authorization_updated_at="[null]"/>
- <snapshots id="1"
- uuid="u1"
- project_id="1"
-
- root_project_id="1"
-
- status="P"
- islast="[true]"
- purge_status="[null]"
- period1_mode="previous_analysis"
- period1_param="[null]"
- period1_date="[null]"
- period2_mode="days"
- period2_param="30"
- period2_date="1316815200000"
- period3_mode="days"
- period3_param="90"
- period3_date="1311631200000"
- period4_mode="previous_analysis"
- period4_param="[null]"
- period4_date="[null]"
- period5_mode="previous_version"
- period5_param="[null]"
- period5_date="[null]"
- depth="[null]"
- scope="PRJ"
- qualifier="TRK"
- created_at="1228222680000"
- build_date="1228222680000"
- version="[null]"
- path=""/>
- <snapshots id="10"
- uuid="u10"
- project_id="1"
-
- root_project_id="1"
-
- status="P"
- islast="[false]"
- purge_status="[null]"
- period1_mode="[null]"
- period1_param="[null]"
- period1_date="[null]"
- period2_mode="[null]"
- period2_param="[null]"
- period2_date="[null]"
- period3_mode="[null]"
- period3_param="[null]"
- period3_date="[null]"
- period4_mode="[null]"
- period4_param="[null]"
- period4_date="[null]"
- period5_mode="[null]"
- period5_param="[null]"
- period5_date="[null]"
- depth="[null]"
- scope="PRJ"
- qualifier="TRK"
- created_at="1228136280000"
- build_date="1228136280000"
- version="[null]"
- path=""/>
-
- <!-- module -->
- <projects id="2"
- root_id="1"
- kee="org.struts:struts-core"
- name="Struts Core"
- uuid="EFGH"
- project_uuid="ABCD"
- module_uuid="[null]"
- module_uuid_path=".ABCD."
- scope="PRJ"
- qualifier="BRC"
- long_name="Struts Core"
- description="[null]"
- enabled="[true]"
- language="java"
- copy_resource_id="[null]"
- person_id="[null]"
- authorization_updated_at="[null]"/>
- <snapshots id="2"
- uuid="u2"
- project_id="2"
-
- root_project_id="1"
- root_snapshot_id="1"
- status="P"
- islast="[true]"
- purge_status="[null]"
- period1_mode="[null]"
- period1_param="[null]"
- period1_date="[null]"
- period2_mode="[null]"
- period2_param="[null]"
- period2_date="[null]"
- period3_mode="[null]"
- period3_param="[null]"
- period3_date="[null]"
- period4_mode="[null]"
- period4_param="[null]"
- period4_date="[null]"
- period5_mode="[null]"
- period5_param="[null]"
- period5_date="[null]"
- depth="[null]"
- scope="PRJ"
- qualifier="BRC"
- created_at="1228222680000"
- build_date="1228222680000"
- version="[null]"
- path="1."/>
-
- <!-- directory -->
- <projects long_name="org.struts"
- id="3"
- scope="DIR"
- qualifier="DIR"
- kee="org.struts:struts-core:src/org/struts"
- uuid="GHIJ"
- project_uuid="ABCD"
- module_uuid="EFGH"
- module_uuid_path=".ABCD.EFGH."
- name="src/org/struts"
- root_id="2"
- description="[null]"
- enabled="[true]"
- language="java"
- copy_resource_id="[null]"
- person_id="[null]"
- path="src/org/struts"
- authorization_updated_at="[null]"/>
- <snapshots id="3"
- uuid="u3"
- project_id="3"
-
- root_project_id="1"
- root_snapshot_id="1"
- status="P"
- islast="[true]"
- purge_status="[null]"
- period1_mode="[null]"
- period1_param="[null]"
- period1_date="[null]"
- period2_mode="[null]"
- period2_param="[null]"
- period2_date="[null]"
- period3_mode="[null]"
- period3_param="[null]"
- period3_date="[null]"
- period4_mode="[null]"
- period4_param="[null]"
- period4_date="[null]"
- period5_mode="[null]"
- period5_param="[null]"
- period5_date="[null]"
- depth="[null]"
- scope="DIR"
- qualifier="PAC"
- created_at="1228222680000"
- build_date="1228222680000"
- version="[null]"
- path="1.2."/>
-
- <!-- file -->
- <projects long_name="org.struts.RequestContext"
- id="4"
- scope="FIL"
- qualifier="FIL"
- kee="org.struts:struts-core:src/org/struts/RequestContext.java"
- uuid="KLMN"
- project_uuid="ABCD"
- module_uuid="EFGH"
- module_uuid_path=".ABCD.EFGH."
- name="RequestContext.java"
- root_id="2"
- description="[null]"
- enabled="[true]"
- language="java"
- copy_resource_id="[null]"
- person_id="[null]"
- path="src/org/struts/RequestContext.java"
- authorization_updated_at="[null]"/>
-
- <snapshots id="4"
- uuid="u4"
- project_id="4"
-
- root_project_id="1"
- root_snapshot_id="1"
- status="P"
- islast="[true]"
- purge_status="[null]"
- period1_mode="[null]"
- period1_param="[null]"
- period1_date="[null]"
- period2_mode="[null]"
- period2_param="[null]"
- period2_date="[null]"
- period3_mode="[null]"
- period3_param="[null]"
- period3_date="[null]"
- period4_mode="[null]"
- period4_param="[null]"
- period4_date="[null]"
- period5_mode="[null]"
- period5_param="[null]"
- period5_date="[null]"
- depth="[null]"
- scope="FIL"
- qualifier="CLA"
- created_at="1228222680000"
- build_date="1228222680000"
- version="[null]"
- path="1.2.3."/>
-
-
-</dataset>
<dataset>
<project_measures
id="1"
- snapshot_id="2"
analysis_uuid="u2"
metric_id="3"
component_uuid="FILE1"
<project_measures id="1"
VALUE="60"
METRIC_ID="1"
- SNAPSHOT_ID="1000"
analysis_uuid="u1000"
person_id="[null]"
component_uuid="ABCD"/>
<project_measures id="2"
VALUE="80"
METRIC_ID="2"
- SNAPSHOT_ID="1000"
analysis_uuid="u1000"
person_id="[null]"
component_uuid="ABCD"/>
<project_measures id="3"
VALUE="20"
METRIC_ID="1"
- SNAPSHOT_ID="1001"
analysis_uuid="u1000"
person_id="[null]"
component_uuid="BCDE"/>
<project_measures id="4"
VALUE="70"
METRIC_ID="2"
- SNAPSHOT_ID="1001"
analysis_uuid="u1000"
person_id="[null]"
component_uuid="BCDE"/>
<project_measures id="5"
VALUE="5"
METRIC_ID="1"
- SNAPSHOT_ID="1002"
analysis_uuid="u1000"
person_id="[null]"
component_uuid="CDEF"/>
<project_measures id="6"
VALUE="60"
METRIC_ID="2"
- SNAPSHOT_ID="1002"
analysis_uuid="u1000"
person_id="[null]"
component_uuid="CDEF"/>
<project_measures id="1"
VALUE="60"
METRIC_ID="1"
- SNAPSHOT_ID="1000"
analysis_uuid="u1000"
person_id="[null]"
component_uuid="ABCD"/>
<project_measures id="2"
VALUE="20"
METRIC_ID="1"
- SNAPSHOT_ID="1000"
analysis_uuid="u1000"
person_id="20"
component_uuid="ABCD"/>
<project_measures id="3"
VALUE="40"
METRIC_ID="1"
- SNAPSHOT_ID="1000"
analysis_uuid="u1000"
person_id="21"
component_uuid="ABCD"/>
islast="[true]"/>
<project_measures id="20"
- snapshot_id="5"
analysis_uuid="u5"
metric_id="10"
value="[null]"
alert_text="[null]"
component_uuid="FILE1"/>
<project_measures id="21"
- snapshot_id="5"
analysis_uuid="u5"
metric_id="11"
value="[null]"
alert_text="[null]"
component_uuid="FILE1"/>
<project_measures id="22"
- snapshot_id="5"
analysis_uuid="u5"
metric_id="12"
value="10"
<project_measures id="20"
component_uuid="ABCD"
- snapshot_id="5"
analysis_uuid="u5"
metric_id="10"
value="[null]"
alert_text="[null]"/>
<project_measures id="21"
component_uuid="ABCD"
- snapshot_id="5"
analysis_uuid="u5"
metric_id="11"
value="[null]"
alert_text="[null]"/>
<project_measures id="22"
component_uuid="ABCD"
- snapshot_id="5"
analysis_uuid="u5"
metric_id="12"
value="10"
/>
<project_measures id="20"
- snapshot_id="5"
analysis_uuid="u5"
metric_id="10"
value="[null]"
person_id="[null]"
component_uuid="1"/>
<project_measures id="21"
- snapshot_id="5"
analysis_uuid="u5"
metric_id="11"
value="[null]"
person_id="[null]"
component_uuid="1"/>
<project_measures id="22"
- snapshot_id="5"
analysis_uuid="u5"
metric_id="12"
value="10"
component_uuid="1"/>
<!--measures for developer 333-->
<project_measures id="30"
- snapshot_id="5"
analysis_uuid="u5"
metric_id="10"
value="[null]"
person_id="333"
component_uuid="1"/>
<project_measures id="31"
- snapshot_id="5"
analysis_uuid="u5"
metric_id="11"
value="[null]"
person_id="333"
component_uuid="1"/>
<project_measures id="32"
- snapshot_id="5"
analysis_uuid="u5"
metric_id="12"
value="10"
alert_text="[null]"
VALUE="10.0"
METRIC_ID="1"
- SNAPSHOT_ID="1"
analysis_uuid="u1"
person_id="[null]"
text_value="[null]"
alert_text="[null]"
VALUE="10.0"
METRIC_ID="1"
- SNAPSHOT_ID="1"
analysis_uuid="u1"
person_id="[null]"
text_value="[null]"
alert_text="[null]"
VALUE="10.0"
METRIC_ID="1"
- SNAPSHOT_ID="5"
analysis_uuid="u5"
person_id="[null]"
text_value="[null]"
<!-- do not delete standard measure -->
<project_measures id="1"
- snapshot_id="1"
analysis_uuid="u1"
metric_id="1"
component_uuid="1"
<!-- do not delete standard measure -->
<project_measures id="1"
component_uuid="1"
- snapshot_id="1"
analysis_uuid="u1"
metric_id="1"
variation_value_1="[null]"
<!-- delete measure on metrics that are flagged with delete_historical_data=true -->
<project_measures id="6"
component_uuid="1"
- snapshot_id="1"
analysis_uuid="u1"
metric_id="2"
variation_value_1="[null]"
<!-- delete measure on developers -->
<project_measures id="7"
component_uuid="1"
- snapshot_id="1"
analysis_uuid="u1"
metric_id="2"
variation_value_1="[null]"
<project_measures ID="1"
component_uuid="1"
- SNAPSHOT_ID="1"
analysis_uuid="u1"
variation_value_1="[null]"
variation_value_2="[null]"
<project_measures ID="2"
component_uuid="2"
- SNAPSHOT_ID="2"
analysis_uuid="u2"
variation_value_1="[null]"
variation_value_2="[null]"
<project_measures ID="1"
component_uuid="1"
- SNAPSHOT_ID="1"
analysis_uuid="u1"
variation_value_1="[null]"
variation_value_2="[null]"
<project_measures ID="2"
component_uuid="2"
- SNAPSHOT_ID="2"
analysis_uuid="u2"
characteristic_id="[null]"
variation_value_1="[null]"