update script sql
This commit is contained in:
parent
b5e63efb62
commit
ff5d95695e
@ -37,7 +37,7 @@ CREATE TABLE member
|
||||
username VARCHAR(255),
|
||||
points bigint DEFAULT 50 NOT NULL CHECK (points >= 50),
|
||||
bet_value bigint DEFAULT 50,
|
||||
PRIMARY KEY (user_id),
|
||||
PRIMARY KEY (guild_id, user_id),
|
||||
FOREIGN KEY (guild_id) REFERENCES guild (guild_id)
|
||||
);
|
||||
|
||||
@ -49,7 +49,7 @@ CREATE TABLE vote_member
|
||||
poll_id UUID,
|
||||
bet_value bigint DEFAULT 50,
|
||||
FOREIGN KEY (guild_id) REFERENCES guild (guild_id),
|
||||
FOREIGN KEY (user_id) REFERENCES member (user_id),
|
||||
FOREIGN KEY (guild_id, user_id) REFERENCES member (guild_id, user_id),
|
||||
FOREIGN KEY (vote_id) REFERENCES vote (vote_id),
|
||||
FOREIGN KEY (poll_id) REFERENCES poll (poll_id)
|
||||
);
|
@ -221,10 +221,10 @@ client.on(Events.InteractionCreate, async interaction => {
|
||||
|
||||
async function createGuildAndUserIfNecessary(guildId, user) {
|
||||
if (!await guildExistsInDB(guildId)) {
|
||||
insertGuildIntoDB(guildId);
|
||||
await insertGuildIntoDB(guildId);
|
||||
}
|
||||
if (!await userExistsInDB(user.id, guildId)) {
|
||||
insertUserIntoDB(user.id, guildId, user.username);
|
||||
await insertUserIntoDB(user.id, guildId, user.username);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user