Documentation
¶
Overview ¶
Package supabase registers the Supabase importer. Purpose: snapshot a Supabase project (direct database connection), its auth users with their bcrypt hashes and its storage objects into a portable bundle; row level security policies become Hasura permissions where they match `auth.uid() = <column>` and are reported otherwise. Inputs: --db-url-env, --api-url or --project-ref, --service-key-env (all secrets by variable name). Outputs: bundle and detection. Constraints: no URL, password or key in errors or reports.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckForeignTriggers ¶
CheckForeignTriggers refuses a schema whose triggers call functions of Supabase-owned schemas (for example database webhooks: supabase_functions.http_request).
Types ¶
type Compat ¶
Compat is the generated shim file and what it covers.
func BuildCompat ¶
BuildCompat scans the schema dump. SQL is empty when nothing is referenced.
type Policy ¶
type Policy struct {
Schema, Table, Name string
Permissive bool
Roles []string
Cmd string // SELECT | INSERT | UPDATE | DELETE | ALL
Using, Check string
}
Policy is one pg_policies row. Using and Check are "" when the policy has none.
type Result ¶
type Result struct {
// Doc is the export_metadata subset (nil when no policy translated).
Doc []byte
Tables int
Permissions int
Untranslated []importer.Policy
Exemptions []portable.Exemption
}
Result is the outcome of translating every table.
type Table ¶
type Table struct {
Schema, Name string
Columns []string
Policies []Policy
// Granted lists the permission kinds (select, insert, update, delete) the Supabase role
// `authenticated` holds on the table. A policy for a kind without the grant gives no access in
// Postgres, so it is not translated. A nil map means every kind (unit tests).
Granted map[string]bool
}
Table is one dumped table with its columns and policies.
type Translation ¶
Translation is the Hasura form of one policy: the owner column and the permission kinds it covers.