aboutsummaryrefslogtreecommitdiff
path: root/schema
diff options
context:
space:
mode:
authorAbyss777 <abyss@fox5.ru>2017-02-08 17:48:28 +0500
committerAbyss777 <abyss@fox5.ru>2017-02-08 17:48:28 +0500
commit1e12757c6dbbb7a48923705437426fe24f86e10a (patch)
tree3f2a9e2f3c31f0495924afd63d0c1f6c0654a062 /schema
parent4944796891b6416e30c3ee96b4bd03257d9ad8d2 (diff)
downloadtrackermap-server-1e12757c6dbbb7a48923705437426fe24f86e10a.tar.gz
trackermap-server-1e12757c6dbbb7a48923705437426fe24f86e10a.tar.bz2
trackermap-server-1e12757c6dbbb7a48923705437426fe24f86e10a.zip
- Replace fk_user_user_manageduserid in MS SQL with trigger
- Drop defaultValue before add
Diffstat (limited to 'schema')
-rw-r--r--schema/changelog-3.10.xml28
1 files changed, 27 insertions, 1 deletions
diff --git a/schema/changelog-3.10.xml b/schema/changelog-3.10.xml
index c4d9b7b18..33f02880d 100644
--- a/schema/changelog-3.10.xml
+++ b/schema/changelog-3.10.xml
@@ -62,12 +62,12 @@
</createTable>
<addForeignKeyConstraint baseTableName="user_user" baseColumnNames="userid" constraintName="fk_user_user_userid" referencedTableName="users" referencedColumnNames="id" onDelete="CASCADE" />
- <addForeignKeyConstraint baseTableName="user_user" baseColumnNames="manageduserid" constraintName="fk_user_user_manageduserid" referencedTableName="users" referencedColumnNames="id" onDelete="CASCADE" />
<update tableName="users">
<column name="devicelimit" valueNumeric="-1" />
<where>devicelimit = 0</where>
</update>
+ <dropDefaultValue tableName="users" columnName="devicelimit" />
<addDefaultValue tableName="users" columnName="devicelimit" defaultValueNumeric="-1" />
<addColumn tableName="users">
@@ -75,4 +75,30 @@
</addColumn>
</changeSet>
+ <changeSet author="author" id="changelog-3.10-notmssql">
+
+ <preConditions onFail="MARK_RAN">
+ <not>
+ <dbms type="mssql" />
+ </not>
+ </preConditions>
+ <addForeignKeyConstraint baseTableName="user_user" baseColumnNames="manageduserid" constraintName="fk_user_user_manageduserid" referencedTableName="users" referencedColumnNames="id" onDelete="CASCADE" />
+
+ </changeSet>
+
+ <changeSet author="author" id="changelog-3.10-mssql">
+
+ <preConditions onFail="MARK_RAN">
+ <dbms type="mssql" />
+ </preConditions>
+ <sql>
+ CREATE TRIGGER tg_users_delete
+ ON users FOR DELETE
+ AS BEGIN
+ DELETE FROM user_user WHERE managedUserId IN (SELECT deleted.id FROM deleted)
+ END
+ </sql>
+
+ </changeSet>
+
</databaseChangeLog>