Skip to content

Commit

Permalink
add diesel migration
Browse files Browse the repository at this point in the history
  • Loading branch information
hails committed Mar 21, 2020
1 parent fb909d9 commit 2480641
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 0 deletions.
32 changes: 32 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,4 @@ dotenv = "0.15.0"
uuid = "0.6"
chrono = "0.4.11"
md5 = "0.7.0"
diesel_migrations = "1.4.0"
5 changes: 5 additions & 0 deletions diesel.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# For documentation on how to configure this file,
# see diesel.rs/guides/configuring-diesel-cli

[print_schema]
file = "src/schema.rs"
7 changes: 7 additions & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ extern crate diesel;

use std::env;

#[macro_use]
extern crate diesel_migrations;
use futures::StreamExt;
use telegram_bot::*;

Expand All @@ -13,8 +15,13 @@ mod process;
mod scheduler;
mod schema;

embed_migrations!();

#[tokio::main]
async fn main() -> Result<(), Error> {
let db_connection = database::establish_connection();
embedded_migrations::run(&db_connection).unwrap();

let token = env::var("TELEGRAM_BOT_TOKEN").expect("TELEGRAM_BOT_TOKEN not set");
let api = Api::new(&token);

Expand Down

0 comments on commit 2480641

Please sign in to comment.