1
0
mirror of https://github.com/woodpecker-ci/woodpecker.git synced 2024-12-18 08:26:45 +02:00
woodpecker/store/datastore/sql/sqlite/files/perms.sql

59 lines
866 B
MySQL
Raw Normal View History

2017-07-14 21:58:38 +02:00
-- name: perms-find-user
SELECT
perm_user_id
,perm_repo_id
,perm_pull
,perm_push
,perm_admin
,perm_date
FROM perms
WHERE perm_user_id = ?
-- name: perms-find-user-repo
SELECT
perm_user_id
,perm_repo_id
,perm_pull
,perm_push
,perm_admin
,perm_synced
FROM perms
WHERE perm_user_id = ?
AND perm_repo_id = ?
-- name: perms-insert-replace
2017-07-15 18:51:02 +02:00
REPLACE INTO perms (
2017-07-14 21:58:38 +02:00
perm_user_id
,perm_repo_id
,perm_pull
,perm_push
,perm_admin
,perm_synced
) VALUES (?,?,?,?,?,?)
-- name: perms-insert-replace-lookup
2017-07-15 18:51:02 +02:00
REPLACE INTO perms (
2017-07-14 21:58:38 +02:00
perm_user_id
,perm_repo_id
,perm_pull
,perm_push
,perm_admin
,perm_synced
) VALUES (?,(SELECT repo_id FROM repos WHERE repo_full_name = ?),?,?,?,?)
-- name: perms-delete-user-repo
DELETE FROM perms
WHERE perm_user_id = ?
AND perm_repo_id = ?
-- name: perms-delete-user-date
DELETE FROM perms
WHERE perm_user_id = ?
AND perm_synced < ?