-
-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: allow user deletion without deleting task references
- Loading branch information
1 parent
2e58733
commit b361e92
Showing
6 changed files
with
187 additions
and
23 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
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
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
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
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,25 @@ | ||
-- ## Migration to: | ||
-- * Enable user data deletion | ||
|
||
-- Start a transaction | ||
BEGIN; | ||
|
||
-- Allow user_id in task_history to be NULL | ||
ALTER TABLE task_history | ||
ALTER COLUMN user_id DROP NOT NULL; | ||
|
||
-- Add a new column username to task_history | ||
ALTER TABLE task_history | ||
ADD COLUMN username VARCHAR; | ||
|
||
-- Allow author_id in projects to be NULL | ||
ALTER TABLE projects ALTER COLUMN author_id DROP NOT NULL; | ||
|
||
-- Allow locked_by, mapped_by, and validated_by in tasks to be NULL | ||
ALTER TABLE tasks | ||
ALTER COLUMN locked_by DROP NOT NULL, | ||
ALTER COLUMN mapped_by DROP NOT NULL, | ||
ALTER COLUMN validated_by DROP NOT NULL; | ||
|
||
-- Commit the transaction | ||
COMMIT; |
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,25 @@ | ||
-- ## Migration to: | ||
-- * Revert user data deletion changes | ||
|
||
-- Start a transaction | ||
BEGIN; | ||
|
||
-- Disallow user_id in task_history to be NULL | ||
ALTER TABLE task_history | ||
ALTER COLUMN user_id SET NOT NULL; | ||
|
||
-- Remove the column username from task_history | ||
ALTER TABLE task_history | ||
DROP COLUMN username; | ||
|
||
-- Disallow author_id in projects to be NULL | ||
ALTER TABLE projects ALTER COLUMN author_id SET NOT NULL; | ||
|
||
-- Disallow locked_by, mapped_by, and validated_by in tasks to be NULL | ||
ALTER TABLE tasks | ||
ALTER COLUMN locked_by SET NOT NULL, | ||
ALTER COLUMN mapped_by SET NOT NULL, | ||
ALTER COLUMN validated_by SET NOT NULL; | ||
|
||
-- Commit the transaction | ||
COMMIT; |