Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Initialize messages database table
  • Loading branch information
john committed Apr 24, 2017
1 parent 6d9a3d5 commit 19cf87b
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions app/database/init.php
Expand Up @@ -22,6 +22,20 @@ $stmt = 'CREATE TABLE IF NOT EXISTS users (
)'; )';
$dbh->exec($stmt); $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 */ /* Create user and admin if they don't exist */
$user = new User; $user = new User;
$user->username = 'user'; $user->username = 'user';
Expand Down

0 comments on commit 19cf87b

Please sign in to comment.