Permalink
Browse files
Initialize messages database table
- Loading branch information
Showing
with
14 additions
and
0 deletions.
-
+14
−0
app/database/init.php
|
@@ -22,6 +22,20 @@ |
|
|
)'; |
|
|
$dbh->exec($stmt); |
|
|
|
|
|
/* Create messages table if it doesn't exitst */ |
|
|
$stmt = 'CREATE TABLE IF NOT EXISTS messages ( |
|
|
id INT UNSIGNED AUTO_INCREMENT PRIMARY KEY, |
|
|
message TEXT NOT NULL, |
|
|
sender_id INT UNSIGNED NOT NULL, |
|
|
receiver_id INT UNSIGNED NOT NULL, |
|
|
enc_keys VARCHAR(64) NOT NULL, |
|
|
keys_iv VARCHAR(24) NOT NULL, |
|
|
message_iv VARCHAR(24) NOT NULL, |
|
|
FOREIGN KEY (sender_id) REFERENCES users(id), |
|
|
FOREIGN KEY (receiver_id) REFERENCES users(id) |
|
|
)'; |
|
|
$dbh->exec($stmt); |
|
|
|
|
|
/* Create user and admin if they don't exist */ |
|
|
$user = new User; |
|
|
$user->username = 'user'; |
|
|