astral-api/Astral.DAL/Migrations/2024-12-09.04-users.sql

25 lines
896 B
MySQL
Raw Normal View History

2024-12-11 21:36:30 +01:00
CREATE TABLE users
(
id UUID UNIQUE PRIMARY KEY NOT NULL,
createdAt TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL,
updatedAt TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL,
username TEXT UNIQUE NOT NULL,
email TEXT UNIQUE,
authHash TEXT,
authSalt TEXT,
2024-12-14 17:31:17 +01:00
userState SMALLINT DEFAULT NULL,
2024-12-11 21:36:30 +01:00
lastLoggedIn TIMESTAMP DEFAULT NULL,
creatorIp TEXT DEFAULT '0.0.0.0',
2024-12-14 17:31:17 +01:00
role SMALLINT DEFAULT 0 NOT NULL,
2024-12-11 21:36:30 +01:00
state SMALLINT DEFAULT 0 NOT NULL,
connectionGroup UUID DEFAULT NULL,
friendGroup UUID DEFAULT NULL,
language TEXT DEFAULT 'en'
);
CREATE TRIGGER users_updated_at
BEFORE UPDATE
ON users
FOR EACH ROW
EXECUTE PROCEDURE updated_at_timestamp();