-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
bug/59556 preserve restart state when changing attendance state (#2878)
* add deletion reference column migrations * capture attendance record when deleting restart * revert restart when deleting attendance --------- Co-authored-by: Mohsen Qureshi <[email protected]>
- Loading branch information
1 parent
ab50c4e
commit 35b3da2
Showing
4 changed files
with
49 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -199,4 +199,4 @@ | |
"axios": "axios/dist/node/axios.cjs" | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
db/migrations/schema-objects/20240816100652.do.attendance-restart-deletion-ref-column.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
ALTER TABLE [mtc_admin].[pupilRestart] | ||
ADD [deletedBy_pupilAttendance_id] INT NULL; | ||
|
||
ALTER TABLE [mtc_admin].[pupilRestart] WITH NOCHECK | ||
ADD CONSTRAINT [FK_pupilRestart_pupilAttendance_deletedBy_id] FOREIGN KEY ([deletedBy_pupilAttendance_id]) REFERENCES [mtc_admin].[pupilAttendance] ([id]); | ||
|
||
ALTER TABLE [mtc_admin].[pupilRestart] WITH CHECK CHECK CONSTRAINT [FK_pupilRestart_pupilAttendance_deletedBy_id]; |
12 changes: 12 additions & 0 deletions
12
db/migrations/schema-objects/20240816100652.undo.attendance-restart-deletion-ref-column.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
IF EXISTS(SELECT * | ||
FROM INFORMATION_SCHEMA.CONSTRAINT_COLUMN_USAGE | ||
WHERE CONSTRAINT_COLUMN_USAGE.TABLE_SCHEMA = 'mtc_admin' | ||
AND CONSTRAINT_COLUMN_USAGE.TABLE_NAME = 'pupilRestart' | ||
AND CONSTRAINT_COLUMN_USAGE.COLUMN_NAME = 'deletedBy_pupilAttendance_id' | ||
AND CONSTRAINT_NAME = 'FK_pupilRestart_pupilAttendance_deletedBy_id') | ||
BEGIN | ||
ALTER TABLE [mtc_admin].[pupilRestart] | ||
DROP CONSTRAINT [FK_pupilRestart_pupilAttendance_deletedBy_id]; | ||
END; | ||
|
||
ALTER TABLE [mtc_admin].[pupilRestart] DROP COLUMN IF EXISTS [deletedBy_pupilAttendance_id]; |