-- This script can be run to create the complete database schema with the following command:
-- mysql -u root -p < create_urban_database.sql
CREATE DATABASE urban;
USE urban;
CREATE TABLE definition (
    defid       INTEGER       PRIMARY KEY NOT NULL,
    word        VARCHAR(128)  NOT NULL,
    author      VARCHAR(128)  NOT NULL,
    -- permalink   VARCHAR(128) NOT NULL,
    definition  VARCHAR(2048) NOT NULL,
    example     VARCHAR(2048) NOT NULL,
    thumbs_up   INTEGER,
    thumbs_down INTEGER
    -- current_vote: ""
);
CREATE USER urbandic IDENTIFIED BY 'MetroSexual';
GRANT SELECT,INSERT,UPDATE ON urban.* TO 'urbandic'@'localhost';
CREATE INDEX authorindex ON definition (author);
CREATE INDEX defidauthorindex ON definition (defid, author);
