Skip to content

Commit

Permalink
Implement database initialization
Browse files Browse the repository at this point in the history
  • Loading branch information
mike-zueff committed Nov 3, 2019
1 parent 9b94559 commit 26978e6
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
@@ -1,5 +1,6 @@
**/*.rs.bk
/config/private_patterns
/config/private_vk_tokens
/database
/notes
/target
1 change: 1 addition & 0 deletions README.md
Expand Up @@ -23,5 +23,6 @@ git clone https://github.com/mike-zueff/social_media_sieve.git
cd social_media_sieve
touch config/private_patterns
touch config/private_vk_tokens
cargo run
```
- TODO
24 changes: 24 additions & 0 deletions src/main.rs
@@ -1,5 +1,29 @@
use rusqlite::*;
use std::*;

/* SMS entry point. */
fn main() {
println!("SMS started.");

match sms_db_init() {
Ok(_) => println!("Database initialization succeeded."),
Err(_) => panic!("Database initialization failed."),
}

println!("SMS stopped.");
}

/* Database initialization. */
fn sms_db_init() -> Result<()> {
let _ = fs::create_dir("database");
let sms_db_conn = Connection::open("database/sms_db_sqlite")?;

let _ = sms_db_conn.execute(
"CREATE TABLE if not exists vor_obl_settlements (
id integer primary key,
settlement_id integer,
settlement_title text
)", NO_PARAMS);

Ok(())
}

0 comments on commit 26978e6

Please sign in to comment.