tarakan/priv/repo/migrations/20260711191235_allow_repo_credential_scopes.exs
Maxfield Luke af6077b9c3
All checks were successful
CI and deploy / Test (push) Successful in 4m52s
CI and deploy / Deploy production (push) Successful in 23s
Initial commit on Forgejo
Fresh repository history for elektrine/tarakan hosted at
https://git.elektrine.com/elektrine/tarakan.
2026-07-29 04:43:40 -04:00

20 lines
867 B
Elixir

defmodule Tarakan.Repo.Migrations.AllowRepoCredentialScopes do
use Ecto.Migration
@with_repo "scopes <@ ARRAY['tasks:read', 'tasks:claim', 'contributions:write', 'findings:submit', 'reports:write', 'reviews:read', 'reviews:verify', 'repo:read', 'repo:write']::varchar[]"
@without_repo "scopes <@ ARRAY['tasks:read', 'tasks:claim', 'contributions:write', 'findings:submit', 'reports:write', 'reviews:read', 'reviews:verify']::varchar[]"
def up do
drop constraint(:api_credentials, :api_credentials_scopes_must_be_valid)
create constraint(:api_credentials, :api_credentials_scopes_must_be_valid, check: @with_repo)
end
def down do
drop constraint(:api_credentials, :api_credentials_scopes_must_be_valid)
create constraint(:api_credentials, :api_credentials_scopes_must_be_valid,
check: @without_repo
)
end
end