librepages/migrations/20221220010013_librepages_gitea_webhooks.sql

16 lines
690 B
MySQL
Raw Permalink Normal View History

2022-12-20 07:11:21 +05:30
CREATE TABLE IF NOT EXISTS librepages_gitea_webhooks (
gitea_webhook_secret VARCHAR(40) NOT NULL UNIQUE,
gitea_url VARCHAR(3000) NOT NULL,
auth_token VARCHAR(40) NOT NULL UNIQUE,
ID SERIAL PRIMARY KEY NOT NULL,
owned_by INTEGER NOT NULL references librepages_users(ID) ON DELETE CASCADE
);
CREATE UNIQUE INDEX librepages_gitea_webhook_auth_token_index ON librepages_gitea_webhooks(auth_token);
CREATE TABLE IF NOT EXISTS librepages_gitea_webhook_site_mapping (
site_id INTEGER NOT NULL references librepages_sites(ID) ON DELETE CASCADE,
gitea_webhook_id INTEGER NOT NULL references librepages_gitea_webhooks(ID) ON DELETE CASCADE,
UNIQUE(site_id, gitea_webhook_id)
);