DROP TABLE IF EXISTS station;
DROP TABLE IF EXISTS user;
DROP TABLE IF EXISTS turn;

CREATE TABLE station (
  s_id INTEGER PRIMARY KEY AUTOINCREMENT,
  nombre_empleado CHAR(20)  NOT NULL,
  oficina CHAR(20) NOT NULL,
  last_turn INTEGER NOT NULL
);

CREATE TABLE user (
  u_id INTEGER PRIMARY KEY AUTOINCREMENT,
  uName CHAR(20) NOT NULL,
  isAdmin BIT NOT NULL,
  email CHAR(30) NOT NULL
);

CREATE TABLE turno (
 t_id INTEGER PRIMARY KEY AUTOINCREMENT,
 cName CHAR(20) NOT NULL, 
 cEmail CHAR(30) NOT NULL, 
 purpose CHAR(40), 
 turn INTEGER NOT NULL, 
 timeArrival CHAR(5) NOT NULL, 
 timeEnter CHAR(5),
 station INTEGER NOT NULL, 
 FOREIGN KEY (station) REFERENCES station (s_id) 
);

