Added more tables

Started making table junctions
This commit is contained in:
Michał 2023-01-07 15:27:07 +00:00
parent 463c5ecd03
commit 122b1760cf
4 changed files with 56 additions and 15 deletions

View file

@ -1,7 +0,0 @@
CREATE IF NOT EXISTS TABLE abilities (
id INT(69) PRIMARY KEY AUTO_INCREMENT,
user INT(69) NOT NULL,
admin BOOLEAN NOT NULL DEFAULT FALSE,
create_posts BOOLEAN NOT NULL DEFAULT TRUE,
updated_at TIMESTAMP NOT NULL DEFAULT NOW() ON UPDATE NOW()
);

View file

@ -0,0 +1,51 @@
CREATE IF NOT EXISTS TABLE users (
id INT(69) PRIMARY KEY AUTO_INCREMENT,
username VARCHAR(255) NOT NULL UNIQUE,
email VARCHAR(255) NOT NULL,
password VARCHAR(255) NOT NULL,
created_at TIMESTAMP NOT NULL DEFAULT NOW(),
updated_at TIMESTAMP NOT NULL DEFAULT NOW() ON UPDATE NOW()
);
CREATE IF NOT EXISTS TABLE posts (
id INT(69) PRIMARY KEY AUTO_INCREMENT,
file_name VARCHAR(255) NOT NULL UNIQUE,
author_id INT(69) NOT NULL,
description TEXT NOT NULL,
alt TEXT NOT NULL,
created_at TIMESTAMP NOT NULL DEFAULT NOW(),
updated_at TIMESTAMP NOT NULL DEFAULT NOW() ON UPDATE NOW()
);
CREATE IF NOT EXISTS TABLE groups (
id INT(69) PRIMARY KEY AUTO_INCREMENT,
author_id INT(69) NOT NULL,
name VARCHAR(255) NOT NULL,
created_at TIMESTAMP NOT NULL DEFAULT NOW(),
updated_at TIMESTAMP NOT NULL DEFAULT NOW() ON UPDATE NOW()
);
CREATE IF NOT EXISTS TABLE permissions (
id INT(69) PRIMARY KEY AUTO_INCREMENT,
user_id INT(69) NOT NULL,
admin BOOLEAN NOT NULL DEFAULT FALSE,
create_posts BOOLEAN NOT NULL DEFAULT TRUE,
updated_at TIMESTAMP NOT NULL DEFAULT NOW() ON UPDATE NOW()
);
CREATE IF NOT EXISTS TABLE logs (
id INT(69) PRIMARY KEY AUTO_INCREMENT,
ip VARCHAR(255) NOT NULL,
user_id INT(69) DEFAULT NULL,
code INT(69) NOT NULL,
note TEXT DEFAULT NULL,
created_at TIMESTAMP NOT NULL DEFAULT NOW()
);
CREATE IF NOT EXISTS TABLE bans (
id INT(69) PRIMARY KEY AUTO_INCREMENT,
ip VARCHAR(255) NOT NULL,
code INT(69) NOT NULL,
note TEXT DEFAULT NULL,
created_at TIMESTAMP NOT NULL DEFAULT NOW()
);

View file

@ -0,0 +1,5 @@
CREATE IF NOT EXISTS TABLE group_junction (
id INT(69) PRIMARY KEY AUTO_INCREMENT,
group_id INT(69) NOT NULL,
image_id INT(69) NOT NULL
);

View file

@ -1,8 +0,0 @@
CREATE IF NOT EXISTS TABLE users (
id INT(69) PRIMARY KEY AUTO_INCREMENT,
username VARCHAR(255) NOT NULL,
email VARCHAR(255) NOT NULL,
password VARCHAR(255) NOT NULL,
created_at TIMESTAMP NOT NULL DEFAULT NOW(),
updated_at TIMESTAMP NOT NULL DEFAULT NOW() ON UPDATE NOW()
);