diff options
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> |