diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2017-02-09 16:54:02 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-02-09 16:54:02 +0800 |
commit | 034a0b6b4fc1fe549d893d7acc61906c8221f2e1 (patch) | |
tree | 386dd49f7f73722d61cb8d014e3279cd4f739b24 /schema | |
parent | 7929d258e6f957c720f4392ba82d4669d9e65059 (diff) | |
parent | 0d789419b2707be5160a71d2073d48c15f3daf50 (diff) | |
download | trackermap-server-034a0b6b4fc1fe549d893d7acc61906c8221f2e1.tar.gz trackermap-server-034a0b6b4fc1fe549d893d7acc61906c8221f2e1.tar.bz2 trackermap-server-034a0b6b4fc1fe549d893d7acc61906c8221f2e1.zip |
Merge pull request #2887 from Abyss777/fix_2884
Fix 3.10 schema for MS SQL
Diffstat (limited to 'schema')
-rw-r--r-- | schema/changelog-3.10.xml | 48 |
1 files changed, 45 insertions, 3 deletions
diff --git a/schema/changelog-3.10.xml b/schema/changelog-3.10.xml index c4d9b7b18..4c64373e9 100644 --- a/schema/changelog-3.10.xml +++ b/schema/changelog-3.10.xml @@ -34,11 +34,11 @@ <addForeignKeyConstraint baseTableName="user_calendar" baseColumnNames="userid" constraintName="fk_user_calendar_userid" referencedTableName="users" referencedColumnNames="id" onDelete="CASCADE" /> <addForeignKeyConstraint baseTableName="user_calendar" baseColumnNames="calendarid" constraintName="fk_user_calendar_geofenceid" referencedTableName="calendars" referencedColumnNames="id" onDelete="CASCADE" /> - + <addColumn tableName="geofences"> <column name="calendarid" type="INT" /> </addColumn> - + <addForeignKeyConstraint baseColumnNames="calendarid" baseTableName="geofences" constraintName="fk_geofence_calendar_calendarid" onDelete="SET NULL" onUpdate="RESTRICT" referencedColumnNames="id" referencedTableName="calendars"/> <addColumn tableName="positions"> @@ -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,46 @@ </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> + + <changeSet author="author" id="changelog-3.7-mssql"> + + <preConditions onFail="MARK_RAN"> + <dbms type="mssql" /> + </preConditions> + <sql> + CREATE TRIGGER tg_groups_delete + ON groups FOR DELETE + AS BEGIN + UPDATE groups SET groupid = NULL WHERE groupid IN (SELECT deleted.id FROM deleted) + END + </sql> + + </changeSet> + </databaseChangeLog> |