You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

13 lines
479 B

-- Database schema initialisation
-- Executed once on the first PostgreSQL startup in Docker
CREATE TABLE users (
id SERIAL PRIMARY KEY,
username VARCHAR(64) UNIQUE NOT NULL,
password TEXT NOT NULL, -- bcrypt hash
role VARCHAR(16) NOT NULL DEFAULT 'user', -- 'user' | 'admin'
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW()
);
-- Index on username (frequently used during login)
CREATE INDEX idx_users_username ON users(username);