Rename table references

This commit is contained in:
jude 2024-02-14 19:44:53 +00:00
parent 96012ce43c
commit 2f6d035efe
4 changed files with 11 additions and 10 deletions

View File

@ -21,11 +21,12 @@ pub async fn timezone_autocomplete(ctx: Context<'_>, partial: &str) -> Vec<Strin
pub async fn macro_name_autocomplete(ctx: Context<'_>, partial: &str) -> Vec<String> {
sqlx::query!(
"
SELECT name
FROM macro
WHERE
guild_id = (SELECT id FROM guilds WHERE guild = ?)
AND name LIKE CONCAT(?, '%')",
SELECT name
FROM command_macro
WHERE
guild_id = (SELECT id FROM guilds WHERE guild = ?)
AND name LIKE CONCAT(?, '%')
",
ctx.guild_id().unwrap().get(),
partial,
)

View File

@ -18,7 +18,7 @@ pub async fn delete_macro(
match sqlx::query!(
"
SELECT m.id
FROM macro m
FROM command_macro m
INNER JOIN guilds
ON guilds.guild = m.guild_id
WHERE guild = ?
@ -31,7 +31,7 @@ pub async fn delete_macro(
.await
{
Ok(row) => {
sqlx::query!("DELETE FROM macro WHERE id = ?", row.id)
sqlx::query!("DELETE FROM command_macro WHERE id = ?", row.id)
.execute(&ctx.data().database)
.await
.unwrap();

View File

@ -34,7 +34,7 @@ pub async fn record_macro(
let row = sqlx::query!(
"
SELECT 1 as _e
FROM macro
FROM command_macro
WHERE guild_id = (SELECT id FROM guilds WHERE guild = ?)
AND name = ?
",
@ -131,7 +131,7 @@ pub async fn finish_macro(ctx: Context<'_>) -> Result<(), Error> {
let json = serde_json::to_string(&command_macro.commands).unwrap();
sqlx::query!(
"INSERT INTO macro (guild_id, name, description, commands) VALUES ((SELECT id FROM guilds WHERE guild = ?), ?, ?, ?)",
"INSERT INTO command_macro (guild_id, name, description, commands) VALUES ((SELECT id FROM guilds WHERE guild = ?), ?, ?, ?)",
command_macro.guild_id.get(),
command_macro.name,
command_macro.description,

View File

@ -55,7 +55,7 @@ pub async fn guild_command_macro(ctx: &Context<'_>, name: &str) -> Option<Comman
let row = sqlx::query!(
"
SELECT m.id, m.name, m.description, m.commands
FROM macro m
FROM command_macro m
INNER JOIN guilds g
ON g.id = m.guild_id
WHERE guild = ?