DROP TABLE files;
DROP TABLE original;
DROP TABLE person;

CREATE TABLE files (
    hash CHAR(40),
    path TEXT
);

CREATE TABLE person (
    uid SERIAL UNIQUE,
    username TEXT,
    name TEXT
);

INSERT INTO person (username, name) VALUES ('wathiede', 'Bill Thiede');

CREATE TABLE original (
    uid INTEGER REFERENCES person (uid),
    hash CHAR(40) PRIMARY KEY,
    header_size INTEGER,
    total_size INTEGER,
    blob BYTEA
);

CREATE INDEX ON original (hash);
