summaryrefslogtreecommitdiffstats
path: root/migrations/2020-06-07-160636_create_user/up.sql
blob: e0ee7f44e0ec10a3dc7108be8c68a63f2afeceac (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
CREATE TABLE users (
    id SERIAL NOT NULL PRIMARY KEY,
    power_level INTEGER NOT NULL DEFAULT 0,
    name VARCHAR(32) UNIQUE NOT NULL,
    created timestamp NOT NULL DEFAULT current_timestamp(),
    balance bigint UNSIGNED NOT NULL
);

CREATE TABLE passwords (
    id SERIAL NOT NULL PRIMARY KEY,
    hash CHAR(120) BINARY NOT NULL,
    CONSTRAINT fk_user_id FOREIGN KEY (id) REFERENCES users (id)
);