CREATE TABLE IF NOT EXISTS urls ( id SERIAL PRIMARY KEY, url TEXT NOT NULL, timestamp TEXT NOT NULL ); CREATE TABLE IF NOT EXISTS item_log ( id SERIAL PRIMARY KEY, module TEXT NOT NULL, name TEXT NOT NULL, url TEXT NOT NULL, timestamp TEXT NOT NULL, CONSTRAINT unique_module_name_url UNIQUE (module, name, url) );