mirror of
https://github.com/Derpy-Leggies/OnlyLegs.git
synced 2025-06-29 11:36:16 +00:00
Update to reccommended file structure
Use reccommended database structure Switch to SQLite and update scheme along with it
This commit is contained in:
parent
29d204f95e
commit
a499e6c840
41 changed files with 544 additions and 342 deletions
67
gallery/packages/tables/generate.sql
Normal file
67
gallery/packages/tables/generate.sql
Normal file
|
@ -0,0 +1,67 @@
|
|||
CREATE TABLE IF NOT EXISTS users (
|
||||
id INT(69) NOT NULL PRIMARY KEY AUTO_INCREMENT,
|
||||
username VARCHAR(255) NOT NULL UNIQUE,
|
||||
email VARCHAR(255) NOT NULL,
|
||||
password VARCHAR(255) NOT NULL,
|
||||
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS 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 DEFAULT CURRENT_TIMESTAMP,
|
||||
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS groups (
|
||||
id INT(69) PRIMARY KEY AUTO_INCREMENT,
|
||||
author_id INT(69) NOT NULL,
|
||||
name VARCHAR(255) NOT NULL,
|
||||
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS 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 DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS devices (
|
||||
id INT(69) PRIMARY KEY AUTO_INCREMENT,
|
||||
user_id INT(69) NOT NULL,
|
||||
device_id VARCHAR(255) NOT NULL,
|
||||
cookie VARCHAR(255) NOT NULL,
|
||||
ip VARCHAR(255) NOT NULL,
|
||||
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS tokens (
|
||||
id INT(69) PRIMARY KEY AUTO_INCREMENT,
|
||||
token VARCHAR(255) NOT NULL UNIQUE,
|
||||
is_used BOOLEAN NOT NULL DEFAULT FALSE,
|
||||
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS 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 DEFAULT CURRENT_TIMESTAMP
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS 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 DEFAULT CURRENT_TIMESTAMP
|
||||
);
|
Loading…
Add table
Add a link
Reference in a new issue