/** * AccountState: deploy tokens a user created, by repository and minting token, so revoking them visits only the * repositories that can hold one (src/server/deploy-token-index.ts). */ export const DEPLOY_TOKEN_INDEX_DDL = [ `CREATE TABLE IF NOT EXISTS deploy_token_index ( token_id TEXT PRIMARY KEY, repo_id TEXT NOT NULL, parent_token_id TEXT, created_at INTEGER NOT NULL )`, "CREATE INDEX IF NOT EXISTS deploy_token_index_parent ON deploy_token_index (parent_token_id)", "CREATE INDEX IF NOT EXISTS deploy_token_index_repo ON deploy_token_index (repo_id)", ]; /** * AccountState: repositories the account has any activity in (`touched_at`), and the first and last time of * counted activity (null when only pushes or views), so the contribution graph and account deletion ask only * those repositories instead of every one (src/server/activity-index.ts). */ export const ACTIVITY_REPOS_DDL = [ `CREATE TABLE IF NOT EXISTS activity_repos ( repo_id TEXT PRIMARY KEY, first_at INTEGER, last_at INTEGER, touched_at INTEGER NOT NULL )`, "CREATE INDEX IF NOT EXISTS activity_repos_last ON activity_repos (last_at)", ]; /** * AccountState: attachment bytes per repository that count against this account, as quota owner and as uploader, * so the upload quota check reads one object instead of every repository (src/server/attachment-bytes.ts). */ export const ATTACHMENT_BYTES_DDL = [ `CREATE TABLE IF NOT EXISTS attachment_bytes ( repo_id TEXT PRIMARY KEY, owned INTEGER NOT NULL DEFAULT 0, uploaded INTEGER NOT NULL DEFAULT 0 )`,