introduce sqlx migrations

This commit is contained in:
mykola2312 2024-02-29 16:23:15 +02:00
parent bb0b1a5a00
commit 506a2287b9
2 changed files with 4 additions and 1 deletions

View file

@ -17,6 +17,8 @@ RUN apk add --no-cache libgcc
RUN apk add --no-cache ffmpeg python3 py3-pip RUN apk add --no-cache ffmpeg python3 py3-pip
RUN pip install --break-system-packages yt-dlp RUN pip install --break-system-packages yt-dlp
COPY --from=0 /app/target/release/mk-dl-bot . WORKDIR /app
COPY migrations /app/
COPY --from=0 /app/target/release/mk-dl-bot /app/
ENTRYPOINT ["/mk-dl-bot"] ENTRYPOINT ["/mk-dl-bot"]

View file

@ -50,6 +50,7 @@ pub async fn bot_main() -> anyhow::Result<()> {
} }
let db = SqlitePool::connect(&db_url).await?; let db = SqlitePool::connect(&db_url).await?;
sqlx::migrate!().run(&db).await?;
let bot = Bot::new(env::var("BOT_TOKEN")?); let bot = Bot::new(env::var("BOT_TOKEN")?);
let listener = Polling::builder(bot.clone()) let listener = Polling::builder(bot.clone())