summaryrefslogtreecommitdiff
path: root/src/main.rs
diff options
context:
space:
mode:
authorCara Salter <cara@devcara.com>2022-05-30 00:03:24 -0400
committerCara Salter <cara@devcara.com>2022-05-30 00:03:24 -0400
commit3eba02283648ab8ceb97e5088c3baf372faa33bc (patch)
treed5bdb07183d9c8bd49437ae35737f411c0f678f2 /src/main.rs
parent3ec1485ae7856e76db8eb2f305ef5950e60f7d8c (diff)
downloadhomeworld-3eba02283648ab8ceb97e5088c3baf372faa33bc.tar.gz
homeworld-3eba02283648ab8ceb97e5088c3baf372faa33bc.zip
sql: Embed migrations within binary
Also runs on startup to make upgrading easier
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/main.rs b/src/main.rs
index 65a32d4..355cc88 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -39,6 +39,10 @@ async fn main() {
let mut conn = PgPoolOptions::new()
.max_connections(5)
.connect(&std::env::var("DATABASE_URL").unwrap_or("postgres://postgres@localhost/homeworld".to_string())).await.unwrap();
+
+ sqlx::migrate!("./migrations")
+ .run(&conn)
+ .await.unwrap();
let shared_state = Arc::new(State {
conn