oxicloud/migrations/20231220121329_users.sql
2024-04-11 21:14:09 +02:00

20 lines
523 B
SQL

-- Add migration script here
CREATE TABLE users (
id INT UNSIGNED NOT NULL AUTO_INCREMENT,
oidc_id VARCHAR(48) NOT NULL,
name VARCHAR(128) NOT NULL,
PRIMARY KEY (id),
UNIQUE (oidc_id),
FULLTEXT (name)
);
CREATE TABLE user_tokens (
id int UNSIGNED NOT NULL AUTO_INCREMENT,
user_id INT UNSIGNED NOT NULL,
name VARCHAR(255) NOT NULL,
hash BINARY(32) NOT NULL,
PRIMARY KEY (id),
CONSTRAINT fk_users_app_passords FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE
);