mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2025-02-24 23:26:21 +00:00
Merge pull request #704 from nils-werner/small_sql_maintenance
Small sql maintenance
This commit is contained in:
commit
91c2678b3d
2 changed files with 10 additions and 10 deletions
3
Makefile
3
Makefile
|
@ -13,8 +13,9 @@ test:
|
||||||
go test -cover -short ./...
|
go test -cover -short ./...
|
||||||
|
|
||||||
test_mysql:
|
test_mysql:
|
||||||
mysql -P 3306 --protocol=tcp -u root -e 'create database test;'
|
mysql -P 3306 --protocol=tcp -u root -e 'create database if not exists test;'
|
||||||
TEST_DRIVER="mysql" TEST_DATASOURCE="root@tcp(127.0.0.1:3306)/test" go test -short github.com/drone/drone/server/datastore/database
|
TEST_DRIVER="mysql" TEST_DATASOURCE="root@tcp(127.0.0.1:3306)/test" go test -short github.com/drone/drone/server/datastore/database
|
||||||
|
mysql -P 3306 --protocol=tcp -u root -e 'drop database test;'
|
||||||
|
|
||||||
test_postgres:
|
test_postgres:
|
||||||
TEST_DRIVER="postgres" TEST_DATASOURCE="host=127.0.0.1 user=postgres dbname=postgres sslmode=disable" go test -short github.com/drone/drone/server/datastore/database
|
TEST_DRIVER="postgres" TEST_DATASOURCE="host=127.0.0.1 user=postgres dbname=postgres sslmode=disable" go test -short github.com/drone/drone/server/datastore/database
|
||||||
|
|
|
@ -79,13 +79,12 @@ LIMIT 1;
|
||||||
// SQL statement to retrieve a list of Repos
|
// SQL statement to retrieve a list of Repos
|
||||||
// with permissions for the given User ID.
|
// with permissions for the given User ID.
|
||||||
const repoListQuery = `
|
const repoListQuery = `
|
||||||
SELECT *
|
SELECT r.*
|
||||||
FROM repos
|
FROM
|
||||||
WHERE repo_id IN (
|
repos r
|
||||||
SELECT repo_id
|
,perms p
|
||||||
FROM perms
|
WHERE r.repo_id = p.repo_id
|
||||||
WHERE user_id = ?
|
AND p.user_id = ?
|
||||||
);
|
|
||||||
`
|
`
|
||||||
|
|
||||||
// SQL statement to delete a User by ID.
|
// SQL statement to delete a User by ID.
|
||||||
|
|
Loading…
Reference in a new issue