Adding sql commands

improved_build_instructions
SnowCode 2021-09-08 21:34:38 +02:00
parent 7384091b71
commit 55a94c2308
1 changed files with 51 additions and 0 deletions

51
threadr.sql Normal file
View File

@ -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;