aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2018-10-10 11:30:48 +1300
committerAnton Tananaev <anton.tananaev@gmail.com>2018-10-10 11:30:48 +1300
commit6cfb503b400cbee3689cfb256a9779a024fe7f1d (patch)
tree4d1e179cdfd200e4f26290aaa02352a3ff17b814
parent1264c4cec35c7e26aaaa32362bbf5ab3d97635aa (diff)
downloadtraccar-server-6cfb503b400cbee3689cfb256a9779a024fe7f1d.tar.gz
traccar-server-6cfb503b400cbee3689cfb256a9779a024fe7f1d.tar.bz2
traccar-server-6cfb503b400cbee3689cfb256a9779a024fe7f1d.zip
Add clean 4.0 changelog (fix #4035)
-rw-r--r--schema/changelog-3.10.xml22
-rw-r--r--schema/changelog-3.11.xml6
-rw-r--r--schema/changelog-3.12.xml20
-rw-r--r--schema/changelog-3.14.xml7
-rw-r--r--schema/changelog-3.15.xml7
-rw-r--r--schema/changelog-3.16.xml7
-rw-r--r--schema/changelog-3.17.xml10
-rw-r--r--schema/changelog-3.3.xml3
-rw-r--r--schema/changelog-3.5.xml3
-rw-r--r--schema/changelog-3.6.xml3
-rw-r--r--schema/changelog-3.7.xml11
-rw-r--r--schema/changelog-3.8.xml7
-rw-r--r--schema/changelog-3.9.xml21
-rw-r--r--schema/changelog-4.0-clean.xml679
-rw-r--r--schema/changelog-4.0.xml72
-rw-r--r--schema/changelog-master.xml3
16 files changed, 835 insertions, 46 deletions
diff --git a/schema/changelog-3.10.xml b/schema/changelog-3.10.xml
index 4c64373e9..6d4fa634c 100644
--- a/schema/changelog-3.10.xml
+++ b/schema/changelog-3.10.xml
@@ -8,6 +8,12 @@
<changeSet author="author" id="changelog-3.10">
+ <preConditions onFail="MARK_RAN">
+ <not>
+ <tableExists tableName="tc_servers" />
+ </not>
+ </preConditions>
+
<createTable tableName="calendars">
<column name="id" type="INT" autoIncrement="true">
<constraints primaryKey="true" />
@@ -64,8 +70,8 @@
<addForeignKeyConstraint baseTableName="user_user" baseColumnNames="userid" constraintName="fk_user_user_userid" referencedTableName="users" referencedColumnNames="id" onDelete="CASCADE" />
<update tableName="users">
- <column name="devicelimit" valueNumeric="-1" />
- <where>devicelimit = 0</where>
+ <column name="devicelimit" valueNumeric="-1" />
+ <where>devicelimit = 0</where>
</update>
<dropDefaultValue tableName="users" columnName="devicelimit" />
<addDefaultValue tableName="users" columnName="devicelimit" defaultValueNumeric="-1" />
@@ -80,9 +86,13 @@
<preConditions onFail="MARK_RAN">
<not>
+ <tableExists tableName="tc_servers" />
+ </not>
+ <not>
<dbms type="mssql" />
</not>
</preConditions>
+
<addForeignKeyConstraint baseTableName="user_user" baseColumnNames="manageduserid" constraintName="fk_user_user_manageduserid" referencedTableName="users" referencedColumnNames="id" onDelete="CASCADE" />
</changeSet>
@@ -90,8 +100,12 @@
<changeSet author="author" id="changelog-3.10-mssql">
<preConditions onFail="MARK_RAN">
+ <not>
+ <tableExists tableName="tc_servers" />
+ </not>
<dbms type="mssql" />
</preConditions>
+
<sql>
CREATE TRIGGER tg_users_delete
ON users FOR DELETE
@@ -105,8 +119,12 @@
<changeSet author="author" id="changelog-3.7-mssql">
<preConditions onFail="MARK_RAN">
+ <not>
+ <tableExists tableName="tc_servers" />
+ </not>
<dbms type="mssql" />
</preConditions>
+
<sql>
CREATE TRIGGER tg_groups_delete
ON groups FOR DELETE
diff --git a/schema/changelog-3.11.xml b/schema/changelog-3.11.xml
index 1fdaa3f17..31893c0df 100644
--- a/schema/changelog-3.11.xml
+++ b/schema/changelog-3.11.xml
@@ -8,6 +8,12 @@
<changeSet author="author" id="changelog-3.11">
+ <preConditions onFail="MARK_RAN">
+ <not>
+ <tableExists tableName="tc_servers" />
+ </not>
+ </preConditions>
+
<addColumn tableName="users">
<column name="phone" type="VARCHAR(128)" />
</addColumn>
diff --git a/schema/changelog-3.12.xml b/schema/changelog-3.12.xml
index 19c67cb36..0d8c8550f 100644
--- a/schema/changelog-3.12.xml
+++ b/schema/changelog-3.12.xml
@@ -8,6 +8,12 @@
<changeSet author="author" id="changelog-3.12">
+ <preConditions onFail="MARK_RAN">
+ <not>
+ <tableExists tableName="tc_servers" />
+ </not>
+ </preConditions>
+
<addColumn tableName="statistics">
<column name="mailsent" type="INT" defaultValueNumeric="0">
<constraints nullable="false" />
@@ -77,12 +83,6 @@
<addForeignKeyConstraint baseTableName="device_attribute" baseColumnNames="deviceid" constraintName="fk_device_attribute_deviceid" referencedTableName="devices" referencedColumnNames="id" onDelete="CASCADE" />
<addForeignKeyConstraint baseTableName="device_attribute" baseColumnNames="attributeid" constraintName="fk_device_attribute_attributeid" referencedTableName="attributes" referencedColumnNames="id" onDelete="CASCADE" />
- <!--<dropForeignKeyConstraint baseTableName="positions" constraintName="fk_position_deviceid" />
- <addForeignKeyConstraint baseTableName="positions" baseColumnNames="deviceid" constraintName="fk_positions_deviceid" referencedTableName="devices" referencedColumnNames="id" onDelete="CASCADE" />
-
- <dropForeignKeyConstraint baseTableName="events" constraintName="fk_event_deviceid" />
- <addForeignKeyConstraint baseTableName="events" baseColumnNames="deviceid" constraintName="fk_events_deviceid" referencedTableName="devices" referencedColumnNames="id" onDelete="CASCADE" />-->
-
<dropForeignKeyConstraint baseTableName="device_geofence" constraintName="fk_user_device_geofence_deviceid" />
<addForeignKeyConstraint baseTableName="device_geofence" baseColumnNames="deviceid" constraintName="fk_device_geofence_deviceid" referencedTableName="devices" referencedColumnNames="id" onDelete="CASCADE" />
<dropForeignKeyConstraint baseTableName="device_geofence" constraintName="fk_user_device_geofence_geofenceid" />
@@ -100,9 +100,13 @@
<preConditions onFail="MARK_RAN">
<not>
+ <tableExists tableName="tc_servers" />
+ </not>
+ <not>
<dbms type="mssql" />
</not>
</preConditions>
+
<dropForeignKeyConstraint baseTableName="groups" constraintName="fk_group_group_groupid" />
<addForeignKeyConstraint baseTableName="groups" baseColumnNames="groupid" constraintName="fk_groups_groupid" onDelete="SET NULL" onUpdate="RESTRICT" referencedColumnNames="id" referencedTableName="groups" />
@@ -111,9 +115,13 @@
<changeSet author="author" id="changelog-3.12-pgsql">
<preConditions onFail="MARK_RAN">
+ <not>
+ <tableExists tableName="tc_servers" />
+ </not>
<dbms type="postgresql" />
<sqlCheck expectedResult="oid">SELECT data_type FROM information_schema.columns WHERE table_name = 'calendars' AND column_name = 'data';</sqlCheck>
</preConditions>
+
<dropColumn tableName="calendars" columnName="data" />
<addColumn tableName="calendars">
<column name="data" type="bytea">
diff --git a/schema/changelog-3.14.xml b/schema/changelog-3.14.xml
index f6cda4c1f..063adeed7 100644
--- a/schema/changelog-3.14.xml
+++ b/schema/changelog-3.14.xml
@@ -8,6 +8,12 @@
<changeSet author="author" id="changelog-3.14">
+ <preConditions onFail="MARK_RAN">
+ <not>
+ <tableExists tableName="tc_servers" />
+ </not>
+ </preConditions>
+
<createTable tableName="drivers">
<column name="id" type="INT" autoIncrement="true">
<constraints primaryKey="true" />
@@ -64,4 +70,5 @@
<renameTable oldTableName="server" newTableName="servers" />
</changeSet>
+
</databaseChangeLog>
diff --git a/schema/changelog-3.15.xml b/schema/changelog-3.15.xml
index 202ae21eb..64afd5c31 100644
--- a/schema/changelog-3.15.xml
+++ b/schema/changelog-3.15.xml
@@ -8,6 +8,12 @@
<changeSet author="author" id="changelog-3.15">
+ <preConditions onFail="MARK_RAN">
+ <not>
+ <tableExists tableName="tc_servers" />
+ </not>
+ </preConditions>
+
<dropForeignKeyConstraint baseTableName="attribute_aliases" constraintName="fk_attribute_aliases_deviceid" />
<dropUniqueConstraint tableName="attribute_aliases" constraintName="uk_deviceid_attribute" />
@@ -141,4 +147,5 @@
</addColumn>
</changeSet>
+
</databaseChangeLog>
diff --git a/schema/changelog-3.16.xml b/schema/changelog-3.16.xml
index 74fe35c3d..b5af517da 100644
--- a/schema/changelog-3.16.xml
+++ b/schema/changelog-3.16.xml
@@ -8,6 +8,12 @@
<changeSet author="author" id="changelog-3.16">
+ <preConditions onFail="MARK_RAN">
+ <not>
+ <tableExists tableName="tc_servers" />
+ </not>
+ </preConditions>
+
<addColumn tableName="devices">
<column name="disabled" type="BOOLEAN" defaultValueBoolean="false" />
</addColumn>
@@ -27,4 +33,5 @@
<addForeignKeyConstraint baseColumnNames="calendarid" baseTableName="notifications" constraintName="fk_notification_calendar_calendarid" onDelete="SET NULL" onUpdate="RESTRICT" referencedColumnNames="id" referencedTableName="calendars" />
</changeSet>
+
</databaseChangeLog>
diff --git a/schema/changelog-3.17.xml b/schema/changelog-3.17.xml
index 09d07fcf1..dd4e18b2a 100644
--- a/schema/changelog-3.17.xml
+++ b/schema/changelog-3.17.xml
@@ -10,6 +10,9 @@
<preConditions onFail="MARK_RAN">
<not>
+ <tableExists tableName="tc_servers" />
+ </not>
+ <not>
<columnExists tableName="users" columnName="administrator" />
</not>
</preConditions>
@@ -20,6 +23,12 @@
<changeSet author="author" id="changelog-3.17">
+ <preConditions onFail="MARK_RAN">
+ <not>
+ <tableExists tableName="tc_servers" />
+ </not>
+ </preConditions>
+
<addColumn tableName="events">
<column name="maintenanceid" type="INT" />
</addColumn>
@@ -82,4 +91,5 @@
<addForeignKeyConstraint baseTableName="device_maintenance" baseColumnNames="maintenanceid" constraintName="fk_device_maintenance_maintenanceid" referencedTableName="maintenances" referencedColumnNames="id" onDelete="CASCADE" />
</changeSet>
+
</databaseChangeLog>
diff --git a/schema/changelog-3.3.xml b/schema/changelog-3.3.xml
index e5f29c661..4a34c6626 100644
--- a/schema/changelog-3.3.xml
+++ b/schema/changelog-3.3.xml
@@ -10,7 +10,7 @@
<preConditions onFail="MARK_RAN">
<not>
- <tableExists tableName="server" />
+ <tableExists tableName="tc_servers" />
</not>
</preConditions>
@@ -185,4 +185,5 @@
</insert>
</changeSet>
+
</databaseChangeLog>
diff --git a/schema/changelog-3.5.xml b/schema/changelog-3.5.xml
index 934f389b2..7adfc9f2f 100644
--- a/schema/changelog-3.5.xml
+++ b/schema/changelog-3.5.xml
@@ -10,7 +10,7 @@
<preConditions onFail="MARK_RAN">
<not>
- <tableExists tableName="groups" />
+ <tableExists tableName="tc_servers" />
</not>
</preConditions>
@@ -65,4 +65,5 @@
</addColumn>
</changeSet>
+
</databaseChangeLog>
diff --git a/schema/changelog-3.6.xml b/schema/changelog-3.6.xml
index 2e7cd61c8..27701640f 100644
--- a/schema/changelog-3.6.xml
+++ b/schema/changelog-3.6.xml
@@ -10,7 +10,7 @@
<preConditions onFail="MARK_RAN">
<not>
- <tableExists tableName="events" />
+ <tableExists tableName="tc_servers" />
</not>
</preConditions>
@@ -112,4 +112,5 @@
</addColumn>
</changeSet>
+
</databaseChangeLog>
diff --git a/schema/changelog-3.7.xml b/schema/changelog-3.7.xml
index 1bae2aaff..1d1cdbaac 100644
--- a/schema/changelog-3.7.xml
+++ b/schema/changelog-3.7.xml
@@ -8,6 +8,12 @@
<changeSet author="author" id="changelog-3.7">
+ <preConditions onFail="MARK_RAN">
+ <not>
+ <tableExists tableName="tc_servers" />
+ </not>
+ </preConditions>
+
<update tableName="devices">
<column name="groupid"/>
<where>groupid NOT IN (SELECT id FROM groups)</where>
@@ -42,10 +48,15 @@
<preConditions onFail="MARK_RAN">
<not>
+ <tableExists tableName="tc_servers" />
+ </not>
+ <not>
<dbms type="mssql" />
</not>
</preConditions>
+
<addForeignKeyConstraint baseColumnNames="groupid" baseTableName="groups" constraintName="fk_group_group_groupid" onDelete="SET NULL" onUpdate="RESTRICT" referencedColumnNames="id" referencedTableName="groups"/>
</changeSet>
+
</databaseChangeLog>
diff --git a/schema/changelog-3.8.xml b/schema/changelog-3.8.xml
index c80a8442c..fed12c563 100644
--- a/schema/changelog-3.8.xml
+++ b/schema/changelog-3.8.xml
@@ -8,6 +8,12 @@
<changeSet author="author" id="changelog-3.8">
+ <preConditions onFail="MARK_RAN">
+ <not>
+ <tableExists tableName="tc_servers" />
+ </not>
+ </preConditions>
+
<createTable tableName="attribute_aliases">
<column name="id" type="INT" autoIncrement="true">
<constraints primaryKey="true" />
@@ -121,4 +127,5 @@
</addColumn>
</changeSet>
+
</databaseChangeLog>
diff --git a/schema/changelog-3.9.xml b/schema/changelog-3.9.xml
index 93fa6123b..9a797ff7d 100644
--- a/schema/changelog-3.9.xml
+++ b/schema/changelog-3.9.xml
@@ -8,30 +8,37 @@
<changeSet author="author" id="changelog-3.9">
+ <preConditions onFail="MARK_RAN">
+ <not>
+ <tableExists tableName="tc_servers" />
+ </not>
+ </preConditions>
+
<addColumn tableName="notifications">
<column name="web" type="BOOLEAN" defaultValueBoolean="false" />
<column name="mail" type="BOOLEAN" defaultValueBoolean="false" />
</addColumn>
<update tableName="notifications">
- <column name="web" valueBoolean="true" />
- <where>attributes = '{"web":"true"}'</where>
+ <column name="web" valueBoolean="true" />
+ <where>attributes = '{"web":"true"}'</where>
</update>
<update tableName="notifications">
- <column name="mail" valueBoolean="true" />
+ <column name="mail" valueBoolean="true" />
<where>attributes = '{"mail":"true"}'</where>
</update>
<update tableName="notifications">
- <column name="web" valueBoolean="true" />
- <column name="mail" valueBoolean="true" />
- <where>attributes = '{"web":"true","mail":"true"}'</where>
+ <column name="web" valueBoolean="true" />
+ <column name="mail" valueBoolean="true" />
+ <where>attributes = '{"web":"true","mail":"true"}'</where>
</update>
<update tableName="notifications">
- <column name="attributes" value="{}" />
+ <column name="attributes" value="{}" />
</update>
</changeSet>
+
</databaseChangeLog>
diff --git a/schema/changelog-4.0-clean.xml b/schema/changelog-4.0-clean.xml
new file mode 100644
index 000000000..96490a3f0
--- /dev/null
+++ b/schema/changelog-4.0-clean.xml
@@ -0,0 +1,679 @@
+<?xml version="1.1" encoding="UTF-8"?>
+<databaseChangeLog
+ xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog
+ http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.6.xsd"
+ logicalFilePath="changelog-4.0-clean">
+
+ <property name="blob.type" value="BLOB" dbms="h2,mysql,mssql,oracle"/>
+ <property name="blob.type" value="bytea" dbms="postgresql"/>
+
+ <changeSet author="author" id="changelog-4.0-clean">
+
+ <preConditions onFail="MARK_RAN">
+ <not>
+ <changeSetExecuted changeLogFile="changelog-3.3" id="changelog-3.3" author="author" />
+ </not>
+ </preConditions>
+
+ <createTable tableName="tc_attributes">
+ <column autoIncrement="true" name="id" type="INT">
+ <constraints primaryKey="true" />
+ </column>
+ <column name="description" type="VARCHAR(4000)">
+ <constraints nullable="false" />
+ </column>
+ <column name="type" type="VARCHAR(128)">
+ <constraints nullable="false" />
+ </column>
+ <column name="attribute" type="VARCHAR(128)">
+ <constraints nullable="false" />
+ </column>
+ <column name="expression" type="VARCHAR(4000)">
+ <constraints nullable="false" />
+ </column>
+ </createTable>
+
+ <createTable tableName="tc_calendars">
+ <column autoIncrement="true" name="id" type="INT">
+ <constraints primaryKey="true" />
+ </column>
+ <column name="name" type="VARCHAR(128)">
+ <constraints nullable="false" />
+ </column>
+ <column name="data" type="${blob.type}">
+ <constraints nullable="false" />
+ </column>
+ <column name="attributes" type="VARCHAR(4000)">
+ <constraints nullable="false" />
+ </column>
+ </createTable>
+
+ <createTable tableName="tc_commands">
+ <column autoIncrement="true" name="id" type="INT">
+ <constraints primaryKey="true" />
+ </column>
+ <column name="description" type="VARCHAR(4000)">
+ <constraints nullable="false" />
+ </column>
+ <column name="type" type="VARCHAR(128)">
+ <constraints nullable="false" />
+ </column>
+ <column name="textchannel" type="BOOLEAN" defaultValueBoolean="false">
+ <constraints nullable="false" />
+ </column>
+ <column name="attributes" type="VARCHAR(4000)">
+ <constraints nullable="false" />
+ </column>
+ </createTable>
+
+ <createTable tableName="tc_device_attribute">
+ <column name="deviceid" type="INT">
+ <constraints nullable="false" />
+ </column>
+ <column name="attributeid" type="INT">
+ <constraints nullable="false" />
+ </column>
+ </createTable>
+
+ <createTable tableName="tc_device_command">
+ <column name="deviceid" type="INT">
+ <constraints nullable="false" />
+ </column>
+ <column name="commandid" type="INT">
+ <constraints nullable="false" />
+ </column>
+ </createTable>
+
+ <createTable tableName="tc_device_driver">
+ <column name="deviceid" type="INT">
+ <constraints nullable="false" />
+ </column>
+ <column name="driverid" type="INT">
+ <constraints nullable="false" />
+ </column>
+ </createTable>
+
+ <createTable tableName="tc_device_geofence">
+ <column name="deviceid" type="INT">
+ <constraints nullable="false" />
+ </column>
+ <column name="geofenceid" type="INT">
+ <constraints nullable="false" />
+ </column>
+ </createTable>
+
+ <createTable tableName="tc_device_maintenance">
+ <column name="deviceid" type="INT">
+ <constraints nullable="false" />
+ </column>
+ <column name="maintenanceid" type="INT">
+ <constraints nullable="false" />
+ </column>
+ </createTable>
+
+ <createTable tableName="tc_device_notification">
+ <column name="deviceid" type="INT">
+ <constraints nullable="false" />
+ </column>
+ <column name="notificationid" type="INT">
+ <constraints nullable="false" />
+ </column>
+ </createTable>
+
+ <createTable tableName="tc_devices">
+ <column name="id" type="INT" autoIncrement="true">
+ <constraints primaryKey="true" />
+ </column>
+ <column name="name" type="VARCHAR(128)">
+ <constraints nullable="false" />
+ </column>
+ <column name="uniqueid" type="VARCHAR(128)">
+ <constraints nullable="false" unique="true" />
+ </column>
+ <column name="lastupdate" type="timestamp" />
+ <column name="positionid" type="INT" />
+ <column name="groupid" type="INT" />
+ <column name="attributes" type="VARCHAR(4000)" />
+ <column name="phone" type="VARCHAR(128)" />
+ <column name="model" type="VARCHAR(128)" />
+ <column name="contact" type="VARCHAR(512)" />
+ <column name="category" type="VARCHAR(128)" />
+ <column name="disabled" type="BOOLEAN" defaultValueBoolean="false" />
+ </createTable>
+
+ <createTable tableName="tc_drivers">
+ <column name="id" type="INT" autoIncrement="true">
+ <constraints primaryKey="true" />
+ </column>
+ <column name="name" type="VARCHAR(128)">
+ <constraints nullable="false" />
+ </column>
+ <column name="uniqueid" type="VARCHAR(128)">
+ <constraints nullable="false" unique="true" />
+ </column>
+ <column name="attributes" type="VARCHAR(4000)">
+ <constraints nullable="false" />
+ </column>
+ </createTable>
+
+ <createTable tableName="tc_events">
+ <column name="id" type="INT" autoIncrement="true">
+ <constraints primaryKey="true" />
+ </column>
+ <column name="type" type="VARCHAR(128)">
+ <constraints nullable="false" />
+ </column>
+ <column name="servertime" type="TIMESTAMP">
+ <constraints nullable="false" />
+ </column>
+ <column name="deviceid" type="INT" />
+ <column name="positionid" type="INT" />
+ <column name="geofenceid" type="INT" />
+ <column name="attributes" type="VARCHAR(4000)" />
+ <column name="maintenanceid" type="INT" />
+ </createTable>
+
+ <createTable tableName="tc_geofences">
+ <column name="id" type="INT" autoIncrement="true">
+ <constraints primaryKey="true" />
+ </column>
+ <column name="name" type="VARCHAR(128)">
+ <constraints nullable="false" />
+ </column>
+ <column name="description" type="VARCHAR(128)" />
+ <column name="area" type="VARCHAR(4096)">
+ <constraints nullable="false" />
+ </column>
+ <column name="attributes" type="VARCHAR(4000)" />
+ <column name="calendarid" type="INT" />
+ </createTable>
+
+ <createTable tableName="tc_group_attribute">
+ <column name="groupid" type="INT">
+ <constraints nullable="false" />
+ </column>
+ <column name="attributeid" type="INT">
+ <constraints nullable="false" />
+ </column>
+ </createTable>
+
+ <createTable tableName="tc_group_command">
+ <column name="groupid" type="INT">
+ <constraints nullable="false" />
+ </column>
+ <column name="commandid" type="INT">
+ <constraints nullable="false" />
+ </column>
+ </createTable>
+
+ <createTable tableName="tc_group_driver">
+ <column name="groupid" type="INT">
+ <constraints nullable="false" />
+ </column>
+ <column name="driverid" type="INT">
+ <constraints nullable="false" />
+ </column>
+ </createTable>
+
+ <createTable tableName="tc_group_geofence">
+ <column name="groupid" type="INT">
+ <constraints nullable="false" />
+ </column>
+ <column name="geofenceid" type="INT">
+ <constraints nullable="false" />
+ </column>
+ </createTable>
+
+ <createTable tableName="tc_group_maintenance">
+ <column name="groupid" type="INT">
+ <constraints nullable="false" />
+ </column>
+ <column name="maintenanceid" type="INT">
+ <constraints nullable="false" />
+ </column>
+ </createTable>
+
+ <createTable tableName="tc_group_notification">
+ <column name="groupid" type="INT">
+ <constraints nullable="false" />
+ </column>
+ <column name="notificationid" type="INT">
+ <constraints nullable="false" />
+ </column>
+ </createTable>
+
+ <createTable tableName="tc_groups">
+ <column autoIncrement="true" name="id" type="INT">
+ <constraints primaryKey="true" />
+ </column>
+ <column name="name" type="VARCHAR(128)">
+ <constraints nullable="false" />
+ </column>
+ <column name="groupid" type="INT" />
+ <column name="attributes" type="VARCHAR(4000)" />
+ </createTable>
+
+ <createTable tableName="tc_maintenances">
+ <column name="id" type="INT" autoIncrement="true">
+ <constraints primaryKey="true" />
+ </column>
+ <column name="name" type="VARCHAR(4000)">
+ <constraints nullable="false" />
+ </column>
+ <column name="type" type="VARCHAR(128)">
+ <constraints nullable="false" />
+ </column>
+ <column name="start" type="DOUBLE" defaultValueNumeric="0">
+ <constraints nullable="false" />
+ </column>
+ <column name="period" type="DOUBLE" defaultValueNumeric="0">
+ <constraints nullable="false" />
+ </column>
+ <column name="attributes" type="VARCHAR(4000)">
+ <constraints nullable="false" />
+ </column>
+ </createTable>
+
+ <createTable tableName="tc_notifications">
+ <column name="id" type="INT" autoIncrement="true">
+ <constraints primaryKey="true" />
+ </column>
+ <column name="type" type="VARCHAR(128)">
+ <constraints nullable="false" />
+ </column>
+ <column name="attributes" type="VARCHAR(4000)" />
+ <column name="always" type="BOOLEAN" defaultValueBoolean="false">
+ <constraints nullable="false" />
+ </column>
+ <column name="calendarid" type="INT" />
+ <column name="notificators" type="VARCHAR(128)" />
+ </createTable>
+
+ <createTable tableName="tc_positions">
+ <column name="id" type="INT" autoIncrement="true">
+ <constraints primaryKey="true" />
+ </column>
+ <column name="protocol" type="VARCHAR(128)" />
+ <column name="deviceid" type="INT">
+ <constraints nullable="false" />
+ </column>
+ <column name="servertime" type="TIMESTAMP" defaultValueComputed="CURRENT_TIMESTAMP">
+ <constraints nullable="false" />
+ </column>
+ <column name="devicetime" type="TIMESTAMP">
+ <constraints nullable="false" />
+ </column>
+ <column name="fixtime" type="TIMESTAMP">
+ <constraints nullable="false" />
+ </column>
+ <column name="valid" type="BOOLEAN">
+ <constraints nullable="false" />
+ </column>
+ <column name="latitude" type="DOUBLE">
+ <constraints nullable="false" />
+ </column>
+ <column name="longitude" type="DOUBLE">
+ <constraints nullable="false" />
+ </column>
+ <column name="altitude" type="FLOAT">
+ <constraints nullable="false" />
+ </column>
+ <column name="speed" type="FLOAT">
+ <constraints nullable="false" />
+ </column>
+ <column name="course" type="FLOAT">
+ <constraints nullable="false" />
+ </column>
+ <column name="address" type="VARCHAR(512)" />
+ <column name="attributes" type="VARCHAR(4000)" />
+ <column name="accuracy" type="DOUBLE" defaultValueNumeric="0">
+ <constraints nullable="false" />
+ </column>
+ <column name="network" type="VARCHAR(4000)" />
+ </createTable>
+
+ <createTable tableName="tc_servers">
+ <column name="id" type="INT" autoIncrement="true">
+ <constraints primaryKey="true" />
+ </column>
+ <column name="registration" type="BOOLEAN" defaultValueBoolean="true">
+ <constraints nullable="false" />
+ </column>
+ <column name="latitude" type="DOUBLE" defaultValueNumeric="0">
+ <constraints nullable="false" />
+ </column>
+ <column name="longitude" type="DOUBLE" defaultValueNumeric="0">
+ <constraints nullable="false" />
+ </column>
+ <column name="zoom" type="INT" defaultValueNumeric="0">
+ <constraints nullable="false" />
+ </column>
+ <column name="map" type="VARCHAR(128)" />
+ <column name="bingkey" type="VARCHAR(128)" />
+ <column name="mapurl" type="VARCHAR(512)" />
+ <column name="readonly" type="BOOLEAN" defaultValueBoolean="false">
+ <constraints nullable="false" />
+ </column>
+ <column name="twelvehourformat" type="BOOLEAN" defaultValueBoolean="false">
+ <constraints nullable="false" />
+ </column>
+ <column name="attributes" type="VARCHAR(4000)" />
+ <column name="forcesettings" type="BOOLEAN" defaultValueBoolean="false">
+ <constraints nullable="false" />
+ </column>
+ <column name="coordinateformat" type="VARCHAR(128)" />
+ <column name="devicereadonly" type="BOOLEAN" defaultValueBoolean="false" />
+ <column name="limitcommands" type="BOOLEAN" defaultValueBoolean="false" />
+ <column name="poilayer" type="VARCHAR(512)" />
+ </createTable>
+
+ <createTable tableName="tc_statistics">
+ <column name="id" type="INT" autoIncrement="true">
+ <constraints primaryKey="true" />
+ </column>
+ <column name="capturetime" type="TIMESTAMP">
+ <constraints nullable="false" />
+ </column>
+ <column name="activeusers" type="INT" defaultValueNumeric="0">
+ <constraints nullable="false" />
+ </column>
+ <column name="activedevices" type="INT" defaultValueNumeric="0">
+ <constraints nullable="false" />
+ </column>
+ <column name="requests" type="INT" defaultValueNumeric="0">
+ <constraints nullable="false" />
+ </column>
+ <column name="messagesreceived" type="INT" defaultValueNumeric="0">
+ <constraints nullable="false" />
+ </column>
+ <column name="messagesstored" type="INT" defaultValueNumeric="0">
+ <constraints nullable="false" />
+ </column>
+ <column name="attributes" type="VARCHAR(4096)">
+ <constraints nullable="false" />
+ </column>
+ <column name="mailsent" type="INT" defaultValueNumeric="0">
+ <constraints nullable="false" />
+ </column>
+ <column name="smssent" type="INT" defaultValueNumeric="0">
+ <constraints nullable="false" />
+ </column>
+ <column name="geocoderrequests" type="INT" defaultValueNumeric="0">
+ <constraints nullable="false" />
+ </column>
+ <column name="geolocationrequests" type="INT" defaultValueNumeric="0">
+ <constraints nullable="false" />
+ </column>
+ </createTable>
+
+ <createTable tableName="tc_user_attribute">
+ <column name="userid" type="INT">
+ <constraints nullable="false" />
+ </column>
+ <column name="attributeid" type="INT">
+ <constraints nullable="false" />
+ </column>
+ </createTable>
+
+ <createTable tableName="tc_user_calendar">
+ <column name="userid" type="INT">
+ <constraints nullable="false" />
+ </column>
+ <column name="calendarid" type="INT">
+ <constraints nullable="false" />
+ </column>
+ </createTable>
+
+ <createTable tableName="tc_user_command">
+ <column name="userid" type="INT">
+ <constraints nullable="false" />
+ </column>
+ <column name="commandid" type="INT">
+ <constraints nullable="false" />
+ </column>
+ </createTable>
+
+ <createTable tableName="tc_user_device">
+ <column name="userid" type="INT">
+ <constraints nullable="false" />
+ </column>
+ <column name="deviceid" type="INT">
+ <constraints nullable="false" />
+ </column>
+ </createTable>
+
+ <createTable tableName="tc_user_driver">
+ <column name="userid" type="INT">
+ <constraints nullable="false" />
+ </column>
+ <column name="driverid" type="INT">
+ <constraints nullable="false" />
+ </column>
+ </createTable>
+
+ <createTable tableName="tc_user_geofence">
+ <column name="userid" type="INT">
+ <constraints nullable="false" />
+ </column>
+ <column name="geofenceid" type="INT">
+ <constraints nullable="false" />
+ </column>
+ </createTable>
+
+ <createTable tableName="tc_user_group">
+ <column name="userid" type="INT">
+ <constraints nullable="false" />
+ </column>
+ <column name="groupid" type="INT">
+ <constraints nullable="false" />
+ </column>
+ </createTable>
+
+ <createTable tableName="tc_user_maintenance">
+ <column name="userid" type="INT">
+ <constraints nullable="false" />
+ </column>
+ <column name="maintenanceid" type="INT">
+ <constraints nullable="false" />
+ </column>
+ </createTable>
+
+ <createTable tableName="tc_user_notification">
+ <column name="userid" type="INT">
+ <constraints nullable="false" />
+ </column>
+ <column name="notificationid" type="INT">
+ <constraints nullable="false" />
+ </column>
+ </createTable>
+
+ <createTable tableName="tc_user_user">
+ <column name="userid" type="INT">
+ <constraints nullable="false" />
+ </column>
+ <column name="manageduserid" type="INT">
+ <constraints nullable="false" />
+ </column>
+ </createTable>
+
+ <createTable tableName="tc_users">
+ <column name="id" type="INT" autoIncrement="true">
+ <constraints primaryKey="true" />
+ </column>
+ <column name="name" type="VARCHAR(128)">
+ <constraints nullable="false" />
+ </column>
+ <column name="email" type="VARCHAR(128)">
+ <constraints nullable="false" unique="true" />
+ </column>
+ <column name="hashedpassword" type="VARCHAR(128)" />
+ <column name="salt" type="VARCHAR(128)" />
+ <column name="readonly" type="BOOLEAN" defaultValueBoolean="false">
+ <constraints nullable="false" />
+ </column>
+ <column name="administrator" type="BOOLEAN" />
+ <column name="map" type="VARCHAR(128)" />
+ <column name="latitude" type="DOUBLE" defaultValueNumeric="0">
+ <constraints nullable="false" />
+ </column>
+ <column name="longitude" type="DOUBLE" defaultValueNumeric="0">
+ <constraints nullable="false" />
+ </column>
+ <column name="zoom" type="INT" defaultValueNumeric="0">
+ <constraints nullable="false" />
+ </column>
+ <column name="twelvehourformat" type="BOOLEAN" defaultValueBoolean="false">
+ <constraints nullable="false" />
+ </column>
+ <column name="attributes" type="VARCHAR(4000)" />
+ <column name="coordinateformat" type="VARCHAR(128)" />
+ <column name="disabled" type="BOOLEAN" defaultValueBoolean="false" />
+ <column name="expirationtime" type="timestamp" />
+ <column name="devicelimit" type="INT" defaultValueNumeric="-1" />
+ <column name="token" type="VARCHAR(128)" />
+ <column name="userlimit" type="INT" defaultValueNumeric="0" />
+ <column name="devicereadonly" type="BOOLEAN" defaultValueBoolean="false" />
+ <column name="phone" type="VARCHAR(128)" />
+ <column name="limitcommands" type="BOOLEAN" defaultValueBoolean="false" />
+ <column name="login" type="VARCHAR(128)" />
+ <column name="poilayer" type="VARCHAR(512)" />
+ </createTable>
+
+ <addForeignKeyConstraint baseTableName="tc_device_command" baseColumnNames="commandid" constraintName="fk_device_command_commandid" onDelete="CASCADE" referencedColumnNames="id" referencedTableName="tc_commands" />
+ <addForeignKeyConstraint baseTableName="tc_device_command" baseColumnNames="deviceid" constraintName="fk_device_command_deviceid" onDelete="CASCADE" referencedColumnNames="id" referencedTableName="tc_devices" />
+
+ <addForeignKeyConstraint baseTableName="tc_device_driver" baseColumnNames="deviceid" constraintName="fk_device_driver_deviceid" onDelete="CASCADE" referencedColumnNames="id" referencedTableName="tc_devices" />
+ <addForeignKeyConstraint baseTableName="tc_device_driver" baseColumnNames="driverid" constraintName="fk_device_driver_driverid" onDelete="CASCADE" referencedColumnNames="id" referencedTableName="tc_drivers" />
+
+ <addForeignKeyConstraint baseTableName="tc_device_geofence" baseColumnNames="deviceid" constraintName="fk_device_geofence_deviceid" onDelete="CASCADE" referencedColumnNames="id" referencedTableName="tc_devices" />
+ <addForeignKeyConstraint baseTableName="tc_device_geofence" baseColumnNames="geofenceid" constraintName="fk_device_geofence_geofenceid" onDelete="CASCADE" referencedColumnNames="id" referencedTableName="tc_geofences" />
+
+ <addForeignKeyConstraint baseTableName="tc_device_maintenance" baseColumnNames="deviceid" constraintName="fk_device_maintenance_deviceid" onDelete="CASCADE" referencedColumnNames="id" referencedTableName="tc_devices" />
+ <addForeignKeyConstraint baseTableName="tc_device_maintenance" baseColumnNames="maintenanceid" constraintName="fk_device_maintenance_maintenanceid" onDelete="CASCADE" referencedColumnNames="id" referencedTableName="tc_maintenances" />
+
+ <addForeignKeyConstraint baseTableName="tc_device_notification" baseColumnNames="deviceid" constraintName="fk_device_notification_deviceid" onDelete="CASCADE" referencedColumnNames="id" referencedTableName="tc_devices" />
+ <addForeignKeyConstraint baseTableName="tc_device_notification" baseColumnNames="notificationid" constraintName="fk_device_notification_notificationid" onDelete="CASCADE" referencedColumnNames="id" referencedTableName="tc_notifications" />
+
+ <addForeignKeyConstraint baseTableName="tc_devices" baseColumnNames="groupid" constraintName="fk_devices_groupid" onDelete="SET NULL" referencedColumnNames="id" referencedTableName="tc_groups" />
+
+ <addForeignKeyConstraint baseTableName="tc_events" baseColumnNames="deviceid" constraintName="fk_events_deviceid" onDelete="CASCADE" referencedColumnNames="id" referencedTableName="tc_devices" />
+
+ <addForeignKeyConstraint baseTableName="tc_geofences" baseColumnNames="calendarid" constraintName="fk_geofence_calendar_calendarid" onDelete="SET NULL" referencedColumnNames="id" referencedTableName="tc_calendars" />
+
+ <addForeignKeyConstraint baseTableName="tc_group_attribute" baseColumnNames="attributeid" constraintName="fk_group_attribute_attributeid" onDelete="CASCADE" referencedColumnNames="id" referencedTableName="tc_attributes" />
+ <addForeignKeyConstraint baseTableName="tc_group_attribute" baseColumnNames="groupid" constraintName="fk_group_attribute_groupid" onDelete="CASCADE" referencedColumnNames="id" referencedTableName="tc_groups" />
+
+ <addForeignKeyConstraint baseTableName="tc_group_command" baseColumnNames="commandid" constraintName="fk_group_command_commandid" onDelete="CASCADE" referencedColumnNames="id" referencedTableName="tc_commands" />
+ <addForeignKeyConstraint baseTableName="tc_group_command" baseColumnNames="groupid" constraintName="fk_group_command_groupid" onDelete="CASCADE" referencedColumnNames="id" referencedTableName="tc_groups" />
+
+ <addForeignKeyConstraint baseTableName="tc_group_driver" baseColumnNames="driverid" constraintName="fk_group_driver_driverid" onDelete="CASCADE" referencedColumnNames="id" referencedTableName="tc_drivers" />
+ <addForeignKeyConstraint baseTableName="tc_group_driver" baseColumnNames="groupid" constraintName="fk_group_driver_groupid" onDelete="CASCADE" referencedColumnNames="id" referencedTableName="tc_groups" />
+
+ <addForeignKeyConstraint baseTableName="tc_group_geofence" baseColumnNames="geofenceid" constraintName="fk_group_geofence_geofenceid" onDelete="CASCADE" referencedColumnNames="id" referencedTableName="tc_geofences" />
+ <addForeignKeyConstraint baseTableName="tc_group_geofence" baseColumnNames="groupid" constraintName="fk_group_geofence_groupid" onDelete="CASCADE" referencedColumnNames="id" referencedTableName="tc_groups" />
+
+ <addForeignKeyConstraint baseTableName="tc_group_maintenance" baseColumnNames="groupid" constraintName="fk_group_maintenance_groupid" onDelete="CASCADE" referencedColumnNames="id" referencedTableName="tc_groups" />
+ <addForeignKeyConstraint baseTableName="tc_group_maintenance" baseColumnNames="maintenanceid" constraintName="fk_group_maintenance_maintenanceid" onDelete="CASCADE" referencedColumnNames="id" referencedTableName="tc_maintenances" />
+
+ <addForeignKeyConstraint baseTableName="tc_group_notification" baseColumnNames="groupid" constraintName="fk_group_notification_groupid" onDelete="CASCADE" referencedColumnNames="id" referencedTableName="tc_groups" />
+ <addForeignKeyConstraint baseTableName="tc_group_notification" baseColumnNames="notificationid" constraintName="fk_group_notification_notificationid" onDelete="CASCADE" referencedColumnNames="id" referencedTableName="tc_notifications" />
+
+ <addForeignKeyConstraint baseTableName="tc_notifications" baseColumnNames="calendarid" constraintName="fk_notification_calendar_calendarid" onDelete="SET NULL" onUpdate="RESTRICT" referencedColumnNames="id" referencedTableName="tc_calendars" />
+
+ <addForeignKeyConstraint baseTableName="tc_positions" baseColumnNames="deviceid" constraintName="fk_positions_deviceid" onDelete="CASCADE" referencedColumnNames="id" referencedTableName="tc_devices" />
+
+ <addForeignKeyConstraint baseTableName="tc_user_attribute" baseColumnNames="attributeid" constraintName="fk_user_attribute_attributeid" onDelete="CASCADE" referencedColumnNames="id" referencedTableName="tc_attributes" />
+ <addForeignKeyConstraint baseTableName="tc_user_attribute" baseColumnNames="userid" constraintName="fk_user_attribute_userid" onDelete="CASCADE" referencedColumnNames="id" referencedTableName="tc_users" />
+
+ <addForeignKeyConstraint baseTableName="tc_user_calendar" baseColumnNames="calendarid" constraintName="fk_user_calendar_calendarid" onDelete="CASCADE" referencedColumnNames="id" referencedTableName="tc_calendars" />
+ <addForeignKeyConstraint baseTableName="tc_user_calendar" baseColumnNames="userid" constraintName="fk_user_calendar_userid" onDelete="CASCADE" referencedColumnNames="id" referencedTableName="tc_users" />
+
+ <addForeignKeyConstraint baseTableName="tc_user_command" baseColumnNames="commandid" constraintName="fk_user_command_commandid" onDelete="CASCADE" referencedColumnNames="id" referencedTableName="tc_commands" />
+ <addForeignKeyConstraint baseTableName="tc_user_command" baseColumnNames="userid" constraintName="fk_user_command_userid" onDelete="CASCADE" referencedColumnNames="id" referencedTableName="tc_users" />
+
+ <addForeignKeyConstraint baseTableName="tc_device_attribute" baseColumnNames="attributeid" constraintName="fk_user_device_attribute_attributeid" onDelete="CASCADE" referencedColumnNames="id" referencedTableName="tc_attributes" />
+ <addForeignKeyConstraint baseTableName="tc_device_attribute" baseColumnNames="deviceid" constraintName="fk_user_device_attribute_deviceid" onDelete="CASCADE" referencedColumnNames="id" referencedTableName="tc_devices" />
+
+ <addForeignKeyConstraint baseTableName="tc_user_device" baseColumnNames="deviceid" constraintName="fk_user_device_deviceid" onDelete="CASCADE" referencedColumnNames="id" referencedTableName="tc_devices" />
+ <addForeignKeyConstraint baseTableName="tc_user_device" baseColumnNames="userid" constraintName="fk_user_device_userid" onDelete="CASCADE" referencedColumnNames="id" referencedTableName="tc_users" />
+
+ <addForeignKeyConstraint baseTableName="tc_user_driver" baseColumnNames="driverid" constraintName="fk_user_driver_driverid" onDelete="CASCADE" referencedColumnNames="id" referencedTableName="tc_drivers" />
+ <addForeignKeyConstraint baseTableName="tc_user_driver" baseColumnNames="userid" constraintName="fk_user_driver_userid" onDelete="CASCADE" referencedColumnNames="id" referencedTableName="tc_users" />
+
+ <addForeignKeyConstraint baseTableName="tc_user_geofence" baseColumnNames="geofenceid" constraintName="fk_user_geofence_geofenceid" onDelete="CASCADE" referencedColumnNames="id" referencedTableName="tc_geofences" />
+ <addForeignKeyConstraint baseTableName="tc_user_geofence" baseColumnNames="userid" constraintName="fk_user_geofence_userid" onDelete="CASCADE" referencedColumnNames="id" referencedTableName="tc_users" />
+
+ <addForeignKeyConstraint baseTableName="tc_user_group" baseColumnNames="groupid" constraintName="fk_user_group_groupid" onDelete="CASCADE" referencedColumnNames="id" referencedTableName="tc_groups" />
+ <addForeignKeyConstraint baseTableName="tc_user_group" baseColumnNames="userid" constraintName="fk_user_group_userid" onDelete="CASCADE" referencedColumnNames="id" referencedTableName="tc_users" />
+
+ <addForeignKeyConstraint baseTableName="tc_user_maintenance" baseColumnNames="maintenanceid" constraintName="fk_user_maintenance_maintenanceid" onDelete="CASCADE" referencedColumnNames="id" referencedTableName="tc_maintenances" />
+ <addForeignKeyConstraint baseTableName="tc_user_maintenance" baseColumnNames="userid" constraintName="fk_user_maintenance_userid" onDelete="CASCADE" referencedColumnNames="id" referencedTableName="tc_users" />
+
+ <addForeignKeyConstraint baseTableName="tc_user_notification" baseColumnNames="notificationid" constraintName="fk_user_notification_notificationid" onDelete="CASCADE" referencedColumnNames="id" referencedTableName="tc_notifications" />
+ <addForeignKeyConstraint baseTableName="tc_user_notification" baseColumnNames="userid" constraintName="fk_user_notification_userid" onDelete="CASCADE" referencedColumnNames="id" referencedTableName="tc_users" />
+
+ <addForeignKeyConstraint baseTableName="tc_user_user" baseColumnNames="userid" constraintName="fk_user_user_userid" onDelete="CASCADE" referencedColumnNames="id" referencedTableName="tc_users" />
+
+ <insert tableName="tc_servers">
+ <column name="registration" valueBoolean="true" />
+ <column name="latitude" valueNumeric="0" />
+ <column name="longitude" valueNumeric="0" />
+ <column name="zoom" valueNumeric="0" />
+ </insert>
+
+ <insert tableName="tc_users">
+ <column name="name" value="admin" />
+ <column name="email" value="admin" />
+ <column name="hashedpassword" value="D33DCA55ABD4CC5BC76F2BC0B4E603FE2C6F61F4C1EF2D47" />
+ <column name="salt" value="000000000000000000000000000000000000000000000000" />
+ <column name="administrator" valueBoolean="true" />
+ </insert>
+
+ </changeSet>
+
+ <changeSet author="author" id="changelog-4.0-clean-common">
+
+ <preConditions onFail="MARK_RAN">
+ <not>
+ <changeSetExecuted changeLogFile="changelog-3.3" id="changelog-3.3" author="author" />
+ </not>
+ <not>
+ <dbms type="mssql" />
+ </not>
+ </preConditions>
+
+ <addForeignKeyConstraint baseTableName="tc_groups" baseColumnNames="groupid" constraintName="fk_groups_groupid" onDelete="SET NULL" onUpdate="RESTRICT" referencedColumnNames="id" referencedTableName="tc_groups" />
+ <addForeignKeyConstraint baseTableName="tc_user_user" baseColumnNames="manageduserid" constraintName="fk_user_user_manageduserid" onDelete="CASCADE" referencedColumnNames="id" referencedTableName="tc_users" />
+
+ </changeSet>
+
+ <changeSet author="author" id="changelog-4.0-clean-mssql">
+
+ <preConditions onFail="MARK_RAN">
+ <not>
+ <changeSetExecuted changeLogFile="changelog-3.3" id="changelog-3.3" author="author" />
+ </not>
+ <dbms type="mssql" />
+ </preConditions>
+
+ <sql>
+ CREATE TRIGGER tg_groups_delete
+ ON tc_groups FOR DELETE
+ AS BEGIN
+ UPDATE tc_groups SET groupid = NULL WHERE groupid IN (SELECT deleted.id FROM deleted)
+ END
+ </sql>
+
+ <sql>
+ CREATE TRIGGER tg_users_delete
+ ON tc_users FOR DELETE
+ AS BEGIN
+ DELETE FROM tc_user_user WHERE manageduserid IN (SELECT deleted.id FROM deleted)
+ END
+ </sql>
+
+ </changeSet>
+
+</databaseChangeLog>
diff --git a/schema/changelog-4.0.xml b/schema/changelog-4.0.xml
index d1944c4f5..337cdc884 100644
--- a/schema/changelog-4.0.xml
+++ b/schema/changelog-4.0.xml
@@ -54,8 +54,12 @@
</changeSet>
<changeSet author="author" id="changelog-4.0-pre">
+
<preConditions onFail="MARK_RAN">
<not>
+ <tableExists tableName="tc_servers" />
+ </not>
+ <not>
<columnExists tableName="tc_notifications" columnName="notificators" />
</not>
</preConditions>
@@ -70,6 +74,9 @@
<preConditions onFail="MARK_RAN">
<not>
+ <tableExists tableName="tc_servers" />
+ </not>
+ <not>
<dbms type="postgresql" />
</not>
<columnExists tableName="tc_notifications" columnName="web" />
@@ -78,38 +85,38 @@
</preConditions>
<update tableName="tc_notifications">
- <column name="notificators" value="web,mail,sms" />
- <where>web = 1 AND mail = 1 AND sms = 1</where>
+ <column name="notificators" value="web,mail,sms" />
+ <where>web = 1 AND mail = 1 AND sms = 1</where>
</update>
<update tableName="tc_notifications">
- <column name="notificators" value="web,mail" />
- <where>web = 1 AND mail = 1 AND sms = 0</where>
+ <column name="notificators" value="web,mail" />
+ <where>web = 1 AND mail = 1 AND sms = 0</where>
</update>
<update tableName="tc_notifications">
- <column name="notificators" value="web" />
- <where>web = 1 AND mail = 0 AND sms = 0</where>
+ <column name="notificators" value="web" />
+ <where>web = 1 AND mail = 0 AND sms = 0</where>
</update>
<update tableName="tc_notifications">
- <column name="notificators" value="web,sms" />
- <where>web = 1 AND mail = 0 AND sms = 1</where>
+ <column name="notificators" value="web,sms" />
+ <where>web = 1 AND mail = 0 AND sms = 1</where>
</update>
<update tableName="tc_notifications">
- <column name="notificators" value="mail,sms" />
- <where>web = 0 AND mail = 1 AND sms = 1</where>
+ <column name="notificators" value="mail,sms" />
+ <where>web = 0 AND mail = 1 AND sms = 1</where>
</update>
<update tableName="tc_notifications">
- <column name="notificators" value="mail" />
- <where>web = 0 AND mail = 1 AND sms = 0</where>
+ <column name="notificators" value="mail" />
+ <where>web = 0 AND mail = 1 AND sms = 0</where>
</update>
<update tableName="tc_notifications">
- <column name="notificators" value="sms" />
- <where>web = 0 AND mail = 0 AND sms = 1</where>
+ <column name="notificators" value="sms" />
+ <where>web = 0 AND mail = 0 AND sms = 1</where>
</update>
</changeSet>
@@ -117,6 +124,9 @@
<changeSet author="author" id="changelog-4.0-pg">
<preConditions onFail="MARK_RAN">
+ <not>
+ <tableExists tableName="tc_servers" />
+ </not>
<dbms type="postgresql" />
<columnExists tableName="tc_notifications" columnName="web" />
<columnExists tableName="tc_notifications" columnName="mail" />
@@ -124,44 +134,50 @@
</preConditions>
<update tableName="tc_notifications">
- <column name="notificators" value="web,mail,sms" />
- <where>web = TRUE AND mail = TRUE AND sms = TRUE</where>
+ <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>
+ <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>
+ <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>
+ <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>
+ <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>
+ <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>
+ <column name="notificators" value="sms" />
+ <where>web = FALSE AND mail = FALSE AND sms = TRUE</where>
</update>
</changeSet>
<changeSet author="author" id="changelog-4.0">
+ <preConditions onFail="MARK_RAN">
+ <not>
+ <tableExists tableName="tc_servers" />
+ </not>
+ </preConditions>
+
<dropDefaultValue tableName="tc_notifications" columnName="web" />
<dropColumn tableName="tc_notifications" columnName="web" />
diff --git a/schema/changelog-master.xml b/schema/changelog-master.xml
index e8fbc0c4b..c14a2b4d4 100644
--- a/schema/changelog-master.xml
+++ b/schema/changelog-master.xml
@@ -5,6 +5,8 @@
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.4.xsd">
+ <include file="changelog-4.0-clean.xml" relativeToChangelogFile="true" />
+
<include file="changelog-3.3.xml" relativeToChangelogFile="true" />
<include file="changelog-3.5.xml" relativeToChangelogFile="true" />
<include file="changelog-3.6.xml" relativeToChangelogFile="true" />
@@ -19,4 +21,5 @@
<include file="changelog-3.16.xml" relativeToChangelogFile="true" />
<include file="changelog-3.17.xml" relativeToChangelogFile="true" />
<include file="changelog-4.0.xml" relativeToChangelogFile="true" />
+
</databaseChangeLog>