1
Fork 0
photoview/api/database/migrations/0001_init.up.sql

20 lines
486 B
MySQL
Raw Normal View History

2020-01-31 15:22:58 +01:00
CREATE TABLE IF NOT EXISTS users (
user_id int NOT NULL AUTO_INCREMENT,
2020-01-31 17:36:48 +01:00
username varchar(255) NOT NULL UNIQUE,
2020-01-31 15:22:58 +01:00
password varchar(255) NOT NULL,
2020-01-31 17:36:48 +01:00
root_path varchar(512),
admin boolean NOT NULL DEFAULT 0,
2020-01-31 15:22:58 +01:00
PRIMARY KEY (user_id)
);
2020-01-31 18:51:24 +01:00
CREATE TABLE IF NOT EXISTS access_tokens (
token_id int NOT NULL AUTO_INCREMENT,
user_id int NOT NULL,
value char(24) NOT NULL UNIQUE,
expire timestamp NOT NULL,
PRIMARY KEY (token_id),
FOREIGN KEY (user_id) REFERENCES users(user_id)
);