Skip to content

Commit

Permalink
feat: Change FK constraints
Browse files Browse the repository at this point in the history
  • Loading branch information
KminekMatej committed Sep 6, 2024
1 parent c415da7 commit f462ca8
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions app/module/admin/migrations/2024-09-06T22-44-33.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@

-- SQL Migration file
-- Author: Matěj Kmínek <[email protected]>
-- Created: 06.09.2024 22:44:33


/*
Comment for this migration: (not neccessary, but can be handy)
*/


-- UP:
-- commands that updates database shall be written here:

ALTER TABLE `attendance` DROP FOREIGN KEY `attendance_ibfk_5`;
ALTER TABLE `attendance` ADD CONSTRAINT `attendance_ibfk_5` FOREIGN KEY (`pre_usr_mod`) REFERENCES `user`(`id`) ON DELETE SET NULL ON UPDATE CASCADE;
ALTER TABLE `attendance` DROP FOREIGN KEY `attendance_ibfk_6`;
ALTER TABLE `attendance` ADD CONSTRAINT `attendance_ibfk_6` FOREIGN KEY (`post_usr_mod`) REFERENCES `user`(`id`) ON DELETE SET NULL ON UPDATE CASCADE;

-- DOWN:
-- commands that reverts updates from UP section shall be written here:

CALL 'Migrations DOWN are for security reasons temporarily DISABLED. Impossible to migrate down from 2024-09-06T22-44-33, in file 2024-09-06T22-44-33.sql';

-- DOWN migrations are disabled for security reasons.
-- These migrations might often include removal of some existent database columns, which is very dangerous to do on production servers.
-- Whenever we would migrate DOWN, then it would be impossible to migrate UP again, without loss of data.

0 comments on commit f462ca8

Please sign in to comment.