CREATE TABLE job (
    id SERIAL PRIMARY KEY,
    title varchar,
    description varchar,
    created TIMESTAMP WITH TIME ZONE,
    modified TIMESTAMP WITH TIME ZONE,
    travel_percent varchar,
    on_site varchar,
    time_percent varchar
);

CREATE TABLE skill (
    id SERIAL PRIMARY KEY,
    ident varchar,
    description varchar,
    created TIMESTAMP WITH TIME ZONE,
    modified TIMESTAMP WITH TIME ZONE
);

INSERT INTO skill ( ident, description )
    VALUES ( 'drive', 'Valid driver license and clean record' );

INSERT INTO skill ( ident, description )
    VALUES ( 'coffee', 'Ability to brew excellent coffee from bad grounds' );

INSERT INTO skill ( ident, description )
    VALUES ( 'bigtop_exp', '5+ years bigtop experience' );

INSERT INTO skill ( ident, description )
    VALUES ( 'bigtop', 'Experience with bigtop' );

CREATE TABLE position (
    id SERIAL PRIMARY KEY,
    n_openings int4,
    location varchar,
    created TIMESTAMP WITH TIME ZONE,
    modified TIMESTAMP WITH TIME ZONE,
    job int4,
    closes date,
    boss varchar,
    pay varchar
);

CREATE TABLE job_skill (
    id SERIAL PRIMARY KEY,
    job int4,
    skill int4
);
CREATE TABLE user (
    id SERIAL PRIMARY KEY,
    ident varchar,
    password varchar,
    created TIMESTAMP WITH TIME ZONE,
    modified TIMESTAMP WITH TIME ZONE,
    first_name varchar,
    last_name varchar,
    email varchar
);

INSERT INTO user ( ident, first_name, last_name, password )
    VALUES ( 'pcrow', 'Phil', 'Crow', 'test' );

INSERT INTO user ( ident, first_name, last_name, password )
    VALUES ( 'lcrow', 'Lisa', 'Crow', 'test' );

CREATE TABLE grouping (
    id SERIAL PRIMARY KEY,
    ident varchar,
    description varchar,
    created TIMESTAMP WITH TIME ZONE,
    modified TIMESTAMP WITH TIME ZONE
);

INSERT INTO grouping ( ident, description )
    VALUES ( 'HR', 'Human Resources Staff' );

CREATE TABLE user_grouping (
    id SERIAL PRIMARY KEY,
    user int4,
    grouping int4
);

INSERT INTO user_grouping ( user, grouping )
    VALUES ( 1, 1 );

CREATE TABLE change_log (
    id SERIAL PRIMARY KEY,
    ident varchar,
    description varchar,
    created TIMESTAMP WITH TIME ZONE,
    modified TIMESTAMP WITH TIME ZONE,
    user int4
);

