Skip to content
Permalink
Browse files

Initialize messages database table

  • Loading branch information
john committed Apr 24, 2017
1 parent 6d9a3d5 commit 19cf87ba3cd52bec60353a080cb87b3fe220f376
Showing with 14 additions and 0 deletions.
  1. +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';

0 comments on commit 19cf87b

Please sign in to comment.
You can’t perform that action at this time.