Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

docs: declarative schemas (#34626)

Charis5a2efd50318f
diff --git a/apps/docs/content/guides/local-development/declarative-database-schemas.mdx b/apps/docs/content/guides/local-development/declarative-database-schemas.mdx
index 3c611c6a47e..26eccaca0a3 100644
--- a/apps/docs/content/guides/local-development/declarative-database-schemas.mdx
+++ b/apps/docs/content/guides/local-development/declarative-database-schemas.mdx
@@ -7,7 +7,9 @@ subtitle: 'Manage your database schemas in one place and generate versioned migr
## Overview
-Declarative schemas allow you to reduce code duplications in managing [schema migrations](/docs/guides/local-development/overview#database-migrations). As your database schema evolves over time, declaring it in one place will help you iterate faster by referring to a single source of truth.
+Declarative schemas provide a developer-friendly way to maintain <InfoTooltip tooltipContent={<><p>Files of SQL statements that track the evolution of your database schema over time.<br />They allow you to version control your database schema alongside your application code.</p><p>See the <Link href="/guides/deployment/database-migrations" className="underline">database migrations</Link> guide to learn more.</p></>}>schema migrations</InfoTooltip>.
+
+[Migrations](/docs/guides/deployment/database-migrations) are traditionally managed imperatively (you provide the instructions on how exactly to change the database). This can lead to related information being scattered over multiple migration files. With declarative schemas, you instead declare the state you want your database to be in, and the instructions are generated for you.
## Schema migrations
@@ -211,6 +213,68 @@ supabase start && supabase migration up
</StepHikeCompact.Step>
</StepHikeCompact>
+### Deploying your schema changes
+
+<StepHikeCompact>
+
+ <StepHikeCompact.Step step={1}>
+ <StepHikeCompact.Details title="Log in to the Supabase CLI">
+ [Log in](/docs/reference/cli/supabase-login) via the Supabase CLI.
+ </StepHikeCompact.Details>
+
+ <StepHikeCompact.Code>
+
+<$CodeTabs>
+
+```bash name=Terminal
+supabase login
+```
+
+</$CodeTabs>
+
+ </StepHikeCompact.Code>
+
+ </StepHikeCompact.Step>
+
+ <StepHikeCompact.Step step={2}>
+ <StepHikeCompact.Details title="Link your remote project">
+ Follow the on-screen prompts to [link](/docs/reference/cli/supabase-link) your remote project.
+ </StepHikeCompact.Details>
+
+ <StepHikeCompact.Code>
+
+<$CodeTabs>
+
+```bash name=Terminal
+supabase link
+```
+
+</$CodeTabs>
+
+ </StepHikeCompact.Code>
+
+ </StepHikeCompact.Step>
+
+ <StepHikeCompact.Step step={3}>
+ <StepHikeCompact.Details title="Deploy database changes">
+ [Push](/docs/reference/cli/supabase-db-push) your changes to the remote database.
+ </StepHikeCompact.Details>
+
+ <StepHikeCompact.Code>
+
+<$CodeTabs>
+
+```bash name=Terminal
+supabase db push
+```
+
+</$CodeTabs>
+
+ </StepHikeCompact.Code>
+
+ </StepHikeCompact.Step>
+</StepHikeCompact>
+
### Managing dependencies
As your database schema evolves, you will probably start using more advanced entities like views and functions. These entities are notoriously verbose to manage using plain migrations because the entire body must be recreated whenever there is a change. Using declarative schema, you can now edit them in-place so it’s much easier to review.