CREATE TABLE IF NOT EXISTS github_repository ( id bigint PRIMARY KEY, name varchar(255) NOT NULL, stars int NOT NULL DEFAULT 0, issues int NOT NULL DEFAULT 0, pull_requests int NOT NULL DEFAULT 0, forks int NOT NULL DEFAULT 0, forked_from bigint NULL REFERENCES github_repository (id) ON DELETE SET NULL ); CREATE TABLE IF NOT EXISTS github_release ( id bigint PRIMARY KEY, repo_id bigint NOT NULL REFERENCES github_repository (id) ON DELETE CASCADE, timestamp timestamp NOT NULL, tag_name varchar(255) NOT NULL ); CREATE TABLE IF NOT EXISTS github_event_package ( id timestamp PRIMARY KEY, last_event varchar NULL, done boolean NOT NULL DEFAULT FALSE, last_error text NULL );