mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2024-12-18 08:26:45 +02:00
243 lines
5.9 KiB
Plaintext
243 lines
5.9 KiB
Plaintext
|
-- name: create-table-users
|
||
|
|
||
|
CREATE TABLE users (
|
||
|
user_id INTEGER PRIMARY KEY AUTOINCREMENT
|
||
|
,user_login TEXT
|
||
|
,user_token TEXT
|
||
|
,user_secret TEXT
|
||
|
,user_expiry INTEGER
|
||
|
,user_email TEXT
|
||
|
,user_avatar TEXT
|
||
|
,user_active BOOLEAN
|
||
|
,user_admin BOOLEAN
|
||
|
,user_hash TEXT
|
||
|
|
||
|
,UNIQUE(user_login)
|
||
|
);
|
||
|
|
||
|
--------------------------------------------------------------------------------
|
||
|
-- name: create-table-repos
|
||
|
|
||
|
CREATE TABLE repos (
|
||
|
repo_id INTEGER PRIMARY KEY AUTOINCREMENT
|
||
|
,repo_user_id INTEGER
|
||
|
,repo_owner TEXT
|
||
|
,repo_name TEXT
|
||
|
,repo_full_name TEXT
|
||
|
,repo_avatar TEXT
|
||
|
,repo_link TEXT
|
||
|
,repo_clone TEXT
|
||
|
,repo_branch TEXT
|
||
|
,repo_timeout INTEGER
|
||
|
,repo_private BOOLEAN
|
||
|
,repo_trusted BOOLEAN
|
||
|
,repo_allow_pr BOOLEAN
|
||
|
,repo_allow_push BOOLEAN
|
||
|
,repo_allow_deploys BOOLEAN
|
||
|
,repo_allow_tags BOOLEAN
|
||
|
,repo_hash TEXT
|
||
|
,repo_scm TEXT
|
||
|
,repo_config_path TEXT
|
||
|
,repo_gated BOOLEAN
|
||
|
,UNIQUE(repo_full_name)
|
||
|
);
|
||
|
|
||
|
--------------------------------------------------------------------------------
|
||
|
-- name: create-table-secrets
|
||
|
|
||
|
CREATE TABLE secrets (
|
||
|
secret_id INTEGER PRIMARY KEY AUTOINCREMENT
|
||
|
,secret_repo_id INTEGER
|
||
|
,secret_name TEXT
|
||
|
,secret_value TEXT
|
||
|
,secret_images TEXT
|
||
|
,secret_events TEXT
|
||
|
,secret_skip_verify BOOLEAN
|
||
|
,secret_conceal BOOLEAN
|
||
|
,UNIQUE(secret_name, secret_repo_id)
|
||
|
);
|
||
|
|
||
|
-- name: create-index-secrets-repo
|
||
|
|
||
|
CREATE INDEX ix_secrets_repo ON secrets (secret_repo_id);
|
||
|
|
||
|
--------------------------------------------------------------------------------
|
||
|
-- name: create-table-registry
|
||
|
|
||
|
CREATE TABLE registry (
|
||
|
registry_id INTEGER PRIMARY KEY AUTOINCREMENT
|
||
|
,registry_repo_id INTEGER
|
||
|
,registry_addr TEXT
|
||
|
,registry_username TEXT
|
||
|
,registry_password TEXT
|
||
|
,registry_email TEXT
|
||
|
,registry_token TEXT
|
||
|
|
||
|
,UNIQUE(registry_addr, registry_repo_id)
|
||
|
);
|
||
|
|
||
|
-- name: create-index-registry-repo
|
||
|
|
||
|
CREATE INDEX ix_registry_repo ON registry (registry_repo_id);
|
||
|
|
||
|
--------------------------------------------------------------------------------
|
||
|
-- name: create-table-builds
|
||
|
|
||
|
CREATE TABLE builds (
|
||
|
build_id INTEGER PRIMARY KEY AUTOINCREMENT
|
||
|
,build_repo_id INTEGER
|
||
|
,build_number INTEGER
|
||
|
,build_event TEXT
|
||
|
,build_status TEXT
|
||
|
,build_enqueued INTEGER
|
||
|
,build_created INTEGER
|
||
|
,build_started INTEGER
|
||
|
,build_finished INTEGER
|
||
|
,build_commit TEXT
|
||
|
,build_branch TEXT
|
||
|
,build_ref TEXT
|
||
|
,build_refspec TEXT
|
||
|
,build_remote TEXT
|
||
|
,build_title TEXT
|
||
|
,build_message TEXT
|
||
|
,build_timestamp INTEGER
|
||
|
,build_author TEXT
|
||
|
,build_avatar TEXT
|
||
|
,build_email TEXT
|
||
|
,build_link TEXT
|
||
|
,build_deploy TEXT
|
||
|
,build_signed BOOLEAN
|
||
|
,build_verified BOOLEAN
|
||
|
,build_parent INTEGER
|
||
|
,build_error TEXT
|
||
|
,build_reviewer TEXT
|
||
|
,build_reviewed INTEGER
|
||
|
,build_sender TEXT
|
||
|
,build_config_id INTEGER
|
||
|
,UNIQUE(build_number, build_repo_id)
|
||
|
);
|
||
|
|
||
|
-- name: create-index-builds-repo
|
||
|
|
||
|
CREATE INDEX ix_build_repo ON builds (build_repo_id);
|
||
|
|
||
|
-- name: create-index-builds-author
|
||
|
|
||
|
CREATE INDEX ix_build_author ON builds (build_author);
|
||
|
|
||
|
-- name: create-index-builds-status
|
||
|
|
||
|
CREATE INDEX ix_build_status_running ON builds (build_status)
|
||
|
WHERE build_status IN ('pending', 'running');
|
||
|
|
||
|
--------------------------------------------------------------------------------
|
||
|
-- name: create-table-procs
|
||
|
|
||
|
CREATE TABLE procs (
|
||
|
proc_id INTEGER PRIMARY KEY AUTOINCREMENT
|
||
|
,proc_build_id INTEGER
|
||
|
,proc_pid INTEGER
|
||
|
,proc_ppid INTEGER
|
||
|
,proc_pgid INTEGER
|
||
|
,proc_name TEXT
|
||
|
,proc_state TEXT
|
||
|
,proc_error TEXT
|
||
|
,proc_exit_code INTEGER
|
||
|
,proc_started INTEGER
|
||
|
,proc_stopped INTEGER
|
||
|
,proc_machine TEXT
|
||
|
,proc_platform TEXT
|
||
|
,proc_environ TEXT
|
||
|
,UNIQUE(proc_build_id, proc_pid)
|
||
|
);
|
||
|
|
||
|
-- name: create-index-procs-build
|
||
|
|
||
|
CREATE INDEX proc_build_ix ON procs (proc_build_id);
|
||
|
|
||
|
--------------------------------------------------------------------------------
|
||
|
-- name: create-table-logs
|
||
|
|
||
|
CREATE TABLE IF NOT EXISTS logs (
|
||
|
log_id INTEGER PRIMARY KEY AUTOINCREMENT
|
||
|
,log_job_id INTEGER
|
||
|
,log_data BLOB
|
||
|
,UNIQUE(log_job_id)
|
||
|
);
|
||
|
|
||
|
--------------------------------------------------------------------------------
|
||
|
-- name: create-table-files
|
||
|
|
||
|
CREATE TABLE IF NOT EXISTS files (
|
||
|
file_id INTEGER PRIMARY KEY AUTOINCREMENT
|
||
|
,file_build_id INTEGER
|
||
|
,file_proc_id INTEGER
|
||
|
,file_name TEXT
|
||
|
,file_mime TEXT
|
||
|
,file_size INTEGER
|
||
|
,file_time INTEGER
|
||
|
,file_data BLOB
|
||
|
,UNIQUE(file_proc_id,file_name)
|
||
|
,FOREIGN KEY(file_proc_id) REFERENCES procs (proc_id) ON DELETE CASCADE
|
||
|
);
|
||
|
|
||
|
-- name: create-index-files-builds
|
||
|
|
||
|
CREATE INDEX file_build_ix ON files (file_build_id);
|
||
|
|
||
|
-- name: create-index-files-procs
|
||
|
|
||
|
CREATE INDEX file_proc_ix ON files (file_proc_id);
|
||
|
|
||
|
--------------------------------------------------------------------------------
|
||
|
-- name: create-table-senders
|
||
|
|
||
|
CREATE TABLE IF NOT EXISTS senders (
|
||
|
sender_id INTEGER PRIMARY KEY AUTOINCREMENT
|
||
|
,sender_repo_id INTEGER
|
||
|
,sender_login BOOLEAN
|
||
|
,sender_allow BOOLEAN
|
||
|
,sender_block BOOLEAN
|
||
|
|
||
|
,UNIQUE(sender_repo_id,sender_login)
|
||
|
);
|
||
|
|
||
|
-- name: create-index-sender-repos
|
||
|
|
||
|
CREATE INDEX sender_repo_ix ON senders (sender_repo_id);
|
||
|
|
||
|
--------------------------------------------------------------------------------
|
||
|
-- name: create-table-config
|
||
|
|
||
|
CREATE TABLE IF NOT EXISTS config (
|
||
|
config_id INTEGER PRIMARY KEY AUTOINCREMENT
|
||
|
,config_repo_id INTEGER
|
||
|
,config_hash TEXT
|
||
|
,config_data BLOB
|
||
|
|
||
|
,UNIQUE(config_hash, config_repo_id)
|
||
|
);
|
||
|
|
||
|
--------------------------------------------------------------------------------
|
||
|
-- name: create-table-tasks
|
||
|
|
||
|
CREATE TABLE IF NOT EXISTS tasks (
|
||
|
task_id TEXT PRIMARY KEY
|
||
|
,task_data BLOB
|
||
|
,task_labels BLOB
|
||
|
);
|
||
|
|
||
|
--------------------------------------------------------------------------------
|
||
|
-- name: create-table-agents
|
||
|
|
||
|
CREATE TABLE IF NOT EXISTS agents (
|
||
|
agent_id INTEGER PRIMARY KEY AUTOINCREMENT
|
||
|
,agent_addr TEXT
|
||
|
,agent_platform TEXT
|
||
|
,agent_capacity INTEGER
|
||
|
,agent_created INTEGER
|
||
|
,agent_updated INTEGER
|
||
|
|
||
|
,UNIQUE(agent_addr)
|
||
|
);
|