PRAGMA foreign_keys = ON;

DROP TABLE item;
DROP TABLE queue;

CREATE TABLE queue(
    name            VARCHAR(100) PRIMARY KEY,
    endpoint_url    VARCHAR(200)
);

CREATE TABLE item(
    id              CHAR(13),
    queue_name      VARCHAR(100) NOT NULL,
    created         INTEGER NOT NULL,
    headers         CLOB NOT NULL,
    PRIMARY KEY (id, queue_name),
    FOREIGN KEY(queue_name) REFERENCES queue(name)
);

INSERT INTO queue VALUES('a', NULL);
INSERT INTO queue VALUES('github', NULL);
INSERT INTO queue VALUES('b', "http://trygvis.dyndns.org/~trygvis/2012/02/http-mq/endpoint.php");
-- INSERT INTO item VALUES('1', 'a', datetime('now'));
-- INSERT INTO item VALUES('1', 'b', datetime('now'));
