aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2015-12-25 15:48:27 +1300
committerAnton Tananaev <anton.tananaev@gmail.com>2015-12-25 15:48:27 +1300
commit28eac4e15b950f832f52ad3cb3b0426f3e590d9c (patch)
tree42620399466b641be7f257ba0fe3701f8ac2860c
parentff8b6278529338a037df2e577267c7c5b6d1c69f (diff)
downloadtrackermap-server-28eac4e15b950f832f52ad3cb3b0426f3e590d9c.tar.gz
trackermap-server-28eac4e15b950f832f52ad3cb3b0426f3e590d9c.tar.bz2
trackermap-server-28eac4e15b950f832f52ad3cb3b0426f3e590d9c.zip
Update scripts to work with SQL Server
-rw-r--r--database/db.changelog-3.0.xml8
-rw-r--r--database/db.changelog-3.1.xml10
-rw-r--r--database/db.changelog-3.2.xml6
-rw-r--r--database/db.changelog-3.3.xml2
4 files changed, 19 insertions, 7 deletions
diff --git a/database/db.changelog-3.0.xml b/database/db.changelog-3.0.xml
index 5e803794b..453f6f00b 100644
--- a/database/db.changelog-3.0.xml
+++ b/database/db.changelog-3.0.xml
@@ -21,7 +21,7 @@
<constraints nullable="false" />
</column>
<column name="email" type="VARCHAR(256)">
- <constraints nullable="false" unique="true" />
+ <constraints nullable="false" />
</column>
<column name="hashedPassword" type="VARCHAR(1024)">
<constraints nullable="false" />
@@ -58,6 +58,8 @@
</column>
</createTable>
+ <addUniqueConstraint tableName="user" columnNames="email" constraintName="uk_user_email" />
+
<createTable tableName="device">
<column name="id" type="INT" autoIncrement="true">
<constraints primaryKey="true" />
@@ -66,7 +68,7 @@
<constraints nullable="false" />
</column>
<column name="uniqueId" type="VARCHAR(256)">
- <constraints nullable="false" unique="true" />
+ <constraints nullable="false" />
</column>
<column name="status" type="VARCHAR(1024)" />
<column name="lastUpdate" type="TIMESTAMP" />
@@ -74,6 +76,8 @@
<column name="dataId" type="INT" />
</createTable>
+ <addUniqueConstraint tableName="device" columnNames="uniqueId" constraintName="uk_device_uniqueId" />
+
<createTable tableName="user_device">
<column name="userId" type="INT">
<constraints nullable="false" />
diff --git a/database/db.changelog-3.1.xml b/database/db.changelog-3.1.xml
index 17b4fc354..740da4e2f 100644
--- a/database/db.changelog-3.1.xml
+++ b/database/db.changelog-3.1.xml
@@ -16,14 +16,16 @@
<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)" />
- <dropNotNullConstraint tableName="user" columnName="salt" columnDataType="VARCHAR(1024)" />
<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="" />
@@ -39,13 +41,13 @@
<dropDefaultValue tableName="user" columnName="speedUnit" />
<dropNotNullConstraint tableName="user" columnName="speedUnit" columnDataType="VARCHAR(128)" />
<modifyDataType tableName="user" columnName="speedUnit" newDataType="VARCHAR(128)" />
- <dropNotNullConstraint tableName="user" columnName="latitude" columnDataType="DOUBLE" />
<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" />
- <dropNotNullConstraint tableName="user" columnName="longitude" columnDataType="DOUBLE" />
<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" />
@@ -53,9 +55,11 @@
<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)" />
diff --git a/database/db.changelog-3.2.xml b/database/db.changelog-3.2.xml
index a1fc19b06..fdeabfb68 100644
--- a/database/db.changelog-3.2.xml
+++ b/database/db.changelog-3.2.xml
@@ -13,13 +13,13 @@
</not>
</preConditions>
- <dropNotNullConstraint tableName="user" columnName="latitude" columnDataType="FLOAT" />
<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" />
- <dropNotNullConstraint tableName="user" columnName="longitude" columnDataType="FLOAT" />
<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" />
@@ -44,10 +44,12 @@
<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" />
diff --git a/database/db.changelog-3.3.xml b/database/db.changelog-3.3.xml
index cb9823ef8..22fcd6f5c 100644
--- a/database/db.changelog-3.3.xml
+++ b/database/db.changelog-3.3.xml
@@ -23,7 +23,9 @@
<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>