Dohman
Dohman
Explore posts from servers
AOAnswer Overflow
Created by Dohman on 7/16/2023 in #questions
How do I know whether everything has been setup?
The onboarding process was quite confusing. Would be good to point out that /channel_settings is a Discord bot command and not, eg. a an addition to the URL to which you get redirected after successfully adding the bot to your server. Afterwards, I accidentally closed the tab in the onboarding process and I can't seem to get back to onboarding so I've lost the steps that need to be taken. This now brings me to the question of; how do I know if I got it right? I've done the /channel_settings stuff to enable access to our #help forum but I don't see any changes in the dashboard.
8 replies
SShuttle
Created by Dohman on 6/28/2023 in #help
Issues with accessing console
15 replies
SShuttle
Created by Dohman on 5/25/2023 in #help
Integrating Diesel into Rocket 0.5
@womble73 I created a very basic shuttle instance based off the documentation. I have been distracted on another project, but I really struggled to understand how I would integrate diesel into the mix as Rocket 0.5 has moved over to using stages as preferred methods of loading databases etc. So in my example the stage for loading postgres looks like this:
use rocket::{fairing::AdHoc, Rocket, Build};

use rocket_sync_db_pools::diesel;
use crate::diesel_migrations::{MigrationHarness, EmbeddedMigrations};

const MIGRATIONS: EmbeddedMigrations = embed_migrations!("db/migrations");

#[database("db")]
pub struct Db(diesel::PgConnection);

async fn run_migrations(rocket: Rocket<Build>) -> Rocket<Build> {
let conn = Db::get_one(&rocket).await.expect("database connection");
conn.run(|c| { c.run_pending_migrations(MIGRATIONS).unwrap(); }).await;
rocket
}

pub(crate) fn stage() -> AdHoc {
AdHoc::on_ignite("Diesel Postgres Stage", |rocket| async {
rocket.attach(Db::fairing())
.attach(AdHoc::on_ignite("Diesel Migrations", run_migrations))
})
}
use rocket::{fairing::AdHoc, Rocket, Build};

use rocket_sync_db_pools::diesel;
use crate::diesel_migrations::{MigrationHarness, EmbeddedMigrations};

const MIGRATIONS: EmbeddedMigrations = embed_migrations!("db/migrations");

#[database("db")]
pub struct Db(diesel::PgConnection);

async fn run_migrations(rocket: Rocket<Build>) -> Rocket<Build> {
let conn = Db::get_one(&rocket).await.expect("database connection");
conn.run(|c| { c.run_pending_migrations(MIGRATIONS).unwrap(); }).await;
rocket
}

pub(crate) fn stage() -> AdHoc {
AdHoc::on_ignite("Diesel Postgres Stage", |rocket| async {
rocket.attach(Db::fairing())
.attach(AdHoc::on_ignite("Diesel Migrations", run_migrations))
})
}
4 replies