CREATE DATABASE CalendarWebapp;
USE CalendarWebapp;

CREATE TABLE users (
  id MEDIUMINT UNSIGNED NOT NULL AUTO_INCREMENT,
  username CHAR(30) NOT NULL UNIQUE,
  password CHAR(60) NOT NULL,
  PRIMARY KEY (id)
);

CREATE TABLE events (
  id MEDIUMINT UNSIGNED NOT NULL AUTO_INCREMENT,
  begin DATE NOT NULL,
  end DATE,
  name CHAR(128) NOT NULL,
  description TEXT NOT NULL,
  type TINYINT UNSIGNED NOT NULL,
  shout BOOLEAN NOT NULL,
  PRIMARY KEY (id)
);

INSERT INTO users (username, password) VALUES ('foo',
'$2a$10$9LBqOZV99ARiE4Nx.2b7GeYfqk2.0A32PWGu2cRGyW2hRJ0xeDfnO');
