CREATE TABLE user (
  id bigint NOT NULL PRIMARY KEY,
  email text NOT NULL UNIQUE,
  password text NOT NULL,
  admin boolean NOT NULL
);


CREATE TABLE member (
  id varchar(7) NOT NULL PRIMARY KEY,
  call_sign text NOT NULL,
  name text NOT NULL,
  registration_token text NOT NULL UNIQUE,
  diploma text,
  hours text[] NOT NULL,
  groups text[] NOT NULL
);


CREATE TABLE session (
  id bigint NOT NULL PRIMARY KEY,
  user_id bigint NOT NULL,
  token text NOT NULL UNIQUE,
  expires timestamp NOT NULL
);


ALTER TABLE session ADD CONSTRAINT session_user_id_fk FOREIGN KEY (user_id) REFERENCES user (id);
