diff options
author | Abyss777 <abyss@fox5.ru> | 2017-02-09 09:39:54 +0500 |
---|---|---|
committer | Abyss777 <abyss@fox5.ru> | 2017-02-09 09:39:54 +0500 |
commit | c8da62d78ea19dbdaa15697e7f31dbd02474864d (patch) | |
tree | 8a91969e23b808e1c048a541a6e709b652df3c4c | |
parent | 1e12757c6dbbb7a48923705437426fe24f86e10a (diff) | |
download | traccar-server-c8da62d78ea19dbdaa15697e7f31dbd02474864d.tar.gz traccar-server-c8da62d78ea19dbdaa15697e7f31dbd02474864d.tar.bz2 traccar-server-c8da62d78ea19dbdaa15697e7f31dbd02474864d.zip |
Add trigger on group deleting
-rw-r--r-- | schema/changelog-3.10.xml | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/schema/changelog-3.10.xml b/schema/changelog-3.10.xml index 33f02880d..ad8c34668 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"> @@ -75,6 +75,7 @@ </addColumn> </changeSet> + <changeSet author="author" id="changelog-3.10-notmssql"> <preConditions onFail="MARK_RAN"> @@ -95,7 +96,14 @@ CREATE TRIGGER tg_users_delete ON users FOR DELETE AS BEGIN - DELETE FROM user_user WHERE managedUserId IN (SELECT deleted.id FROM deleted) + DELETE FROM user_user WHERE manageduserid IN (SELECT deleted.id FROM deleted) + END + </sql> + <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> |