Skip to content

Commit 102a287

Browse files
added migrations
1 parent 529c594 commit 102a287

File tree

5 files changed

+21
-7
lines changed

5 files changed

+21
-7
lines changed

src/main/java/net/javadiscord/javabot/systems/qotw/submissions/SubmissionStatus.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@
44
* Enum class that represents the status of QOTW Submissions.
55
*/
66
public enum SubmissionStatus {
7+
/**
8+
* Used for submissions that were yet unreviewed.
9+
*/
10+
UNREVIEWED,
711
/**
812
* Used for submissions that were accepted.
913
*/
@@ -15,9 +19,5 @@ public enum SubmissionStatus {
1519
/**
1620
* Used for submissions that were deleted.
1721
*/
18-
DELETED,
19-
/**
20-
* Used for submissions that were yet unreviewed.
21-
*/
22-
UNREVIEWED
22+
DELETED
2323
}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
ALTER TABLE qotw_submissions
2+
ADD COLUMN status INTEGER NOT NULL DEFAULT 0
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
UPDATE qotw_submissions
2+
SET status = 0 WHERE NOT reviewed;
3+
4+
UPDATE qotw_submissions
5+
SET status = 1 WHERE reviewed AND accepted;
6+
7+
UPDATE qotw_submissions
8+
SET status = 2 WHERE reviewed AND NOT accepted;
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
ALTER TABLE qotw_submissions
2+
DROP COLUMN reviewed;
3+
4+
ALTER TABLE qotw_submissions
5+
DROP COLUMN accepted;

src/main/resources/schema.sql

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,8 +152,7 @@ CREATE TABLE qotw_submissions (
152152
question_number INTEGER NOT NULL,
153153
guild_id BIGINT NOT NULL,
154154
author_id BIGINT NOT NULL,
155-
reviewed BOOL NOT NULL DEFAULT FALSE,
156-
accepted BOOL NOT NULL DEFAULT FALSE
155+
status INTEGER NOT NULL DEFAULT 0
157156
);
158157

159158
CREATE TABLE message_cache (

0 commit comments

Comments
 (0)