> ## Documentation Index
> Fetch the complete documentation index at: https://docs.major.build/llms.txt
> Use this file to discover all available pages before exploring further.

# Managed Databases

> Provision and manage PostgreSQL databases for your app.

Each app can have its own managed PostgreSQL database — no external setup required. Ask the AI assistant to provision one, or use the **Database** tab in the editor.

## Provisioning

Ask the AI assistant to provision a managed database, or click **Provision** in the Database tab. Your app gets its own PostgreSQL instance, ready to use with the same generated clients as any other connector.

## Inspecting Data

Click **Browse tables and data** to explore your database:

* Browse tables and view row data with pagination and sorting
* Click rows to see full details
* View table schema — columns, primary keys, foreign keys, and indexes

## Migrations

Run database migrations through the AI assistant. Ask the AI to apply a schema change — it writes the migration SQL, shows it to you with syntax highlighting for review, and applies it atomically across all environments once you approve.

Migrations are recorded in an audit log so you can track what changed and when. The AI uses the `postgresql_run_migration` tool, which validates SQL before execution and requires admin permission. Only managed (not external) databases support this flow.

## Multi-environment schemas

When you create a new environment, Major automatically provisions a matching PostgreSQL schema for it, cloned from the default environment's structure. Deleting an environment drops its schema.

## Access Control

App collaborators (admins and editors) automatically get database access synced from your resource permissions. Managed databases are scoped to your app and can be configured per-environment.

## Deleting a Database

You can delete a managed database from three locations:

* **Resource Details Sheet** — click the "Delete Database" button
* **Database Settings** — available for failed or active databases
* **Database Panel** — use the trash icon in the header or the delete button in the failed state

Deletion requires type-to-confirm for safety. Once deletion starts, the database transitions to a "Deleting database..." state.

<Warning>
  Database deletion is permanent. Ensure you've backed up any important data before proceeding.
</Warning>
