pun1sh3r/facebot — pull request #2 by Logic-gate (2014-08-25 09:31:00+00:00)
Title: DB Creation & config file

Before you merge, please check if the db schema is correct. I did not test it.
We should consider better error handling https://github.com/Logic-gate/facebot/blob/master/masterBot.py#L77

* `db.py` create db. executed via `masterbot` https://github.com/Logic-gate/facebot/blob/master/masterBot.py#L69

-DB SCHEMA:

```
+------------------+
| Tables_in_fbotDB |
+------------------+
| checkins |
| family |
| fbids |
| users |
+------------------+

mysql> show columns from fbids;
+---------+-------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+---------+-------------+------+-----+---------+-------+
| fbids | bigint(20) | YES | | NULL | |
| sent | text | YES | | NULL | |
| crawled | varchar(20) | YES | | NULL | |
+---------+-------------+------+-----+---------+-------+

mysql> show columns from users;
+----------------------+--------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+----------------------+--------------+------+-----+---------+-------+
| fbid | bigint(20) | YES | | NULL | |
| profile_url | text | YES | | NULL | |
| name | text | YES | | NULL | |
| contact_email | text | YES | | NULL | |
| interests | text | YES | | NULL | |
| birthday | varchar(20) | YES | | NULL | |
| hometown_location | text | YES | | NULL | |
| relationship_status | text | YES | | NULL | |
| significant_other_id | text | YES | | NULL | |
| education | text | YES | | NULL | |
| work | varchar(100) | YES | | NULL | |
| sex | text | YES | | NULL | |
| devices | varchar(100) | YES | | NULL | |
+----------------------+--------------+------+-----+---------+-------+

mysql> show columns from checkins;
+------------+------------+------+-----+-------------------+-----------------------------+
| Field | Type | Null | Key | Default | Extra |
+------------+------------+------+-----+-------------------+-----------------------------+
| checkin_id | char(32) | YES | | NULL | |
| fbid | bigint(20) | YES | | NULL | |
| message | text | YES | | NULL | |
| coords | text | YES | | NULL | |
| timestamp | timestamp | NO | | CURRENT_TIMESTAMP | on update CURRENT_TIMESTAMP |
+------------+------------+------+-----+-------------------+-----------------------------+

mysql> show columns from family;
+--------------+--------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+--------------+--------------+------+-----+---------+-------+
| fbid | bigint(20) | YES | | NULL | |
| relative_id | char(32) | YES | | NULL | |
| name | varchar(80) | YES | | NULL | |
| relationship | varchar(100) | YES | | NULL | |
+--------------+--------------+------+-----+---------+-------+
```

* `conf/info.conf`. Config file to hold db info
- `host`
- `user`
- `password`
- `dbname`

`masterBot.py` and `db.py` require it; https://github.com/Logic-gate/facebot/blob/master/masterBot.py#L55