52 lines
1.4 KiB
SQL
52 lines
1.4 KiB
SQL
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;
|