extern crate strum_macros;
#[macro_use]
extern crate lazy_static;
+// this is used in tests
+#[allow(unused_imports)]
+#[macro_use]
+extern crate diesel_migrations;
use diesel::{result::Error, *};
use regex::Regex;
use crate::{get_database_url_from_env, is_email_regex};
use diesel::{Connection, PgConnection};
+ embed_migrations!();
+
pub fn establish_unpooled_connection() -> PgConnection {
let db_url = match get_database_url_from_env() {
Ok(url) => url,
e
),
};
- PgConnection::establish(&db_url).unwrap_or_else(|_| panic!("Error connecting to {}", db_url))
+ let conn =
+ PgConnection::establish(&db_url).unwrap_or_else(|_| panic!("Error connecting to {}", db_url));
+ embedded_migrations::run(&conn).unwrap();
+ conn
}
#[test]