galaeth-draft/Galaeth.DAL/Migrations/2024-11-13.02-users.sql

21 lines
521 B
MySQL
Raw Permalink Normal View History

2024-11-17 10:31:01 +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,
state SMALLINT,
role SMALLINT,
lastLoggedIn TIMESTAMP DEFAULT NULL,
creatorIp TEXT DEFAULT '0.0.0.0'
);
CREATE TRIGGER users_updated_at
BEFORE UPDATE
ON users
FOR EACH ROW
EXECUTE PROCEDURE updated_at_timestamp();