diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2016-03-03 10:52:10 +1300 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2016-03-03 10:52:10 +1300 |
commit | 07412baa3500a8ff4086adb0edf03c9bd2a69310 (patch) | |
tree | bcfb5b70f9057bd763765a0a447669c4f8c30dae /database | |
parent | a05541ee221b261a4554e27487d4ecf8f466a1e4 (diff) | |
download | trackermap-server-07412baa3500a8ff4086adb0edf03c9bd2a69310.tar.gz trackermap-server-07412baa3500a8ff4086adb0edf03c9bd2a69310.tar.bz2 trackermap-server-07412baa3500a8ff4086adb0edf03c9bd2a69310.zip |
Start db changelogs from scratch
Diffstat (limited to 'database')
-rw-r--r-- | database/changelog-3.3.xml (renamed from database/db.changelog-3.0.xml) | 108 | ||||
-rw-r--r-- | database/changelog-master.xml | 9 | ||||
-rw-r--r-- | database/db.changelog-3.1.xml | 131 | ||||
-rw-r--r-- | database/db.changelog-3.2.xml | 63 | ||||
-rw-r--r-- | database/db.changelog-3.3.xml | 32 | ||||
-rw-r--r-- | database/db.changelog-master.xml | 13 | ||||
-rw-r--r-- | database/db.changelog-normalize.xml | 114 |
7 files changed, 53 insertions, 417 deletions
diff --git a/database/db.changelog-3.0.xml b/database/changelog-3.3.xml index 453f6f00b..25b359401 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,25 +58,24 @@ </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="status" type="VARCHAR(128)" /> <column name="lastUpdate" type="TIMESTAMP" /> <column name="positionId" type="INT" /> - <column name="dataId" 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"> @@ -85,26 +84,20 @@ <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"> - <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" /> </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="protocol" type="VARCHAR(128)" /> <column name="deviceId" type="int"> <constraints nullable="false" /> </column> @@ -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" /> - - <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="positions" baseColumnNames="deviceId" constraintName="fk_position_deviceId" referencedTableName="devices" referencedColumnNames="id" onDelete="CASCADE" /> - <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,7 +175,7 @@ <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" /> diff --git a/database/changelog-master.xml b/database/changelog-master.xml new file mode 100644 index 000000000..595643dce --- /dev/null +++ b/database/changelog-master.xml @@ -0,0 +1,9 @@ +<?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" /> +</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=""user"" /> - </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=""read"" /> - <replace replace="quotedWrite" with=""write"" /> - </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> |