Skip to content

Conversation

@sweatybridge
Copy link
Contributor

@sweatybridge sweatybridge commented Jan 15, 2026

What kind of change does this PR introduce?

feature

What is the new behavior?

supabase db pull --experimental

Cluster-Wide Objects (cluster/)

File PostgreSQL Objects
roles.sql CREATE ROLE, ALTER ROLE, GRANT role TO role
extensions.sql CREATE EXTENSION
foreign_data_wrappers.sql CREATE FOREIGN DATA WRAPPER, CREATE SERVER, CREATE USER MAPPING
publications.sql CREATE PUBLICATION, ALTER PUBLICATION
subscriptions.sql CREATE SUBSCRIPTION, ALTER SUBSCRIPTION
event_triggers.sql CREATE EVENT TRIGGER, ALTER EVENT TRIGGER
tablespaces.sql CREATE TABLESPACE, ALTER TABLESPACE
variables.sql SET check_function_bodies = false;, ALTER SYSTEM, CREATE DATABASE

Schema-Scoped Objects (inside schemas/{schema}/)

Directory File(s) PostgreSQL Objects
schemas/{schema}/ schema.sql CREATE SCHEMA, CREATE COLLATION, CREATE OPERATOR FAMILY, CREATE TEXT SEARCH, schema-level GRANT, schema-level ALTER DEFAULT PRIVILEGE
schemas/{schema}/ types.sql CREATE TYPE (enum, composite, range)
schemas/{schema}/ sequences.sql CREATE SEQUENCE, ALTER SEQUENCE (excluding owned by)
schemas/{schema}/tables/ {table}.sql CREATE TABLE, ALTER TABLE (excluding foreign key constraints), CREATE INDEX, CREATE POLICY, BEFORE/AFTER CREATE TRIGGER, trigger functions, table GRANT, COMMENT
schemas/{schema}/views/ {view}.sql CREATE VIEW, INSTEAD OF CREATE TRIGGER, view GRANT, COMMENT
schemas/{schema}/materialized_views/ {mview}.sql CREATE MATERIALIZED VIEW, indexes, GRANT, COMMENT
schemas/{schema}/functions/ {function}.sql CREATE FUNCTION (including all overloads and trigger functions), GRANT, COMMENT
schemas/{schema}/procedures/ {procedure}.sql CREATE PROCEDURE, GRANT, COMMENT
schemas/{schema}/foreign_tables/ {ftable}.sql CREATE FOREIGN TABLE, GRANT
schemas/{schema}/domains/ {domain}.sql CREATE DOMAIN, ALTER DOMAIN
schemas/{schema}/operators/ {operator}.sql CREATE OPERATOR, ALTER OPERATOR, CREATE OPERATOR CLASS, CREATE AGGREGATE, CREATE TRANSFORM
schemas/{schema}/policies/ {policy}.sql CREATE POLICY, CREATE RULE, foreign key constraints
schemas/ unqualified.sql SELECT lo_create(), CREATE CAST

Additional context

Known caveats

  1. Tables may depend on functions using check constraint
CREATE TABLE IF NOT EXISTS "public"."employees" (
    "name" "text",
    CONSTRAINT "name_check" CHECK ("public"."is_valid_name"("name"))
);
  1. Function may depend on tables from return type
CREATE OR REPLACE FUNCTION "public"."create_employee"("name" "text") RETURNS "public"."employees"
    LANGUAGE "plpgsql"
    SET "search_path" TO ''
    AS $$
DECLARE
    result_row public.employees%ROWTYPE;
BEGIN
    INSERT INTO public.employees (name) VALUES (name) RETURNING * INTO result_row;
    RETURN result_row;
END;
$$;
  1. Sequences may be referenced by create or alter tables statement
  2. Views may have forward declarations

@sweatybridge sweatybridge requested a review from a team as a code owner January 15, 2026 10:26
@coveralls
Copy link

coveralls commented Jan 17, 2026

Pull Request Test Coverage Report for Build 21473922934

Warning: This coverage report may be inaccurate.

This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.

Details

  • 259 of 599 (43.24%) changed or added relevant lines in 2 files are covered.
  • 38 unchanged lines in 3 files lost coverage.
  • Overall coverage decreased (-0.6%) to 55.543%

Changes Missing Coverage Covered Lines Changed/Added Lines %
internal/db/pull/pull.go 1 9 11.11%
internal/migration/format/format.go 258 590 43.73%
Files with Coverage Reduction New Missed Lines %
internal/storage/rm/rm.go 2 80.61%
internal/gen/keys/keys.go 5 12.9%
internal/start/start.go 31 65.85%
Totals Coverage Status
Change from base Build 20983346857: -0.6%
Covered Lines: 7109
Relevant Lines: 12799

💛 - Coveralls

@sweatybridge sweatybridge changed the title feat: squash migrations to declarative schemas feat: experimental db pull as declarative schemas Jan 17, 2026
@sweatybridge sweatybridge merged commit 623610a into develop Jan 30, 2026
11 of 12 checks passed
@sweatybridge sweatybridge deleted the format-dump branch January 30, 2026 06:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants