Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lints/0020_table_bloat.sql
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ bloat_data as (
select
'table_bloat' as name,
'Table Bloat' as title,
'INFO' as level,
'WARN' as level,
'EXTERNAL' as facing,
array['PERFORMANCE'] as categories,
'Detects if a table has excess bloat and may benefit from maintenance operations like vacuum full or cluster.' as description,
Expand All @@ -78,7 +78,7 @@ select
bloat_data.schemaname,
bloat_data.object_name
) as detail,
'Consider running vacuum full (WARNING: incurs downtime) and tweaking autovacuum settings to reduce bloat.' as remediation,
'https://supabase.com/docs/guides/database/database-linter?lint=0020_table_bloat' as remediation,
jsonb_build_object(
'schema', bloat_data.schemaname,
'name', bloat_data.object_name,
Expand Down
2 changes: 1 addition & 1 deletion lints/0021_fkey_to_auth_unique.sql
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ select
c_rel.relname, -- referencing table
c.conname -- fkey name
) as detail,
'Drop the foreign key constraint that references the auth schema.' as remediation,
'https://supabase.com/docs/guides/database/database-linter?lint=0021_fkey_to_auth_unique' as remediation,
jsonb_build_object(
'schema', n.nspname,
'name', c_rel.relname,
Expand Down
6 changes: 3 additions & 3 deletions splinter.sql
Original file line number Diff line number Diff line change
Expand Up @@ -1074,7 +1074,7 @@ bloat_data as (
select
'table_bloat' as name,
'Table Bloat' as title,
'INFO' as level,
'WARN' as level,
'EXTERNAL' as facing,
array['PERFORMANCE'] as categories,
'Detects if a table has excess bloat and may benefit from maintenance operations like vacuum full or cluster.' as description,
Expand All @@ -1083,7 +1083,7 @@ select
bloat_data.schemaname,
bloat_data.object_name
) as detail,
'Consider running vacuum full (WARNING: incurs downtime) and tweaking autovacuum settings to reduce bloat.' as remediation,
'https://supabase.com/docs/guides/database/database-linter?lint=0020_table_bloat' as remediation,
jsonb_build_object(
'schema', bloat_data.schemaname,
'name', bloat_data.object_name,
Expand Down Expand Up @@ -1117,7 +1117,7 @@ select
c_rel.relname, -- referencing table
c.conname -- fkey name
) as detail,
'Drop the foreign key constraint that references the auth schema.' as remediation,
'https://supabase.com/docs/guides/database/database-linter?lint=0021_fkey_to_auth_unique' as remediation,
jsonb_build_object(
'schema', n.nspname,
'name', c_rel.relname,
Expand Down
12 changes: 6 additions & 6 deletions test/expected/0021_fkey_to_auth_unique.out
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ begin;
);
-- 1 issue - fkey ref to unique constraint
select * from lint."0021_fkey_to_auth_unique";
name | title | level | facing | categories | description | detail | remediation | metadata | cache_key
---------------------+---------------------------------------+-------+----------+------------+-----------------------------------------------------------------------------+--------------------------------------------------------------------------------------------+------------------------------------------------------------------+-------------------------------------------------------------------+--------------------------------------------
fkey_to_auth_unique | Foreign Key to Auth Unique Constraint | ERROR | EXTERNAL | {SECURITY} | Detects user defined foreign keys to unique constraints in the auth schema. | Table `public`.`foo` has a foreign key `foo_un_fkey` referencing an auth unique constraint | Drop the foreign key constraint that references the auth schema. | {"name": "foo", "schema": "public", "foreign_key": "foo_un_fkey"} | fkey_to_auth_unique_public_foo_foo_un_fkey
name | title | level | facing | categories | description | detail | remediation | metadata | cache_key
---------------------+---------------------------------------+-------+----------+------------+-----------------------------------------------------------------------------+--------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------+-------------------------------------------------------------------+--------------------------------------------
fkey_to_auth_unique | Foreign Key to Auth Unique Constraint | ERROR | EXTERNAL | {SECURITY} | Detects user defined foreign keys to unique constraints in the auth schema. | Table `public`.`foo` has a foreign key `foo_un_fkey` referencing an auth unique constraint | https://supabase.com/docs/guides/database/database-linter?lint=0021_fkey_to_auth_unique | {"name": "foo", "schema": "public", "foreign_key": "foo_un_fkey"} | fkey_to_auth_unique_public_foo_foo_un_fkey
(1 row)

-- Alter the table adding another fkey based on id
Expand All @@ -26,9 +26,9 @@ begin;
references auth.users(id);
-- 1 issue - still only 1 issue because the pkey constraint is okay
select * from lint."0021_fkey_to_auth_unique";
name | title | level | facing | categories | description | detail | remediation | metadata | cache_key
---------------------+---------------------------------------+-------+----------+------------+-----------------------------------------------------------------------------+--------------------------------------------------------------------------------------------+------------------------------------------------------------------+-------------------------------------------------------------------+--------------------------------------------
fkey_to_auth_unique | Foreign Key to Auth Unique Constraint | ERROR | EXTERNAL | {SECURITY} | Detects user defined foreign keys to unique constraints in the auth schema. | Table `public`.`foo` has a foreign key `foo_un_fkey` referencing an auth unique constraint | Drop the foreign key constraint that references the auth schema. | {"name": "foo", "schema": "public", "foreign_key": "foo_un_fkey"} | fkey_to_auth_unique_public_foo_foo_un_fkey
name | title | level | facing | categories | description | detail | remediation | metadata | cache_key
---------------------+---------------------------------------+-------+----------+------------+-----------------------------------------------------------------------------+--------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------+-------------------------------------------------------------------+--------------------------------------------
fkey_to_auth_unique | Foreign Key to Auth Unique Constraint | ERROR | EXTERNAL | {SECURITY} | Detects user defined foreign keys to unique constraints in the auth schema. | Table `public`.`foo` has a foreign key `foo_un_fkey` referencing an auth unique constraint | https://supabase.com/docs/guides/database/database-linter?lint=0021_fkey_to_auth_unique | {"name": "foo", "schema": "public", "foreign_key": "foo_un_fkey"} | fkey_to_auth_unique_public_foo_foo_un_fkey
(1 row)

drop table public.foo;
Expand Down
Loading