-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #94 from SageSeekerSociety/dev
Release: 0.7.0
- Loading branch information
Showing
26 changed files
with
249 additions
and
168 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
-- PostgreSQL Migration Script for Cheese Backend NT (0.6.0 -> 0.7.0) | ||
-- Backup Before Executing This in Production Database | ||
|
||
ALTER TABLE task | ||
ALTER COLUMN approved SET DATA TYPE SMALLINT USING | ||
CASE | ||
WHEN approved = TRUE THEN 0 | ||
WHEN approved = FALSE THEN 1 | ||
END; | ||
|
||
ALTER TABLE task | ||
ALTER COLUMN approved SET NOT NULL; | ||
|
||
ALTER TABLE task | ||
ADD CONSTRAINT approved_check CHECK (approved BETWEEN 0 AND 2); | ||
|
||
UPDATE task | ||
SET reject_reason = '' | ||
WHERE reject_reason IS NULL; | ||
|
||
ALTER TABLE task | ||
ALTER COLUMN reject_reason SET NOT NULL; | ||
|
||
UPDATE task | ||
SET approved = | ||
CASE | ||
WHEN approved = 0 THEN 0 | ||
WHEN approved = 1 AND reject_reason != '' THEN 1 | ||
ELSE 2 | ||
END; | ||
|
||
|
||
|
||
|
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,15 @@ | ||
-- PostgreSQL Patch Script for Cheese Backend NT (0.5.0) | ||
-- Backup Before Executing This in Production Database | ||
|
||
-- Description: | ||
-- Replace all invalid announcements and templates with "[]" | ||
|
||
-- This script can be executed several times safely without any side effects. | ||
|
||
UPDATE SPACE | ||
SET announcements = '[]' | ||
WHERE announcements NOT LIKE '[%]'; | ||
|
||
UPDATE SPACE | ||
SET task_templates = '[]' | ||
WHERE task_templates NOT LIKE '[%]'; |
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
This file was deleted.
Oops, something went wrong.
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
35 changes: 35 additions & 0 deletions
35
src/main/kotlin/org/rucca/cheese/common/persistent/ApproveType.kt
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,35 @@ | ||
package org.rucca.cheese.common.persistent | ||
|
||
import org.rucca.cheese.model.ApproveTypeDTO | ||
|
||
/* | ||
* | ||
* Do not delete any row of this enum, | ||
* because it is stored in database as an integer. | ||
* | ||
* If you want to add a new row, add it to the end of the enum. | ||
* This will prevent changing the values of the existing rows. | ||
* | ||
*/ | ||
|
||
enum class ApproveType { | ||
APPROVED, | ||
DISAPPROVED, | ||
NONE, | ||
} | ||
|
||
fun ApproveType.convert(): ApproveTypeDTO { | ||
return when (this) { | ||
ApproveType.APPROVED -> ApproveTypeDTO.APPROVED | ||
ApproveType.DISAPPROVED -> ApproveTypeDTO.DISAPPROVED | ||
ApproveType.NONE -> ApproveTypeDTO.NONE | ||
} | ||
} | ||
|
||
fun ApproveTypeDTO.convert(): ApproveType { | ||
return when (this) { | ||
ApproveTypeDTO.APPROVED -> ApproveType.APPROVED | ||
ApproveTypeDTO.DISAPPROVED -> ApproveType.DISAPPROVED | ||
ApproveTypeDTO.NONE -> ApproveType.NONE | ||
} | ||
} |
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
Oops, something went wrong.