From 394bcfe59485b96639c35a57e67c2331cf5c434d Mon Sep 17 00:00:00 2001 From: Dennis Kobert Date: Tue, 11 Feb 2020 20:15:10 +0000 Subject: Add certificates to server --- src/main.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src/main.rs') diff --git a/src/main.rs b/src/main.rs index c6b7d86..b0bda1b 100644 --- a/src/main.rs +++ b/src/main.rs @@ -10,12 +10,12 @@ use std::sync::{Arc, Mutex}; lazy_static! { static ref CLIENT: Arc> = Arc::new(Mutex::new( - Client::connect("host=localhost user=postgres password=example", NoTls).unwrap() + Client::connect("host=track_db user=postgres password=example", NoTls).unwrap() )); } fn main() { - //initialize_db().unwrap(); + initialize_db().unwrap(); //setup_db().unwrap(); println!("connected with db"); rocket::ignite() @@ -44,9 +44,11 @@ fn setup_db() -> Result<(), postgres::Error> { fn initialize_db() -> Result<(), postgres::Error> { let mut client = CLIENT.lock().unwrap(); + let _ = client.batch_execute( + "DROP TABLE user_track; DROP TABLE suser; DROP TABLE track;" + ); client.batch_execute( " - DROP TABLE user_track; DROP TABLE suser; DROP TABLE track; CREATE TABLE track ( track_id SERIAL PRIMARY KEY, track_code TEXT NOT NULL UNIQUE, -- cgit v1.2.3-54-g00ecf