aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2018-08-08 16:02:03 +1200
committerGitHub <noreply@github.com>2018-08-08 16:02:03 +1200
commitf8158cff6267c5378f9abaacaddb419a12c75a8e (patch)
treef97d1115ce74da38ac1209f638ee20cc7adf951a
parentb800c16dff17f18b5c079e3403904d61bda86e88 (diff)
parentceab9b2b23b924d8ebb44b592b6e8f285408a5fa (diff)
downloadtraccar-server-f8158cff6267c5378f9abaacaddb419a12c75a8e.tar.gz
traccar-server-f8158cff6267c5378f9abaacaddb419a12c75a8e.tar.bz2
traccar-server-f8158cff6267c5378f9abaacaddb419a12c75a8e.zip
Merge pull request #3996 from Abyss777/fix_40changelog
Fix for notifications migration on postgresql and mssql
-rw-r--r--schema/changelog-4.0.xml75
1 files changed, 74 insertions, 1 deletions
diff --git a/schema/changelog-4.0.xml b/schema/changelog-4.0.xml
index 9a5cd1526..d1944c4f5 100644
--- a/schema/changelog-4.0.xml
+++ b/schema/changelog-4.0.xml
@@ -53,12 +53,30 @@
</changeSet>
- <changeSet author="author" id="changelog-4.0">
+ <changeSet author="author" id="changelog-4.0-pre">
+ <preConditions onFail="MARK_RAN">
+ <not>
+ <columnExists tableName="tc_notifications" columnName="notificators" />
+ </not>
+ </preConditions>
<addColumn tableName="tc_notifications">
<column name="notificators" type="VARCHAR(128)" />
</addColumn>
+ </changeSet>
+
+ <changeSet author="author" id="changelog-4.0-common">
+
+ <preConditions onFail="MARK_RAN">
+ <not>
+ <dbms type="postgresql" />
+ </not>
+ <columnExists tableName="tc_notifications" columnName="web" />
+ <columnExists tableName="tc_notifications" columnName="mail" />
+ <columnExists tableName="tc_notifications" columnName="sms" />
+ </preConditions>
+
<update tableName="tc_notifications">
<column name="notificators" value="web,mail,sms" />
<where>web = 1 AND mail = 1 AND sms = 1</where>
@@ -94,8 +112,63 @@
<where>web = 0 AND mail = 0 AND sms = 1</where>
</update>
+ </changeSet>
+
+ <changeSet author="author" id="changelog-4.0-pg">
+
+ <preConditions onFail="MARK_RAN">
+ <dbms type="postgresql" />
+ <columnExists tableName="tc_notifications" columnName="web" />
+ <columnExists tableName="tc_notifications" columnName="mail" />
+ <columnExists tableName="tc_notifications" columnName="sms" />
+ </preConditions>
+
+ <update tableName="tc_notifications">
+ <column name="notificators" value="web,mail,sms" />
+ <where>web = TRUE AND mail = TRUE AND sms = TRUE</where>
+ </update>
+
+ <update tableName="tc_notifications">
+ <column name="notificators" value="web,mail" />
+ <where>web = TRUE AND mail = TRUE AND sms = FALSE</where>
+ </update>
+
+ <update tableName="tc_notifications">
+ <column name="notificators" value="web" />
+ <where>web = TRUE AND mail = FALSE AND sms = FALSE</where>
+ </update>
+
+ <update tableName="tc_notifications">
+ <column name="notificators" value="web,sms" />
+ <where>web = TRUE AND mail = FALSE AND sms = TRUE</where>
+ </update>
+
+ <update tableName="tc_notifications">
+ <column name="notificators" value="mail,sms" />
+ <where>web = FALSE AND mail = TRUE AND sms = TRUE</where>
+ </update>
+
+ <update tableName="tc_notifications">
+ <column name="notificators" value="mail" />
+ <where>web = FALSE AND mail = TRUE AND sms = FALSE</where>
+ </update>
+
+ <update tableName="tc_notifications">
+ <column name="notificators" value="sms" />
+ <where>web = FALSE AND mail = FALSE AND sms = TRUE</where>
+ </update>
+
+ </changeSet>
+
+ <changeSet author="author" id="changelog-4.0">
+
+ <dropDefaultValue tableName="tc_notifications" columnName="web" />
<dropColumn tableName="tc_notifications" columnName="web" />
+
+ <dropDefaultValue tableName="tc_notifications" columnName="mail" />
<dropColumn tableName="tc_notifications" columnName="mail" />
+
+ <dropDefaultValue tableName="tc_notifications" columnName="sms" />
<dropColumn tableName="tc_notifications" columnName="sms" />
</changeSet>