aboutsummaryrefslogtreecommitdiff
path: root/database
diff options
context:
space:
mode:
authorHans van den Elsen <hans.elsen@esds.nl>2016-03-11 22:16:25 +0100
committerHans van den Elsen <hans.elsen@esds.nl>2016-03-11 22:16:25 +0100
commit4606737cc07b736f9c8f98ae680b928c94c082c8 (patch)
treebdd29b24a16403b1e8a3d7cd4325391063b34b8a /database
parent3ced99384b1967f5cde9abdf30c1c0184a5ae3f6 (diff)
parentab5d21e16ac44957e04da0f06daf148af95e96be (diff)
downloadtrackermap-server-4606737cc07b736f9c8f98ae680b928c94c082c8.tar.gz
trackermap-server-4606737cc07b736f9c8f98ae680b928c94c082c8.tar.bz2
trackermap-server-4606737cc07b736f9c8f98ae680b928c94c082c8.zip
Merge remote-tracking branch 'refs/remotes/tananaev/master'
Diffstat (limited to 'database')
-rw-r--r--database/changelog-3.3.xml (renamed from database/db.changelog-3.0.xml)128
-rw-r--r--database/changelog-3.5.xml37
-rw-r--r--database/changelog-master.xml10
-rw-r--r--database/db.changelog-3.1.xml131
-rw-r--r--database/db.changelog-3.2.xml63
-rw-r--r--database/db.changelog-3.3.xml32
-rw-r--r--database/db.changelog-master.xml13
-rw-r--r--database/db.changelog-normalize.xml114
8 files changed, 101 insertions, 427 deletions
diff --git a/database/db.changelog-3.0.xml b/database/changelog-3.3.xml
index 453f6f00b..1893a0200 100644
--- a/database/db.changelog-3.0.xml
+++ b/database/changelog-3.3.xml
@@ -5,28 +5,28 @@
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.4.xsd">
- <changeSet author="author" id="changelog-3.0">
+ <changeSet author="author" id="changelog-3.3">
<preConditions onFail="MARK_RAN">
<not>
- <tableExists tableName="traccar" />
+ <tableExists tableName="server" />
</not>
</preConditions>
- <createTable tableName="user">
+ <createTable tableName="users">
<column name="id" type="INT" autoIncrement="true">
<constraints primaryKey="true" />
</column>
- <column name="name" type="VARCHAR(1024)">
+ <column name="name" type="VARCHAR(128)">
<constraints nullable="false" />
</column>
- <column name="email" type="VARCHAR(256)">
+ <column name="email" type="VARCHAR(128)">
<constraints nullable="false" />
</column>
- <column name="hashedPassword" type="VARCHAR(1024)">
+ <column name="hashedpassword" type="VARCHAR(128)">
<constraints nullable="false" />
</column>
- <column name="salt" type="VARCHAR(1024)" defaultValue="">
+ <column name="salt" type="VARCHAR(128)">
<constraints nullable="false" />
</column>
<column name="readonly" type="BOOLEAN" defaultValueBoolean="false">
@@ -35,16 +35,16 @@
<column name="admin" type="BOOLEAN" defaultValueBoolean="false">
<constraints nullable="false" />
</column>
- <column name="map" type="VARCHAR(1024)" defaultValue="osm">
+ <column name="map" type="VARCHAR(128)" defaultValue="osm">
<constraints nullable="false" />
</column>
- <column name="language" type="VARCHAR(1024)" defaultValue="en">
+ <column name="language" type="VARCHAR(128)" defaultValue="en">
<constraints nullable="false" />
</column>
- <column name="distanceUnit" type="VARCHAR(1024)" defaultValue="km">
+ <column name="distanceunit" type="VARCHAR(128)" defaultValue="km">
<constraints nullable="false" />
</column>
- <column name="speedUnit" type="VARCHAR(1024)" defaultValue="kmh">
+ <column name="speedunit" type="VARCHAR(128)" defaultValue="kmh">
<constraints nullable="false" />
</column>
<column name="latitude" type="DOUBLE" defaultValueNumeric="0">
@@ -58,63 +58,56 @@
</column>
</createTable>
- <addUniqueConstraint tableName="user" columnNames="email" constraintName="uk_user_email" />
+ <addUniqueConstraint tableName="users" columnNames="email" constraintName="uk_user_email" />
- <createTable tableName="device">
+ <createTable tableName="devices">
<column name="id" type="INT" autoIncrement="true">
<constraints primaryKey="true" />
</column>
- <column name="name" type="VARCHAR(1024)">
+ <column name="name" type="VARCHAR(128)">
<constraints nullable="false" />
</column>
- <column name="uniqueId" type="VARCHAR(256)">
+ <column name="uniqueid" type="VARCHAR(128)">
<constraints nullable="false" />
</column>
- <column name="status" type="VARCHAR(1024)" />
- <column name="lastUpdate" type="TIMESTAMP" />
- <column name="positionId" type="INT" />
- <column name="dataId" type="INT" />
+ <column name="status" type="VARCHAR(128)" />
+ <column name="lastupdate" type="TIMESTAMP" />
+ <column name="positionid" type="INT" />
</createTable>
- <addUniqueConstraint tableName="device" columnNames="uniqueId" constraintName="uk_device_uniqueId" />
+ <addUniqueConstraint tableName="devices" columnNames="uniqueid" constraintName="uk_device_uniqueid" />
<createTable tableName="user_device">
- <column name="userId" type="INT">
+ <column name="userid" type="INT">
<constraints nullable="false" />
</column>
- <column name="deviceId" type="INT">
- <constraints nullable="false" />
- </column>
- <column name="read" type="BOOLEAN" defaultValueBoolean="true">
- <constraints nullable="false" />
- </column>
- <column name="write" type="BOOLEAN" defaultValueBoolean="true">
+ <column name="deviceid" type="INT">
<constraints nullable="false" />
</column>
</createTable>
- <addForeignKeyConstraint baseTableName="user_device" baseColumnNames="userId" constraintName="fk_user_device_userId" referencedTableName="user" referencedColumnNames="id" onDelete="CASCADE" />
- <addForeignKeyConstraint baseTableName="user_device" baseColumnNames="deviceId" constraintName="fk_user_device_deviceId" referencedTableName="device" referencedColumnNames="id" onDelete="CASCADE" />
+ <addForeignKeyConstraint baseTableName="user_device" baseColumnNames="userid" constraintName="fk_user_device_userid" referencedTableName="users" referencedColumnNames="id" onDelete="CASCADE" />
+ <addForeignKeyConstraint baseTableName="user_device" baseColumnNames="deviceid" constraintName="fk_user_device_deviceid" referencedTableName="devices" referencedColumnNames="id" onDelete="CASCADE" />
<createIndex tableName="user_device" indexName="user_device_user_id">
- <column name="userId" />
+ <column name="userid" />
</createIndex>
- <createTable tableName="position">
+ <createTable tableName="positions">
<column name="id" type="INT" autoIncrement="true">
<constraints primaryKey="true" />
</column>
- <column name="protocol" type="VARCHAR(1024)" />
- <column name="deviceId" type="int">
+ <column name="protocol" type="VARCHAR(128)" />
+ <column name="deviceid" type="int">
<constraints nullable="false" />
</column>
- <column name="serverTime" type="TIMESTAMP">
+ <column name="servertime" type="TIMESTAMP">
<constraints nullable="false" />
</column>
- <column name="deviceTime" type="TIMESTAMP">
+ <column name="devicetime" type="TIMESTAMP">
<constraints nullable="false" />
</column>
- <column name="fixTime" type="TIMESTAMP">
+ <column name="fixtime" type="TIMESTAMP">
<constraints nullable="false" />
</column>
<column name="valid" type="BOOLEAN">
@@ -126,65 +119,52 @@
<column name="longitude" type="DOUBLE">
<constraints nullable="false" />
</column>
- <column name="altitude" type="DOUBLE">
+ <column name="altitude" type="FLOAT">
<constraints nullable="false" />
</column>
- <column name="speed" type="DOUBLE">
+ <column name="speed" type="FLOAT">
<constraints nullable="false" />
</column>
- <column name="course" type="DOUBLE">
+ <column name="course" type="FLOAT">
<constraints nullable="false" />
</column>
- <column name="address" type="VARCHAR(1024)" />
- <column name="other" type="VARCHAR(8192)">
+ <column name="address" type="VARCHAR(512)" />
+ <column name="attributes" type="VARCHAR(4096)">
<constraints nullable="false" />
</column>
</createTable>
- <addForeignKeyConstraint baseTableName="position" baseColumnNames="deviceId" constraintName="fk_position_deviceId" referencedTableName="device" referencedColumnNames="id" onDelete="CASCADE" />
+ <addForeignKeyConstraint baseTableName="positions" baseColumnNames="deviceid" constraintName="fk_position_deviceid" referencedTableName="devices" referencedColumnNames="id" onDelete="CASCADE" />
- <createTable tableName="data">
- <column name="id" type="INT" autoIncrement="true">
- <constraints primaryKey="true" />
- </column>
- <column name="protocol" type="VARCHAR(1024)" />
- <column name="deviceId" type="int">
- <constraints nullable="false" />
- </column>
- <column name="serverTime" type="TIMESTAMP">
- <constraints nullable="false" />
- </column>
- <column name="deviceTime" type="TIMESTAMP">
- <constraints nullable="false" />
- </column>
- <column name="other" type="VARCHAR(8192)">
- <constraints nullable="false" />
- </column>
- </createTable>
-
- <addForeignKeyConstraint baseTableName="data" baseColumnNames="deviceId" constraintName="fk_data_deviceId" referencedTableName="device" referencedColumnNames="id" onDelete="CASCADE" />
+ <createIndex tableName="positions" indexName="position_deviceid_fixtime">
+ <column name="deviceid" />
+ <column name="fixtime" />
+ </createIndex>
<createTable tableName="server">
<column name="id" type="INT" autoIncrement="true">
<constraints primaryKey="true" />
</column>
- <column name="registration" type="BOOLEAN">
+ <column name="registration" type="BOOLEAN" defaultValueBoolean="true">
<constraints nullable="false" />
</column>
- <column name="latitude" type="DOUBLE">
+ <column name="latitude" type="DOUBLE" defaultValueNumeric="0">
<constraints nullable="false" />
</column>
- <column name="longitude" type="DOUBLE">
+ <column name="longitude" type="DOUBLE" defaultValueNumeric="0">
<constraints nullable="false" />
</column>
- <column name="zoom" type="INT">
+ <column name="zoom" type="INT" defaultValueNumeric="0">
<constraints nullable="false" />
</column>
- </createTable>
-
- <createTable tableName="traccar">
- <column name="id" type="INT" autoIncrement="true">
- <constraints primaryKey="true" />
+ <column name="map" type="VARCHAR(128)" />
+ <column name="language" type="VARCHAR(128)" />
+ <column name="distanceunit" type="VARCHAR(128)" />
+ <column name="speedunit" type="VARCHAR(128)" />
+ <column name="bingkey" type="VARCHAR(128)" />
+ <column name="mapurl" type="VARCHAR(128)" />
+ <column name="readonly" type="BOOLEAN" defaultValueBoolean="false">
+ <constraints nullable="false" />
</column>
</createTable>
@@ -195,10 +175,10 @@
<column name="zoom" valueNumeric="0" />
</insert>
- <insert tableName="user">
+ <insert tableName="users">
<column name="name" value="admin" />
<column name="email" value="admin" />
- <column name="hashedPassword" value="D33DCA55ABD4CC5BC76F2BC0B4E603FE2C6F61F4C1EF2D47" />
+ <column name="hashedpassword" value="D33DCA55ABD4CC5BC76F2BC0B4E603FE2C6F61F4C1EF2D47" />
<column name="salt" value="000000000000000000000000000000000000000000000000" />
<column name="admin" valueBoolean="true" />
</insert>
diff --git a/database/changelog-3.5.xml b/database/changelog-3.5.xml
new file mode 100644
index 000000000..f1af6ef10
--- /dev/null
+++ b/database/changelog-3.5.xml
@@ -0,0 +1,37 @@
+<?xml version="1.0" 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.4.xsd">
+
+ <changeSet author="author" id="changelog-3.5">
+
+ <createTable tableName="groups">
+ <column name="id" type="INT" autoIncrement="true">
+ <constraints primaryKey="true" />
+ </column>
+ <column name="name" type="VARCHAR(128)">
+ <constraints nullable="false" />
+ </column>
+ <column name="groupid" type="INT" />
+ </createTable>
+
+ <createTable tableName="user_group">
+ <column name="userid" type="INT">
+ <constraints nullable="false" />
+ </column>
+ <column name="groupid" type="INT">
+ <constraints nullable="false" />
+ </column>
+ </createTable>
+
+ <addForeignKeyConstraint baseTableName="user_group" baseColumnNames="userid" constraintName="fk_user_group_userid" referencedTableName="users" referencedColumnNames="id" onDelete="CASCADE" />
+ <addForeignKeyConstraint baseTableName="user_group" baseColumnNames="groupid" constraintName="fk_user_group_groupid" referencedTableName="groups" referencedColumnNames="id" onDelete="CASCADE" />
+
+ <addColumn tableName="devices">
+ <column name="groupid" type="INT" />
+ </addColumn>
+
+ </changeSet>
+</databaseChangeLog>
diff --git a/database/changelog-master.xml b/database/changelog-master.xml
new file mode 100644
index 000000000..269a0da1a
--- /dev/null
+++ b/database/changelog-master.xml
@@ -0,0 +1,10 @@
+<?xml version="1.0" 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.4.xsd">
+
+ <include file="changelog-3.3.xml" relativeToChangelogFile="true" />
+ <include file="changelog-3.5.xml" relativeToChangelogFile="true" />
+</databaseChangeLog>
diff --git a/database/db.changelog-3.1.xml b/database/db.changelog-3.1.xml
deleted file mode 100644
index 740da4e2f..000000000
--- a/database/db.changelog-3.1.xml
+++ /dev/null
@@ -1,131 +0,0 @@
-<?xml version="1.0" 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.4.xsd">
-
- <changeSet author="author" id="changelog-3.1">
-
- <preConditions onFail="MARK_RAN">
- <not>
- <columnExists tableName="traccar" columnName="version" />
- </not>
- </preConditions>
-
- <dropNotNullConstraint tableName="user" columnName="name" columnDataType="VARCHAR(1024)" />
- <modifyDataType tableName="user" columnName="name" newDataType="VARCHAR(128)" />
- <addNotNullConstraint tableName="user" columnName="name" columnDataType="VARCHAR(128)" />
- <dropUniqueConstraint tableName="user" uniqueColumns="email" constraintName="uk_user_email" />
- <dropNotNullConstraint tableName="user" columnName="email" columnDataType="VARCHAR(256)" />
- <modifyDataType tableName="user" columnName="email" newDataType="VARCHAR(128)" />
- <addNotNullConstraint tableName="user" columnName="email" columnDataType="VARCHAR(128)" />
- <addUniqueConstraint tableName="user" columnNames="email" constraintName="uk_user_email" />
- <dropNotNullConstraint tableName="user" columnName="hashedPassword" columnDataType="VARCHAR(1024)" />
- <modifyDataType tableName="user" columnName="hashedPassword" newDataType="VARCHAR(128)" />
- <addNotNullConstraint tableName="user" columnName="hashedPassword" columnDataType="VARCHAR(128)" />
- <dropDefaultValue tableName="user" columnName="salt" />
- <dropNotNullConstraint tableName="user" columnName="salt" columnDataType="VARCHAR(1024)" />
- <modifyDataType tableName="user" columnName="salt" newDataType="VARCHAR(128)" />
- <addNotNullConstraint tableName="user" columnName="salt" columnDataType="VARCHAR(128)" />
- <addDefaultValue tableName="user" columnName="salt" defaultValue="" />
- <dropDefaultValue tableName="user" columnName="map" />
- <dropNotNullConstraint tableName="user" columnName="map" columnDataType="VARCHAR(128)" />
- <modifyDataType tableName="user" columnName="map" newDataType="VARCHAR(128)" />
- <dropDefaultValue tableName="user" columnName="language" />
- <dropNotNullConstraint tableName="user" columnName="language" columnDataType="VARCHAR(128)" />
- <modifyDataType tableName="user" columnName="language" newDataType="VARCHAR(128)" />
- <dropDefaultValue tableName="user" columnName="distanceUnit" />
- <dropNotNullConstraint tableName="user" columnName="distanceUnit" columnDataType="VARCHAR(128)" />
- <modifyDataType tableName="user" columnName="distanceUnit" newDataType="VARCHAR(128)" />
- <dropDefaultValue tableName="user" columnName="speedUnit" />
- <dropNotNullConstraint tableName="user" columnName="speedUnit" columnDataType="VARCHAR(128)" />
- <modifyDataType tableName="user" columnName="speedUnit" newDataType="VARCHAR(128)" />
- <dropDefaultValue tableName="user" columnName="latitude" />
- <dropNotNullConstraint tableName="user" columnName="latitude" columnDataType="DOUBLE" />
- <modifyDataType tableName="user" columnName="latitude" newDataType="FLOAT" />
- <addNotNullConstraint tableName="user" columnName="latitude" columnDataType="FLOAT" />
- <addDefaultValue tableName="user" columnName="latitude" defaultValueNumeric="0" />
- <dropDefaultValue tableName="user" columnName="longitude" />
- <dropNotNullConstraint tableName="user" columnName="longitude" columnDataType="DOUBLE" />
- <modifyDataType tableName="user" columnName="longitude" newDataType="FLOAT" />
- <addNotNullConstraint tableName="user" columnName="longitude" columnDataType="FLOAT" />
- <addDefaultValue tableName="user" columnName="longitude" defaultValueNumeric="0" />
-
- <dropNotNullConstraint tableName="device" columnName="name" columnDataType="VARCHAR(1024)" />
- <modifyDataType tableName="device" columnName="name" newDataType="VARCHAR(128)" />
- <addNotNullConstraint tableName="device" columnName="name" columnDataType="VARCHAR(128)" />
- <dropUniqueConstraint tableName="device" uniqueColumns="uniqueId" constraintName="uk_device_uniqueId" />
- <dropNotNullConstraint tableName="device" columnName="uniqueId" columnDataType="VARCHAR(256)" />
- <modifyDataType tableName="device" columnName="uniqueId" newDataType="VARCHAR(128)" />
- <addNotNullConstraint tableName="device" columnName="uniqueId" columnDataType="VARCHAR(128)" />
- <addUniqueConstraint tableName="device" columnNames="uniqueId" constraintName="uk_device_uniqueId" />
- <modifyDataType tableName="device" columnName="status" newDataType="VARCHAR(128)" />
-
- <modifyDataType tableName="position" columnName="protocol" newDataType="VARCHAR(128)" />
- <dropNotNullConstraint tableName="position" columnName="latitude" columnDataType="DOUBLE" />
- <modifyDataType tableName="position" columnName="latitude" newDataType="FLOAT" />
- <addNotNullConstraint tableName="position" columnName="latitude" columnDataType="FLOAT" />
- <dropNotNullConstraint tableName="position" columnName="longitude" columnDataType="DOUBLE" />
- <modifyDataType tableName="position" columnName="longitude" newDataType="FLOAT" />
- <addNotNullConstraint tableName="position" columnName="longitude" columnDataType="FLOAT" />
- <dropNotNullConstraint tableName="position" columnName="altitude" columnDataType="DOUBLE" />
- <modifyDataType tableName="position" columnName="altitude" newDataType="FLOAT" />
- <addNotNullConstraint tableName="position" columnName="altitude" columnDataType="FLOAT" />
- <dropNotNullConstraint tableName="position" columnName="speed" columnDataType="DOUBLE" />
- <modifyDataType tableName="position" columnName="speed" newDataType="FLOAT" />
- <addNotNullConstraint tableName="position" columnName="speed" columnDataType="FLOAT" />
- <dropNotNullConstraint tableName="position" columnName="course" columnDataType="DOUBLE" />
- <modifyDataType tableName="position" columnName="course" newDataType="FLOAT" />
- <addNotNullConstraint tableName="position" columnName="course" columnDataType="FLOAT" />
- <modifyDataType tableName="position" columnName="address" newDataType="VARCHAR(512)" />
- <dropNotNullConstraint tableName="position" columnName="other" columnDataType="VARCHAR(8192)" />
- <modifyDataType tableName="position" columnName="other" newDataType="VARCHAR(4096)" />
- <addNotNullConstraint tableName="position" columnName="other" columnDataType="VARCHAR(4096)" />
-
- <createIndex tableName="position" indexName="position_deviceId_fixTime">
- <column name="deviceId" />
- <column name="fixTime" />
- </createIndex>
-
- <modifyDataType tableName="data" columnName="protocol" newDataType="VARCHAR(128)" />
- <dropNotNullConstraint tableName="data" columnName="other" columnDataType="VARCHAR(8192)" />
- <modifyDataType tableName="data" columnName="other" newDataType="VARCHAR(4096)" />
- <addNotNullConstraint tableName="data" columnName="other" columnDataType="VARCHAR(4096)" />
-
- <addColumn tableName="server">
- <column name="map" type="VARCHAR(128)" />
- </addColumn>
- <addColumn tableName="server">
- <column name="language" type="VARCHAR(128)" />
- </addColumn>
- <addColumn tableName="server">
- <column name="distanceUnit" type="VARCHAR(128)" />
- </addColumn>
- <addColumn tableName="server">
- <column name="speedUnit" type="VARCHAR(128)" />
- </addColumn>
- <dropNotNullConstraint tableName="server" columnName="latitude" columnDataType="DOUBLE" />
- <modifyDataType tableName="server" columnName="latitude" newDataType="FLOAT" />
- <addNotNullConstraint tableName="server" columnName="latitude" columnDataType="FLOAT" />
- <addDefaultValue tableName="server" columnName="latitude" defaultValueNumeric="0" />
- <dropNotNullConstraint tableName="server" columnName="longitude" columnDataType="DOUBLE" />
- <modifyDataType tableName="server" columnName="longitude" newDataType="FLOAT" />
- <addNotNullConstraint tableName="server" columnName="longitude" columnDataType="FLOAT" />
- <addDefaultValue tableName="server" columnName="longitude" defaultValueNumeric="0" />
- <addDefaultValue tableName="server" columnName="zoom" defaultValueNumeric="0" />
-
- <dropTable tableName="traccar" />
-
- <createTable tableName="traccar">
- <column name="version" type="INT" defaultValueNumeric="0">
- <constraints nullable="false" />
- </column>
- </createTable>
-
- <insert tableName="traccar">
- <column name="version" valueNumeric="301" />
- </insert>
-
- </changeSet>
-</databaseChangeLog>
diff --git a/database/db.changelog-3.2.xml b/database/db.changelog-3.2.xml
deleted file mode 100644
index fdeabfb68..000000000
--- a/database/db.changelog-3.2.xml
+++ /dev/null
@@ -1,63 +0,0 @@
-<?xml version="1.0" 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.4.xsd">
-
- <changeSet author="author" id="changelog-3.2">
-
- <preConditions onFail="MARK_RAN">
- <not>
- <columnExists tableName="position" columnName="attributes" />
- </not>
- </preConditions>
-
- <dropDefaultValue tableName="user" columnName="latitude" />
- <dropNotNullConstraint tableName="user" columnName="latitude" columnDataType="FLOAT" />
- <modifyDataType tableName="user" columnName="latitude" newDataType="DOUBLE" />
- <addNotNullConstraint tableName="user" columnName="latitude" columnDataType="DOUBLE" />
- <addDefaultValue tableName="user" columnName="latitude" defaultValueNumeric="0" />
- <dropDefaultValue tableName="user" columnName="longitude" />
- <dropNotNullConstraint tableName="user" columnName="longitude" columnDataType="FLOAT" />
- <modifyDataType tableName="user" columnName="longitude" newDataType="DOUBLE" />
- <addNotNullConstraint tableName="user" columnName="longitude" columnDataType="DOUBLE" />
- <addDefaultValue tableName="user" columnName="longitude" defaultValueNumeric="0" />
-
- <dropColumn tableName="device" columnName="dataId" />
-
- <dropNotNullConstraint tableName="position" columnName="latitude" columnDataType="FLOAT" />
- <modifyDataType tableName="position" columnName="latitude" newDataType="DOUBLE" />
- <addNotNullConstraint tableName="position" columnName="latitude" columnDataType="DOUBLE" />
- <dropNotNullConstraint tableName="position" columnName="longitude" columnDataType="FLOAT" />
- <modifyDataType tableName="position" columnName="longitude" newDataType="DOUBLE" />
- <addNotNullConstraint tableName="position" columnName="longitude" columnDataType="DOUBLE" />
- <dropNotNullConstraint tableName="position" columnName="other" columnDataType="VARCHAR(4096)" />
- <renameColumn tableName="position" oldColumnName="other" newColumnName="attributes" columnDataType="VARCHAR(4096)" />
- <addNotNullConstraint tableName="position" columnName="attributes" columnDataType="VARCHAR(4096)" />
-
- <dropTable tableName="data" />
-
- <addColumn tableName="server">
- <column name="bingKey" type="VARCHAR(128)" />
- </addColumn>
- <addColumn tableName="server">
- <column name="mapUrl" type="VARCHAR(128)" />
- </addColumn>
- <dropDefaultValue tableName="server" columnName="latitude" />
- <dropNotNullConstraint tableName="server" columnName="latitude" columnDataType="FLOAT" />
- <modifyDataType tableName="server" columnName="latitude" newDataType="DOUBLE" />
- <addNotNullConstraint tableName="server" columnName="latitude" columnDataType="DOUBLE" />
- <addDefaultValue tableName="server" columnName="latitude" defaultValueNumeric="0" />
- <dropDefaultValue tableName="server" columnName="longitude" />
- <dropNotNullConstraint tableName="server" columnName="longitude" columnDataType="FLOAT" />
- <modifyDataType tableName="server" columnName="longitude" newDataType="DOUBLE" />
- <addNotNullConstraint tableName="server" columnName="longitude" columnDataType="DOUBLE" />
- <addDefaultValue tableName="server" columnName="longitude" defaultValueNumeric="0" />
-
- <update tableName="traccar">
- <column name="version" valueNumeric="302" />
- </update>
-
- </changeSet>
-</databaseChangeLog>
diff --git a/database/db.changelog-3.3.xml b/database/db.changelog-3.3.xml
deleted file mode 100644
index 22fcd6f5c..000000000
--- a/database/db.changelog-3.3.xml
+++ /dev/null
@@ -1,32 +0,0 @@
-<?xml version="1.0" 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.4.xsd">
-
- <changeSet author="author" id="changelog-3.3">
-
- <dropDefaultValue tableName="user" columnName="salt" />
-
- <addDefaultValue tableName="server" columnName="registration" defaultValueBoolean="true" />
-
- <addColumn tableName="server">
- <column name="readonly" type="BOOLEAN" defaultValueBoolean="false">
- <constraints nullable="false" />
- </column>
- </addColumn>
-
- <dropTable tableName="traccar" />
-
- <renameTable oldTableName="user" newTableName="users" />
- <renameTable oldTableName="device" newTableName="devices" />
- <renameTable oldTableName="position" newTableName="positions" />
-
- <dropDefaultValue tableName="user_device" columnName="read" />
- <dropColumn tableName="user_device" columnName="read" />
- <dropDefaultValue tableName="user_device" columnName="write" />
- <dropColumn tableName="user_device" columnName="write" />
-
- </changeSet>
-</databaseChangeLog>
diff --git a/database/db.changelog-master.xml b/database/db.changelog-master.xml
deleted file mode 100644
index 06fc7a695..000000000
--- a/database/db.changelog-master.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-<?xml version="1.0" 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.4.xsd">
-
- <include file="db.changelog-normalize.xml" relativeToChangelogFile="true" />
- <include file="db.changelog-3.0.xml" relativeToChangelogFile="true" />
- <include file="db.changelog-3.1.xml" relativeToChangelogFile="true" />
- <include file="db.changelog-3.2.xml" relativeToChangelogFile="true" />
- <include file="db.changelog-3.3.xml" relativeToChangelogFile="true" />
-</databaseChangeLog>
diff --git a/database/db.changelog-normalize.xml b/database/db.changelog-normalize.xml
deleted file mode 100644
index 7621846ca..000000000
--- a/database/db.changelog-normalize.xml
+++ /dev/null
@@ -1,114 +0,0 @@
-<?xml version="1.0" 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.4.xsd">
-
- <changeSet author="author" id="changelog-normalize-user">
-
- <preConditions onFail="MARK_RAN">
- <tableExists tableName="traccar" />
- <not>
- <columnExists tableName="user" columnName="id"/>
- </not>
- </preConditions>
-
- <renameTable oldTableName="quotedUser" newTableName="user" />
-
- <modifySql>
- <replace replace="quotedUser" with="&quot;user&quot;" />
- </modifySql>
-
- </changeSet>
-
- <changeSet author="author" id="changelog-normalize-user-device">
-
- <preConditions onFail="MARK_RAN">
- <tableExists tableName="traccar" />
- <not>
- <columnExists tableName="user_device" columnName="read"/>
- </not>
- </preConditions>
-
- <renameColumn tableName="user_device" oldColumnName="quotedRead" newColumnName="read" columnDataType="BOOLEAN" />
- <renameColumn tableName="user_device" oldColumnName="quotedWrite" newColumnName="write" columnDataType="BOOLEAN" />
-
- <modifySql>
- <replace replace="quotedRead" with="&quot;read&quot;" />
- <replace replace="quotedWrite" with="&quot;write&quot;" />
- </modifySql>
-
- </changeSet>
-
- <changeSet author="author" id="changelog-normalize-fk-h2">
-
- <preConditions onFail="MARK_RAN">
- <tableExists tableName="traccar" />
- <dbms type="h2" />
- </preConditions>
-
- <sql>CREATE ALIAS IF NOT EXISTS EXECUTE AS $$ void executeSql(Connection conn, String sql) throws SQLException { try { conn.createStatement().executeUpdate(sql); } catch (Exception e) {} } $$;</sql>
-
- <sql>CALL EXECUTE('ALTER TABLE POSITION DROP CONSTRAINT ' || (SELECT DISTINCT CONSTRAINT_NAME FROM INFORMATION_SCHEMA.CONSTRAINTS WHERE CONSTRAINT_TYPE = 'REFERENTIAL' AND TABLE_NAME = 'POSITION' AND COLUMN_LIST = 'DEVICEID'));</sql>
- <sql>CALL EXECUTE('ALTER TABLE DEVICE DROP CONSTRAINT ' || (SELECT DISTINCT CONSTRAINT_NAME FROM INFORMATION_SCHEMA.CONSTRAINTS WHERE CONSTRAINT_TYPE = 'REFERENTIAL' AND TABLE_NAME = 'DEVICE' AND COLUMN_LIST = 'POSITIONID'));</sql>
- <sql>CALL EXECUTE('ALTER TABLE DEVICE DROP CONSTRAINT ' || (SELECT DISTINCT CONSTRAINT_NAME FROM INFORMATION_SCHEMA.CONSTRAINTS WHERE CONSTRAINT_TYPE = 'REFERENTIAL' AND TABLE_NAME = 'DEVICE' AND COLUMN_LIST = 'DATAID'));</sql>
- <sql>CALL EXECUTE('ALTER TABLE USER_DEVICE DROP CONSTRAINT ' || (SELECT DISTINCT CONSTRAINT_NAME FROM INFORMATION_SCHEMA.CONSTRAINTS WHERE CONSTRAINT_TYPE = 'REFERENTIAL' AND TABLE_NAME = 'USER_DEVICE' AND COLUMN_LIST = 'USERID'));</sql>
- <sql>CALL EXECUTE('ALTER TABLE USER_DEVICE DROP CONSTRAINT ' || (SELECT DISTINCT CONSTRAINT_NAME FROM INFORMATION_SCHEMA.CONSTRAINTS WHERE CONSTRAINT_TYPE = 'REFERENTIAL' AND TABLE_NAME = 'USER_DEVICE' AND COLUMN_LIST = 'DEVICEID'));</sql>
- <sql>CALL EXECUTE('ALTER TABLE DATA DROP CONSTRAINT ' || (SELECT DISTINCT CONSTRAINT_NAME FROM INFORMATION_SCHEMA.CONSTRAINTS WHERE CONSTRAINT_TYPE = 'REFERENTIAL' AND TABLE_NAME = 'DATA' AND COLUMN_LIST = 'DEVICEID'));</sql>
-
- </changeSet>
-
- <changeSet author="author" id="changelog-normalize-fk-other">
-
- <preConditions onFail="MARK_RAN">
- <tableExists tableName="traccar" />
- <not>
- <dbms type="h2" />
- </not>
- </preConditions>
-
- <dropAllForeignKeyConstraints baseTableName="position" />
- <dropAllForeignKeyConstraints baseTableName="device" />
- <dropAllForeignKeyConstraints baseTableName="user_device" />
-
- </changeSet>
-
- <changeSet author="author" id="changelog-normalize-fk">
-
- <preConditions onFail="MARK_RAN">
- <tableExists tableName="traccar" />
- </preConditions>
-
- <addForeignKeyConstraint baseTableName="user_device" baseColumnNames="userId" constraintName="fk_user_device_userId" referencedTableName="user" referencedColumnNames="id" onDelete="CASCADE" />
- <addForeignKeyConstraint baseTableName="user_device" baseColumnNames="deviceId" constraintName="fk_user_device_deviceId" referencedTableName="device" referencedColumnNames="id" onDelete="CASCADE" />
-
- <addForeignKeyConstraint baseTableName="position" baseColumnNames="deviceId" constraintName="fk_position_deviceId" referencedTableName="device" referencedColumnNames="id" onDelete="CASCADE" />
-
- </changeSet>
-
- <changeSet author="author" id="changelog-normalize-fk-data-other">
-
- <preConditions onFail="MARK_RAN">
- <tableExists tableName="traccar" />
- <tableExists tableName="data" />
- <not>
- <dbms type="h2" />
- </not>
- </preConditions>
-
- <dropAllForeignKeyConstraints baseTableName="data" />
-
- </changeSet>
-
- <changeSet author="author" id="changelog-normalize-fk-data">
-
- <preConditions onFail="MARK_RAN">
- <tableExists tableName="traccar" />
- <tableExists tableName="data" />
- </preConditions>
-
- <addForeignKeyConstraint baseTableName="data" baseColumnNames="deviceId" constraintName="fk_data_deviceId" referencedTableName="device" referencedColumnNames="id" onDelete="CASCADE" />
-
- </changeSet>
-</databaseChangeLog>