]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-4529 Remove column notifications.createAt
authorJulien HENRY <julien.henry@sonarsource.com>
Tue, 27 Aug 2013 16:21:50 +0000 (18:21 +0200)
committerJulien HENRY <julien.henry@sonarsource.com>
Tue, 27 Aug 2013 16:21:50 +0000 (18:21 +0200)
sonar-core/src/main/resources/org/sonar/core/notification/db/NotificationQueueMapper.xml
sonar-core/src/main/resources/org/sonar/core/persistence/schema-h2.ddl
sonar-core/src/test/java/org/sonar/core/notification/db/NotificationQueueDaoTest.java
sonar-core/src/test/resources/org/sonar/core/notification/db/NotificationQueueDaoTest/should_delete_notification-result.xml
sonar-core/src/test/resources/org/sonar/core/notification/db/NotificationQueueDaoTest/should_delete_notification.xml
sonar-core/src/test/resources/org/sonar/core/notification/db/NotificationQueueDaoTest/should_findOldest.xml
sonar-core/src/test/resources/org/sonar/core/notification/db/NotificationQueueDaoTest/should_insert_new_notification_queue-result.xml
sonar-server/src/main/webapp/WEB-INF/db/migrate/430_add_index_to_notifications_created_at.rb [deleted file]
sonar-server/src/main/webapp/WEB-INF/db/migrate/430_remove_notifications_created_at.rb [new file with mode: 0644]

index eb933957b73c7f3ebe29fceb2a9f6d33b962e227..550ce3ec673bad1a1dea27474db2ea90f29ed324 100644 (file)
@@ -5,8 +5,8 @@
 <mapper namespace="org.sonar.core.notification.db.NotificationQueueMapper">
 
   <insert id="insert" parameterType="NotificationQueue" useGeneratedKeys="false">
-    INSERT INTO notifications (created_at, data)
-    VALUES (current_timestamp, #{data})
+    INSERT INTO notifications (data)
+    VALUES (#{data})
   </insert>
 
   <delete id="delete" parameterType="long">
@@ -16,7 +16,7 @@
   <select id="findOldest" parameterType="int" resultType="NotificationQueue">
     select id, data
     from notifications
-    order by created_at asc
+    order by id asc
     limit #{count}
   </select>
 
@@ -24,7 +24,7 @@
   <select id="findOldest" parameterType="int" resultType="NotificationQueue" databaseId="mssql">
     select top (#{count}) id, data
     from notifications
-    order by created_at asc
+    order by id asc
   </select>
 
   <!-- Oracle -->
@@ -32,7 +32,7 @@
     select * from (select
       id, data
       from notifications
-      order by created_at asc
+      order by id asc
     )
     where rownum &lt;= #{count}
   </select>
index ad2fdc11ed7bc2fe0ff8547681a231c8f24c53b7..96471330f05f74eeec074df0427c1307b2a49cd9 100644 (file)
@@ -294,7 +294,6 @@ CREATE TABLE "ACTIVE_RULES" (
 
 CREATE TABLE "NOTIFICATIONS" (
   "ID" INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1),
-  "CREATED_AT" TIMESTAMP,
   "DATA" BINARY(167772150)
 );
 
@@ -694,5 +693,3 @@ CREATE INDEX "SNAPSHOTS_ROOT_PROJECT_ID" ON "SNAPSHOTS" ("ROOT_PROJECT_ID");
 CREATE INDEX "GROUP_ROLES_ROLE" ON "GROUP_ROLES" ("ROLE");
 
 CREATE UNIQUE INDEX "RULES_PLUGIN_KEY_AND_NAME" ON "RULES" ("PLUGIN_RULE_KEY", "PLUGIN_NAME");
-
-CREATE INDEX "NOTIFICATIONS_CREATED_AT" ON "NOTIFICATIONS" ("CREATED_AT");
index 6be6b8f913b92552ceaf45a68bf7636487efc877..b9fe696504d6a7f7232c370ec2e800d430c434cd 100644 (file)
@@ -45,7 +45,7 @@ public class NotificationQueueDaoTest extends AbstractDaoTestCase {
 
     dao.insert(Arrays.asList(notificationQueueDto));
 
-    checkTables("should_insert_new_notification_queue", new String[] {"id", "created_at"}, "notifications");
+    checkTables("should_insert_new_notification_queue", new String[] {"id"}, "notifications");
     assertThat(dao.findOldest(1).get(0).toNotification().getType()).isEqualTo("email");
   }
 
@@ -67,7 +67,7 @@ public class NotificationQueueDaoTest extends AbstractDaoTestCase {
 
     Collection<NotificationQueueDto> result = dao.findOldest(3);
     assertThat(result).hasSize(3);
-    assertThat(result).onProperty("id").containsOnly(1L, 2L, 4L);
+    assertThat(result).onProperty("id").containsOnly(1L, 2L, 3L);
 
     result = dao.findOldest(6);
     assertThat(result).hasSize(4);
index f289e5d1fb212f503ad08937c00023746d189ad1..e4a095e42cd73e64742a7e441f2bc86c70068c03 100644 (file)
@@ -1,11 +1,11 @@
 <dataset>
 
-  <notifications id="2" created_at="2013-08-27" data="rO0ABXNyAChvcmcuc29uYXIuYXBpLm5vdGlmaWNhdGlvbnMuTm90aWZpY2F0aW9uTppHnJFK4aAC
+  <notifications id="2" data="rO0ABXNyAChvcmcuc29uYXIuYXBpLm5vdGlmaWNhdGlvbnMuTm90aWZpY2F0aW9uTppHnJFK4aAC
 AAJMAAZmaWVsZHN0AA9MamF2YS91dGlsL01hcDtMAAR0eXBldAASTGphdmEvbGFuZy9TdHJpbmc7
 eHBzcgARamF2YS51dGlsLkhhc2hNYXAFB9rBwxZg0QMAAkYACmxvYWRGYWN0b3JJAAl0aHJlc2hv
 bGR4cD9AAAAAAAAMdwgAAAAQAAAAAHh0AAZlbWFpbDI=" />
 
-  <notifications id="4" created_at="2013-08-28" data="rO0ABXNyAChvcmcuc29uYXIuYXBpLm5vdGlmaWNhdGlvbnMuTm90aWZpY2F0aW9uTppHnJFK4aAC
+  <notifications id="4" data="rO0ABXNyAChvcmcuc29uYXIuYXBpLm5vdGlmaWNhdGlvbnMuTm90aWZpY2F0aW9uTppHnJFK4aAC
 AAJMAAZmaWVsZHN0AA9MamF2YS91dGlsL01hcDtMAAR0eXBldAASTGphdmEvbGFuZy9TdHJpbmc7
 eHBzcgARamF2YS51dGlsLkhhc2hNYXAFB9rBwxZg0QMAAkYACmxvYWRGYWN0b3JJAAl0aHJlc2hv
 bGR4cD9AAAAAAAAMdwgAAAAQAAAAAHh0AAZlbWFpbDQ=" />
index feeca98cc7483c059751ff8031cf50cfb5630c0a..2eec750134c89c0f51296fd68db2901153a5faef 100644 (file)
@@ -1,21 +1,21 @@
 <dataset>
 
-  <notifications id="1" created_at="2013-08-26" data="rO0ABXNyAChvcmcuc29uYXIuYXBpLm5vdGlmaWNhdGlvbnMuTm90aWZpY2F0aW9uTppHnJFK4aAC
+  <notifications id="1" data="rO0ABXNyAChvcmcuc29uYXIuYXBpLm5vdGlmaWNhdGlvbnMuTm90aWZpY2F0aW9uTppHnJFK4aAC
 AAJMAAZmaWVsZHN0AA9MamF2YS91dGlsL01hcDtMAAR0eXBldAASTGphdmEvbGFuZy9TdHJpbmc7
 eHBzcgARamF2YS51dGlsLkhhc2hNYXAFB9rBwxZg0QMAAkYACmxvYWRGYWN0b3JJAAl0aHJlc2hv
 bGR4cD9AAAAAAAAMdwgAAAAQAAAAAHh0AAZlbWFpbDE=" />
 
-  <notifications id="2" created_at="2013-08-27" data="rO0ABXNyAChvcmcuc29uYXIuYXBpLm5vdGlmaWNhdGlvbnMuTm90aWZpY2F0aW9uTppHnJFK4aAC
+  <notifications id="2" data="rO0ABXNyAChvcmcuc29uYXIuYXBpLm5vdGlmaWNhdGlvbnMuTm90aWZpY2F0aW9uTppHnJFK4aAC
 AAJMAAZmaWVsZHN0AA9MamF2YS91dGlsL01hcDtMAAR0eXBldAASTGphdmEvbGFuZy9TdHJpbmc7
 eHBzcgARamF2YS51dGlsLkhhc2hNYXAFB9rBwxZg0QMAAkYACmxvYWRGYWN0b3JJAAl0aHJlc2hv
 bGR4cD9AAAAAAAAMdwgAAAAQAAAAAHh0AAZlbWFpbDI=" />
 
-  <notifications id="3" created_at="2013-08-29" data="rO0ABXNyAChvcmcuc29uYXIuYXBpLm5vdGlmaWNhdGlvbnMuTm90aWZpY2F0aW9uTppHnJFK4aAC
+  <notifications id="3" data="rO0ABXNyAChvcmcuc29uYXIuYXBpLm5vdGlmaWNhdGlvbnMuTm90aWZpY2F0aW9uTppHnJFK4aAC
 AAJMAAZmaWVsZHN0AA9MamF2YS91dGlsL01hcDtMAAR0eXBldAASTGphdmEvbGFuZy9TdHJpbmc7
 eHBzcgARamF2YS51dGlsLkhhc2hNYXAFB9rBwxZg0QMAAkYACmxvYWRGYWN0b3JJAAl0aHJlc2hv
 bGR4cD9AAAAAAAAMdwgAAAAQAAAAAHh0AAZlbWFpbDM=" />
 
-  <notifications id="4" created_at="2013-08-28" data="rO0ABXNyAChvcmcuc29uYXIuYXBpLm5vdGlmaWNhdGlvbnMuTm90aWZpY2F0aW9uTppHnJFK4aAC
+  <notifications id="4" data="rO0ABXNyAChvcmcuc29uYXIuYXBpLm5vdGlmaWNhdGlvbnMuTm90aWZpY2F0aW9uTppHnJFK4aAC
 AAJMAAZmaWVsZHN0AA9MamF2YS91dGlsL01hcDtMAAR0eXBldAASTGphdmEvbGFuZy9TdHJpbmc7
 eHBzcgARamF2YS51dGlsLkhhc2hNYXAFB9rBwxZg0QMAAkYACmxvYWRGYWN0b3JJAAl0aHJlc2hv
 bGR4cD9AAAAAAAAMdwgAAAAQAAAAAHh0AAZlbWFpbDQ=" />
index feeca98cc7483c059751ff8031cf50cfb5630c0a..2eec750134c89c0f51296fd68db2901153a5faef 100644 (file)
@@ -1,21 +1,21 @@
 <dataset>
 
-  <notifications id="1" created_at="2013-08-26" data="rO0ABXNyAChvcmcuc29uYXIuYXBpLm5vdGlmaWNhdGlvbnMuTm90aWZpY2F0aW9uTppHnJFK4aAC
+  <notifications id="1" data="rO0ABXNyAChvcmcuc29uYXIuYXBpLm5vdGlmaWNhdGlvbnMuTm90aWZpY2F0aW9uTppHnJFK4aAC
 AAJMAAZmaWVsZHN0AA9MamF2YS91dGlsL01hcDtMAAR0eXBldAASTGphdmEvbGFuZy9TdHJpbmc7
 eHBzcgARamF2YS51dGlsLkhhc2hNYXAFB9rBwxZg0QMAAkYACmxvYWRGYWN0b3JJAAl0aHJlc2hv
 bGR4cD9AAAAAAAAMdwgAAAAQAAAAAHh0AAZlbWFpbDE=" />
 
-  <notifications id="2" created_at="2013-08-27" data="rO0ABXNyAChvcmcuc29uYXIuYXBpLm5vdGlmaWNhdGlvbnMuTm90aWZpY2F0aW9uTppHnJFK4aAC
+  <notifications id="2" data="rO0ABXNyAChvcmcuc29uYXIuYXBpLm5vdGlmaWNhdGlvbnMuTm90aWZpY2F0aW9uTppHnJFK4aAC
 AAJMAAZmaWVsZHN0AA9MamF2YS91dGlsL01hcDtMAAR0eXBldAASTGphdmEvbGFuZy9TdHJpbmc7
 eHBzcgARamF2YS51dGlsLkhhc2hNYXAFB9rBwxZg0QMAAkYACmxvYWRGYWN0b3JJAAl0aHJlc2hv
 bGR4cD9AAAAAAAAMdwgAAAAQAAAAAHh0AAZlbWFpbDI=" />
 
-  <notifications id="3" created_at="2013-08-29" data="rO0ABXNyAChvcmcuc29uYXIuYXBpLm5vdGlmaWNhdGlvbnMuTm90aWZpY2F0aW9uTppHnJFK4aAC
+  <notifications id="3" data="rO0ABXNyAChvcmcuc29uYXIuYXBpLm5vdGlmaWNhdGlvbnMuTm90aWZpY2F0aW9uTppHnJFK4aAC
 AAJMAAZmaWVsZHN0AA9MamF2YS91dGlsL01hcDtMAAR0eXBldAASTGphdmEvbGFuZy9TdHJpbmc7
 eHBzcgARamF2YS51dGlsLkhhc2hNYXAFB9rBwxZg0QMAAkYACmxvYWRGYWN0b3JJAAl0aHJlc2hv
 bGR4cD9AAAAAAAAMdwgAAAAQAAAAAHh0AAZlbWFpbDM=" />
 
-  <notifications id="4" created_at="2013-08-28" data="rO0ABXNyAChvcmcuc29uYXIuYXBpLm5vdGlmaWNhdGlvbnMuTm90aWZpY2F0aW9uTppHnJFK4aAC
+  <notifications id="4" data="rO0ABXNyAChvcmcuc29uYXIuYXBpLm5vdGlmaWNhdGlvbnMuTm90aWZpY2F0aW9uTppHnJFK4aAC
 AAJMAAZmaWVsZHN0AA9MamF2YS91dGlsL01hcDtMAAR0eXBldAASTGphdmEvbGFuZy9TdHJpbmc7
 eHBzcgARamF2YS51dGlsLkhhc2hNYXAFB9rBwxZg0QMAAkYACmxvYWRGYWN0b3JJAAl0aHJlc2hv
 bGR4cD9AAAAAAAAMdwgAAAAQAAAAAHh0AAZlbWFpbDQ=" />
index f6c81b15f645a0954f397be2e7b823e373f8c087..cf030f42632e1eb34c5096247ec6ddeaac2334fd 100644 (file)
@@ -1,6 +1,6 @@
 <dataset>
 
-  <notifications id="1" created_at="[null]" data="rO0ABXNyAChvcmcuc29uYXIuYXBpLm5vdGlmaWNhdGlvbnMuTm90aWZpY2F0aW9uTppHnJFK4aAC
+  <notifications id="1" data="rO0ABXNyAChvcmcuc29uYXIuYXBpLm5vdGlmaWNhdGlvbnMuTm90aWZpY2F0aW9uTppHnJFK4aAC
 AAJMAAZmaWVsZHN0AA9MamF2YS91dGlsL01hcDtMAAR0eXBldAASTGphdmEvbGFuZy9TdHJpbmc7
 eHBzcgARamF2YS51dGlsLkhhc2hNYXAFB9rBwxZg0QMAAkYACmxvYWRGYWN0b3JJAAl0aHJlc2hv
 bGR4cD9AAAAAAAAMdwgAAAAQAAAAAHh0AAVlbWFpbA==" />
diff --git a/sonar-server/src/main/webapp/WEB-INF/db/migrate/430_add_index_to_notifications_created_at.rb b/sonar-server/src/main/webapp/WEB-INF/db/migrate/430_add_index_to_notifications_created_at.rb
deleted file mode 100644 (file)
index d9d155f..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-#
-# SonarQube, open source software quality management tool.
-# Copyright (C) 2008-2013 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.
-#
-
-#
-# @since SonarQube 4.0
-#
-class AddIndexToNotificationsCreatedAt < ActiveRecord::Migration
-
-  def self.up
-    begin
-      add_index :notifications, :created_at, :name => 'notifications_created_at'
-    rescue
-      # already exists
-    end
-  end
-
-end
diff --git a/sonar-server/src/main/webapp/WEB-INF/db/migrate/430_remove_notifications_created_at.rb b/sonar-server/src/main/webapp/WEB-INF/db/migrate/430_remove_notifications_created_at.rb
new file mode 100644 (file)
index 0000000..e9f44aa
--- /dev/null
@@ -0,0 +1,30 @@
+#
+# SonarQube, open source software quality management tool.
+# Copyright (C) 2008-2013 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.
+#
+
+#
+# @since SonarQube 4.0
+#
+class RemoveNotificationsCreatedAt < ActiveRecord::Migration
+
+  def self.up
+    remove_column('notifications', 'created_at')
+  end
+
+end