aboutsummaryrefslogtreecommitdiff
path: root/schema
diff options
context:
space:
mode:
authordrecchia <danilo@deltatecnologia.com>2016-06-09 20:34:48 -0300
committerdrecchia <danilo@deltatecnologia.com>2016-06-09 20:34:48 -0300
commit3f19cd0c34e5454f5f1feed3465c45ac638cb0d2 (patch)
tree7cad99e552536f2d0a2b295ee81939b195d77a66 /schema
parent5a2c64cd99134e98e311d694a76d3d22703496c2 (diff)
downloadtrackermap-server-3f19cd0c34e5454f5f1feed3465c45ac638cb0d2.tar.gz
trackermap-server-3f19cd0c34e5454f5f1feed3465c45ac638cb0d2.tar.bz2
trackermap-server-3f19cd0c34e5454f5f1feed3465c45ac638cb0d2.zip
- Clean docker integration.
Diffstat (limited to 'schema')
-rw-r--r--schema/changelog-3.3.xml187
-rw-r--r--schema/changelog-3.5.xml61
-rw-r--r--schema/changelog-3.6.xml34
-rw-r--r--schema/changelog-master.xml11
4 files changed, 293 insertions, 0 deletions
diff --git a/schema/changelog-3.3.xml b/schema/changelog-3.3.xml
new file mode 100644
index 000000000..1893a0200
--- /dev/null
+++ b/schema/changelog-3.3.xml
@@ -0,0 +1,187 @@
+<?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">
+
+ <preConditions onFail="MARK_RAN">
+ <not>
+ <tableExists tableName="server" />
+ </not>
+ </preConditions>
+
+ <createTable tableName="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" />
+ </column>
+ <column name="hashedpassword" type="VARCHAR(128)">
+ <constraints nullable="false" />
+ </column>
+ <column name="salt" type="VARCHAR(128)">
+ <constraints nullable="false" />
+ </column>
+ <column name="readonly" type="BOOLEAN" defaultValueBoolean="false">
+ <constraints nullable="false" />
+ </column>
+ <column name="admin" type="BOOLEAN" defaultValueBoolean="false">
+ <constraints nullable="false" />
+ </column>
+ <column name="map" type="VARCHAR(128)" defaultValue="osm">
+ <constraints nullable="false" />
+ </column>
+ <column name="language" type="VARCHAR(128)" defaultValue="en">
+ <constraints nullable="false" />
+ </column>
+ <column name="distanceunit" type="VARCHAR(128)" defaultValue="km">
+ <constraints nullable="false" />
+ </column>
+ <column name="speedunit" type="VARCHAR(128)" defaultValue="kmh">
+ <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>
+ </createTable>
+
+ <addUniqueConstraint tableName="users" columnNames="email" constraintName="uk_user_email" />
+
+ <createTable tableName="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" />
+ </column>
+ <column name="status" type="VARCHAR(128)" />
+ <column name="lastupdate" type="TIMESTAMP" />
+ <column name="positionid" type="INT" />
+ </createTable>
+
+ <addUniqueConstraint tableName="devices" columnNames="uniqueid" constraintName="uk_device_uniqueid" />
+
+ <createTable tableName="user_device">
+ <column name="userid" type="INT">
+ <constraints nullable="false" />
+ </column>
+ <column name="deviceid" type="INT">
+ <constraints nullable="false" />
+ </column>
+ </createTable>
+
+ <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" />
+ </createIndex>
+
+ <createTable tableName="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">
+ <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(4096)">
+ <constraints nullable="false" />
+ </column>
+ </createTable>
+
+ <addForeignKeyConstraint baseTableName="positions" baseColumnNames="deviceid" constraintName="fk_position_deviceid" referencedTableName="devices" 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" 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="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>
+
+ <insert tableName="server">
+ <column name="registration" valueBoolean="true" />
+ <column name="latitude" valueNumeric="0" />
+ <column name="longitude" valueNumeric="0" />
+ <column name="zoom" valueNumeric="0" />
+ </insert>
+
+ <insert tableName="users">
+ <column name="name" value="admin" />
+ <column name="email" value="admin" />
+ <column name="hashedpassword" value="D33DCA55ABD4CC5BC76F2BC0B4E603FE2C6F61F4C1EF2D47" />
+ <column name="salt" value="000000000000000000000000000000000000000000000000" />
+ <column name="admin" valueBoolean="true" />
+ </insert>
+
+ </changeSet>
+</databaseChangeLog>
diff --git a/schema/changelog-3.5.xml b/schema/changelog-3.5.xml
new file mode 100644
index 000000000..63a3a3a92
--- /dev/null
+++ b/schema/changelog-3.5.xml
@@ -0,0 +1,61 @@
+<?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>
+
+ <dropNotNullConstraint tableName="users" columnName="language" columnDataType="VARCHAR(128)" />
+ <dropDefaultValue tableName="users" columnName="language" />
+ <dropColumn tableName="users" columnName="language" />
+ <dropColumn tableName="server" columnName="language" />
+
+ <dropNotNullConstraint tableName="users" columnName="map" columnDataType="VARCHAR(128)" />
+ <dropDefaultValue tableName="users" columnName="map" />
+ <dropNotNullConstraint tableName="users" columnName="distanceunit" columnDataType="VARCHAR(128)" />
+ <dropDefaultValue tableName="users" columnName="distanceunit" />
+ <dropNotNullConstraint tableName="users" columnName="speedunit" columnDataType="VARCHAR(128)" />
+ <dropDefaultValue tableName="users" columnName="speedunit" />
+
+ <addColumn tableName="users">
+ <column name="twelvehourformat" type="BOOLEAN" defaultValueBoolean="false">
+ <constraints nullable="false" />
+ </column>
+ </addColumn>
+
+ <addColumn tableName="server">
+ <column name="twelvehourformat" type="BOOLEAN" defaultValueBoolean="false">
+ <constraints nullable="false" />
+ </column>
+ </addColumn>
+
+ </changeSet>
+</databaseChangeLog>
diff --git a/schema/changelog-3.6.xml b/schema/changelog-3.6.xml
new file mode 100644
index 000000000..378ec741f
--- /dev/null
+++ b/schema/changelog-3.6.xml
@@ -0,0 +1,34 @@
+<?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.6">
+
+ <createTable tableName="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="attributes" type="VARCHAR(4096)">
+ <constraints nullable="false" />
+ </column>
+ </createTable>
+
+ <addForeignKeyConstraint baseTableName="events" baseColumnNames="deviceid" constraintName="fk_event_deviceid" referencedTableName="devices" referencedColumnNames="id" onDelete="CASCADE" />
+
+ <addColumn tableName="devices">
+ <column name="motion" type="VARCHAR(128)" />
+ </addColumn>
+
+ </changeSet>
+</databaseChangeLog>
diff --git a/schema/changelog-master.xml b/schema/changelog-master.xml
new file mode 100644
index 000000000..399cd3c8d
--- /dev/null
+++ b/schema/changelog-master.xml
@@ -0,0 +1,11 @@
+<?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" />
+ <include file="changelog-3.6.xml" relativeToChangelogFile="true" />
+</databaseChangeLog>