Skip to content

Commit

Permalink
Merge pull request #2512 from HTGAzureX1212/nightly
Browse files Browse the repository at this point in the history
Miscellaneous Updates
  • Loading branch information
HTGAzureX1212 authored Feb 2, 2025
2 parents 07abd89 + f9d71eb commit c66b603
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 24 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
CREATE TABLE IF NOT EXISTS "Nightly"."GuildConfigurations" (
"guild_id" TEXT NOT NULL PRIMARY KEY,
"dashboard_admins" TEXT ARRAY NOT NULL,
"dashboard_editors" TEXT ARRAY NOT NULL,
"dashboard_viewers" TEXT ARRAY NOT NULL,
"appearance_nickname" TEXT NOT NULL,
"appearance_colour" BIGINT NOT NULL,
"enabled_plugins" TEXT ARRAY NOT NULL
);

This file was deleted.

This file was deleted.

This file was deleted.

28 changes: 25 additions & 3 deletions database/hartex-database-migrate/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ mod api_backend {
refinery::embed_migrations!("api-backend-migrations");
}

mod configuration {
refinery::embed_migrations!("configuration-migrations");
}

mod discord_frontend {
refinery::embed_migrations!("discord-frontend-migrations");
}
Expand All @@ -52,7 +56,7 @@ pub async fn main() -> miette::Result<()> {
dotenvy::dotenv().into_diagnostic()?;

log::trace!("establishing database connection: Discord Frontend Migrations");
let url = env::var("HARTEX_NIGHTLY_PGSQL_URL").unwrap();
let url = env::var("DISCORD_FRONTEND_PGSQL_URL").unwrap();
let (mut client, connection) = tokio_postgres::connect(&url, NoTls)
.await
.into_diagnostic()?;
Expand All @@ -70,7 +74,7 @@ pub async fn main() -> miette::Result<()> {
.into_diagnostic()?;

log::trace!("establishing database connection: API Backend Migrations");
let url2 = env::var("API_PGSQL_URL").unwrap();
let url2 = env::var("API_BACKEND_PGSQL_URL").unwrap();
let (mut client2, connection2) = tokio_postgres::connect(&url2, NoTls)
.await
.into_diagnostic()?;
Expand All @@ -81,11 +85,29 @@ pub async fn main() -> miette::Result<()> {
}
});

log::trace!("establishing database connection: API Backend Migrations");
log::trace!("running migrations: API Backend Migrations");
api_backend::migrations::runner()
.run_async(&mut client2)
.await
.into_diagnostic()?;

log::trace!("establishing database connection: CONFIGURATION Migrations");
let url3 = env::var("CONFIGURATION_PGSQL_URL").unwrap();
let (mut client3, connection3) = tokio_postgres::connect(&url3, NoTls)
.await
.into_diagnostic()?;

tokio::spawn(async move {
if let Err(error) = connection3.await {
log::error!("postgres connection error: {error}");
}
});

log::trace!("running migrations: Configuration Migrations");
configuration::migrations::runner()
.run_async(&mut client3)
.await
.into_diagnostic()?;

Ok(())
}
Binary file modified meta/images/hartexbanner.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit c66b603

Please sign in to comment.