aboutsummaryrefslogtreecommitdiff
path: root/schema
diff options
context:
space:
mode:
authorAbyss777 <abyss@fox5.ru>2018-08-07 16:19:20 +0500
committerAbyss777 <abyss@fox5.ru>2018-08-07 17:06:09 +0500
commit77fba0d739193f5ba4ac351a17729974e909e25c (patch)
tree1ab7900495af439fd8bb18f17c8329562b72bbf4 /schema
parent3ed2536aae70188fb6c7f20ff7a6a8ab7dfbba80 (diff)
downloadtraccar-server-77fba0d739193f5ba4ac351a17729974e909e25c.tar.gz
traccar-server-77fba0d739193f5ba4ac351a17729974e909e25c.tar.bz2
traccar-server-77fba0d739193f5ba4ac351a17729974e909e25c.zip
Fixed notifications migration on postgresql and mssql
Diffstat (limited to 'schema')
-rw-r--r--schema/changelog-4.0.xml81
1 files changed, 80 insertions, 1 deletions
diff --git a/schema/changelog-4.0.xml b/schema/changelog-4.0.xml
index 9a5cd1526..ed697bfca 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,69 @@
<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-post">
+
+ <preConditions onFail="MARK_RAN">
+ <columnExists tableName="tc_notifications" columnName="web" />
+ <columnExists tableName="tc_notifications" columnName="mail" />
+ <columnExists tableName="tc_notifications" columnName="sms" />
+ </preConditions>
+
+ <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>