mirror of
https://github.com/wlinator/luminara.git
synced 2024-10-02 22:23:13 +00:00
Fix migrations to avoid conflicts and replacing values
This commit is contained in:
parent
cf8058c46e
commit
baac81c302
5 changed files with 22 additions and 22 deletions
|
@ -1,6 +1,6 @@
|
||||||
TOKEN=
|
TOKEN=
|
||||||
INSTANCE=
|
INSTANCE=
|
||||||
OWNER_IDS=
|
OWNER_ID=
|
||||||
|
|
||||||
XP_GAIN_PER_MESSAGE=
|
XP_GAIN_PER_MESSAGE=
|
||||||
XP_GAIN_COOLDOWN=
|
XP_GAIN_COOLDOWN=
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
SET FOREIGN_KEY_CHECKS=0;
|
SET FOREIGN_KEY_CHECKS=0;
|
||||||
|
|
||||||
CREATE TABLE xp (
|
CREATE TABLE IF NOT EXISTS xp (
|
||||||
user_id BIGINT NOT NULL,
|
user_id BIGINT NOT NULL,
|
||||||
guild_id BIGINT NOT NULL,
|
guild_id BIGINT NOT NULL,
|
||||||
user_xp INT NOT NULL,
|
user_xp INT NOT NULL,
|
||||||
|
@ -9,13 +9,13 @@ CREATE TABLE xp (
|
||||||
PRIMARY KEY (user_id, guild_id)
|
PRIMARY KEY (user_id, guild_id)
|
||||||
);
|
);
|
||||||
|
|
||||||
CREATE TABLE currency (
|
CREATE TABLE IF NOT EXISTS currency (
|
||||||
user_id BIGINT NOT NULL,
|
user_id BIGINT NOT NULL,
|
||||||
balance BIGINT NOT NULL,
|
balance BIGINT NOT NULL,
|
||||||
PRIMARY KEY (user_id)
|
PRIMARY KEY (user_id)
|
||||||
);
|
);
|
||||||
|
|
||||||
CREATE TABLE blackjack (
|
CREATE TABLE IF NOT EXISTS blackjack (
|
||||||
id INT AUTO_INCREMENT,
|
id INT AUTO_INCREMENT,
|
||||||
user_id BIGINT,
|
user_id BIGINT,
|
||||||
is_won BOOLEAN,
|
is_won BOOLEAN,
|
||||||
|
@ -26,7 +26,7 @@ CREATE TABLE blackjack (
|
||||||
PRIMARY KEY (id)
|
PRIMARY KEY (id)
|
||||||
);
|
);
|
||||||
|
|
||||||
CREATE TABLE slots (
|
CREATE TABLE IF NOT EXISTS slots (
|
||||||
id INT AUTO_INCREMENT,
|
id INT AUTO_INCREMENT,
|
||||||
user_id BIGINT,
|
user_id BIGINT,
|
||||||
is_won BOOLEAN,
|
is_won BOOLEAN,
|
||||||
|
@ -37,7 +37,7 @@ CREATE TABLE slots (
|
||||||
PRIMARY KEY (id)
|
PRIMARY KEY (id)
|
||||||
);
|
);
|
||||||
|
|
||||||
CREATE TABLE dailies (
|
CREATE TABLE IF NOT EXISTS dailies (
|
||||||
id INT AUTO_INCREMENT,
|
id INT AUTO_INCREMENT,
|
||||||
user_id BIGINT,
|
user_id BIGINT,
|
||||||
amount BIGINT,
|
amount BIGINT,
|
||||||
|
@ -46,7 +46,7 @@ CREATE TABLE dailies (
|
||||||
PRIMARY KEY (id)
|
PRIMARY KEY (id)
|
||||||
);
|
);
|
||||||
|
|
||||||
CREATE TABLE item (
|
CREATE TABLE IF NOT EXISTS item (
|
||||||
id INT AUTO_INCREMENT,
|
id INT AUTO_INCREMENT,
|
||||||
name TEXT,
|
name TEXT,
|
||||||
display_name TEXT,
|
display_name TEXT,
|
||||||
|
@ -58,7 +58,7 @@ CREATE TABLE item (
|
||||||
PRIMARY KEY (id)
|
PRIMARY KEY (id)
|
||||||
);
|
);
|
||||||
|
|
||||||
CREATE TABLE inventory (
|
CREATE TABLE IF NOT EXISTS inventory (
|
||||||
user_id BIGINT,
|
user_id BIGINT,
|
||||||
item_id INT,
|
item_id INT,
|
||||||
quantity INT,
|
quantity INT,
|
||||||
|
@ -67,14 +67,14 @@ CREATE TABLE inventory (
|
||||||
FOREIGN KEY (item_id) REFERENCES item (id)
|
FOREIGN KEY (item_id) REFERENCES item (id)
|
||||||
);
|
);
|
||||||
|
|
||||||
CREATE TABLE birthdays (
|
CREATE TABLE IF NOT EXISTS birthdays (
|
||||||
user_id BIGINT NOT NULL,
|
user_id BIGINT NOT NULL,
|
||||||
guild_id BIGINT NOT NULL,
|
guild_id BIGINT NOT NULL,
|
||||||
birthday DATETIME DEFAULT NULL,
|
birthday DATETIME DEFAULT NULL,
|
||||||
PRIMARY KEY (user_id, guild_id)
|
PRIMARY KEY (user_id, guild_id)
|
||||||
);
|
);
|
||||||
|
|
||||||
CREATE TABLE guild_config (
|
CREATE TABLE IF NOT EXISTS guild_config (
|
||||||
guild_id BIGINT NOT NULL,
|
guild_id BIGINT NOT NULL,
|
||||||
prefix TINYTEXT,
|
prefix TINYTEXT,
|
||||||
birthday_channel_id BIGINT,
|
birthday_channel_id BIGINT,
|
||||||
|
@ -91,7 +91,7 @@ CREATE TABLE guild_config (
|
||||||
PRIMARY KEY (guild_id)
|
PRIMARY KEY (guild_id)
|
||||||
);
|
);
|
||||||
|
|
||||||
CREATE TABLE level_rewards (
|
CREATE TABLE IF NOT EXISTS level_rewards (
|
||||||
guild_id BIGINT NOT NULL,
|
guild_id BIGINT NOT NULL,
|
||||||
level INT NOT NULL,
|
level INT NOT NULL,
|
||||||
role_id BIGINT,
|
role_id BIGINT,
|
||||||
|
@ -100,7 +100,7 @@ CREATE TABLE level_rewards (
|
||||||
PRIMARY KEY (guild_id, level)
|
PRIMARY KEY (guild_id, level)
|
||||||
);
|
);
|
||||||
|
|
||||||
CREATE TABLE blacklist_user (
|
CREATE TABLE IF NOT EXISTS blacklist_user (
|
||||||
user_id BIGINT NOT NULL,
|
user_id BIGINT NOT NULL,
|
||||||
reason TEXT,
|
reason TEXT,
|
||||||
timestamp TIMESTAMP NOT NULL DEFAULT NOW(),
|
timestamp TIMESTAMP NOT NULL DEFAULT NOW(),
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
-- Create a table to store custom reactions
|
-- Create a table to store custom reactions
|
||||||
CREATE TABLE custom_reactions (
|
CREATE TABLE IF NOT EXISTS custom_reactions (
|
||||||
id SERIAL PRIMARY KEY, -- Unique identifier for each custom reaction
|
id SERIAL PRIMARY KEY, -- Unique identifier for each custom reaction
|
||||||
trigger_text TEXT NOT NULL, -- The text that triggers the custom reaction
|
trigger_text TEXT NOT NULL, -- The text that triggers the custom reaction
|
||||||
response TEXT, -- The response text for the custom reaction (nullable for emoji reactions)
|
response TEXT, -- The response text for the custom reaction (nullable for emoji reactions)
|
||||||
|
@ -16,6 +16,6 @@ CREATE TABLE custom_reactions (
|
||||||
);
|
);
|
||||||
|
|
||||||
-- Create indexes to speed up lookups
|
-- Create indexes to speed up lookups
|
||||||
CREATE INDEX idx_custom_reactions_guild_id ON custom_reactions(guild_id);
|
CREATE OR REPLACE INDEX idx_custom_reactions_guild_id ON custom_reactions(guild_id);
|
||||||
CREATE INDEX idx_custom_reactions_creator_id ON custom_reactions(creator_id);
|
CREATE OR REPLACE INDEX idx_custom_reactions_creator_id ON custom_reactions(creator_id);
|
||||||
CREATE INDEX idx_custom_reactions_trigger_text ON custom_reactions(trigger_text);
|
CREATE OR REPLACE INDEX idx_custom_reactions_trigger_text ON custom_reactions(trigger_text);
|
||||||
|
|
|
@ -39,7 +39,7 @@ CREATE TABLE IF NOT EXISTS cases (
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
CREATE INDEX idx_cases_guild_id ON cases(guild_id);
|
CREATE OR REPLACE INDEX idx_cases_guild_id ON cases(guild_id);
|
||||||
CREATE INDEX idx_cases_target_id ON cases(target_id);
|
CREATE OR REPLACE INDEX idx_cases_target_id ON cases(target_id);
|
||||||
CREATE INDEX idx_cases_moderator_id ON cases(moderator_id);
|
CREATE OR REPLACE INDEX idx_cases_moderator_id ON cases(moderator_id);
|
||||||
CREATE INDEX idx_cases_action_type ON cases(action_type);
|
CREATE OR REPLACE INDEX idx_cases_action_type ON cases(action_type);
|
|
@ -19,8 +19,8 @@ class Constants:
|
||||||
INSTANCE: Optional[str] = os.environ.get("INSTANCE", None)
|
INSTANCE: Optional[str] = os.environ.get("INSTANCE", None)
|
||||||
|
|
||||||
OWNER_IDS: Optional[Set[int]] = (
|
OWNER_IDS: Optional[Set[int]] = (
|
||||||
{int(id.strip()) for id in os.environ.get("OWNER_IDS", "").split(",") if id}
|
{int(id.strip()) for id in os.environ.get("OWNER_ID", "").split(",") if id}
|
||||||
if os.environ.get("OWNER_IDS")
|
if os.environ.get("OWNER_ID")
|
||||||
else None
|
else None
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue