Skip to content

Remove redundant tests in migrations/tests/database/exists.sql #1561

Open
@steve-chavez

Description

@steve-chavez

Problem

We currently have these tests:

SELECT has_schema('public');
SELECT has_schema('auth');
SELECT has_schema('extensions');
SELECT has_schema('graphql');
SELECT has_schema('graphql_public');
SELECT has_schema('realtime');
SELECT has_schema('storage');

As one example, has_schema('storage'); is redundant with

-- storage schema owner
select
n.nspname as schema_name,
r.rolname as owner
from
pg_namespace n
join
pg_roles r on n.nspowner = r.oid
where
n.nspname = 'storage';
schema_name | owner
-------------+----------------
storage | supabase_admin
(1 row)

Which provides more information.

Editing the exists.sql file makes up for more work on PRs (example) while not providing any more test coverage.

Additionally, it's easier to locate all storage concerns in a single file, the same for the other schemas.

Solution

Remove migrations/tests/database/exists.sql while ensuring the test coverage is preserved.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions