11// Help System
2- CREATE TABLE reserved_help_channels
2+ CREATE TABLE IF NOT EXISTS reserved_help_channels
33(
44 id BIGINT PRIMARY KEY AUTO_INCREMENT,
55 channel_id BIGINT NOT NULL UNIQUE,
@@ -8,7 +8,7 @@ CREATE TABLE reserved_help_channels
88 timeout INT NOT NULL DEFAULT 60
99);
1010
11- CREATE TABLE help_channel_thanks
11+ CREATE TABLE IF NOT EXISTS help_channel_thanks
1212(
1313 id BIGINT PRIMARY KEY AUTO_INCREMENT,
1414 reservation_id BIGINT NOT NULL ,
@@ -19,13 +19,13 @@ CREATE TABLE help_channel_thanks
1919 CONSTRAINT help_channel_thanks_unique UNIQUE (reservation_id, helper_id)
2020);
2121
22- CREATE TABLE help_account
22+ CREATE TABLE IF NOT EXISTS help_account
2323(
2424 user_id BIGINT PRIMARY KEY ,
2525 experience DOUBLE NOT NULL
2626);
2727
28- CREATE TABLE help_transaction
28+ CREATE TABLE IF NOT EXISTS help_transaction
2929(
3030 id BIGINT PRIMARY KEY AUTO_INCREMENT,
3131 recipient BIGINT NOT NULL ,
@@ -35,7 +35,7 @@ CREATE TABLE help_transaction
3535);
3636
3737// Question of the Week
38- CREATE TABLE qotw_question
38+ CREATE TABLE IF NOT EXISTS qotw_question
3939(
4040 id BIGINT PRIMARY KEY AUTO_INCREMENT,
4141 created_at TIMESTAMP (0 ) NOT NULL DEFAULT CURRENT_TIMESTAMP (0 ),
@@ -47,15 +47,16 @@ CREATE TABLE qotw_question
4747 priority INTEGER NOT NULL DEFAULT 0
4848);
4949
50- CREATE TABLE qotw_points
50+ CREATE TABLE IF NOT EXISTS qotw_points
5151(
52- user_id BIGINT PRIMARY KEY ,
53- obtained_at DATE PRIMARY KEY DEFAULT CURRENT_TIMESTAMP (0 ),
54- points BIGINT NOT NULL DEFAULT 0
52+ user_id BIGINT ,
53+ obtained_at DATE DEFAULT CURRENT_TIMESTAMP (0 ),
54+ points BIGINT NOT NULL DEFAULT 0 ,
55+ PRIMARY KEY (user_id, obtained_at)
5556);
5657
5758// Warn
58- CREATE TABLE warn
59+ CREATE TABLE IF NOT EXISTS warn
5960(
6061 id BIGINT PRIMARY KEY AUTO_INCREMENT,
6162 user_id BIGINT NOT NULL ,
@@ -68,7 +69,7 @@ CREATE TABLE warn
6869);
6970
7071// Custom Tags
71- CREATE TABLE custom_tags
72+ CREATE TABLE IF NOT EXISTS custom_tags
7273(
7374 id BIGINT PRIMARY KEY AUTO_INCREMENT,
7475 guild_id BIGINT NOT NULL ,
@@ -80,7 +81,7 @@ CREATE TABLE custom_tags
8081);
8182
8283// Starboard
83- CREATE TABLE starboard
84+ CREATE TABLE IF NOT EXISTS starboard
8485(
8586 original_message_id BIGINT PRIMARY KEY ,
8687 guild_id BIGINT NOT NULL ,
@@ -90,21 +91,22 @@ CREATE TABLE starboard
9091);
9192
9293// Message Cache
93- CREATE TABLE message_cache
94+ CREATE TABLE IF NOT EXISTS message_cache
9495(
9596 message_id BIGINT PRIMARY KEY ,
9697 author_id BIGINT NOT NULL ,
9798 message_content VARCHAR (4000 ) NOT NULL
9899);
99- CREATE TABLE message_cache_attachments (
100+
101+ CREATE TABLE IF NOT EXISTS message_cache_attachments (
100102 message_id BIGINT NOT NULL ,
101103 attachment_index INT NOT NULL ,
102104 link VARCHAR (255 ),
103105 PRIMARY KEY (message_id, attachment_index)
104- )
106+ );
105107
106108// User Preferences
107- CREATE TABLE user_preferences
109+ CREATE TABLE IF NOT EXISTS user_preferences
108110(
109111 user_id BIGINT NOT NULL ,
110112 ordinal INTEGER NOT NULL ,
0 commit comments