From 55a94c23081812b0cf0f6d0ac3c6743af754330b Mon Sep 17 00:00:00 2001 From: SnowCode Date: Wed, 8 Sep 2021 21:34:38 +0200 Subject: [PATCH] Adding sql commands --- threadr.sql | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 threadr.sql diff --git a/threadr.sql b/threadr.sql new file mode 100644 index 0000000..f23a0ec --- /dev/null +++ b/threadr.sql @@ -0,0 +1,51 @@ +CREATE DATABASE threadr; +USE threadr; +CREATE TABLE boards( + id INT AUTO_INCREMENT, + name VARCHAR(50), + user_friendly_name VARCHAR(50), + private BOOL, + public_visible BOOL, + PRIMARY KEY (id) +); + +CREATE TABLE posts( + id INT AUTO_INCREMENT, + board_id INT, + user_id INT, + post_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP(), + edit_time TIMESTAMP NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP(), + content TEXT NULL DEFAULT NULL, + attachement_hash BIGINT(20) NULL DEFAULT NULL, + attachement_name VARCHAR(100) NULL DEFAULT NULL, + title VARCHAR(100) NULL DEFAULT NULL, + reply_to INT DEFAULT -1, + PRIMARY KEY (id) +); + +CREATE TABLE profiles( + id INT AUTO_INCREMENT, + email VARCHAR(100), + display_name VARCHAR(50), + status VARCHAR(100), + about TEXT, + website VARCHAR(100), + PRIMARY KEY (id) +); + +CREATE TABLE users( + id INT AUTO_INCREMENT, + name VARCHAR(50), + authentication_string VARCHAR(128), + authentication_salt VARCHAR(128), + authentication_algorithm VARCHAR(128), + time_created TIMESTAMP DEFAULT CURRENT_TIMESTAMP(), + time_altered TIMESTAMP DEFAULT CURRENT_TIMESTAMP() ON UPDATE CURRENT_TIMESTAMP(), + verified BOOLEAN DEFAULT 0, + PRIMARY KEY (id) +); + +CREATE USER 'threadr'@'localhost' IDENTIFIED BY 'azerty'; +GRANT ALL PRIVILEGES ON threadr.* TO 'threadr'@'localhost'; +FLUSH PRIVILEGES; +EXIT;