Skip to content
Empire Builder KitDocumentation
v1 Documentation

Find your next step.

Search the complete documentation, including code examples.

    Full-text search↑ ↓ navigate Enter open
    Browse documentation
    DocsGuides

    Add SQL

    A Slice starts on DynamoDB. Add SQL to a Slice when a feature needs integrity constraints, joins or reporting queries.

    On this page
    1. Report, then apply
    2. What changes
    3. Deploy

    Report, then apply

    bash
    pnpm nx g @empire-builder-kit/nx:sql billing --reason="Invoices need foreign keys and reporting joins."
    pnpm nx g @empire-builder-kit/nx:sql billing --reason="Invoices need foreign keys and reporting joins." --apply

    The first command reports what would change and writes nothing. The second applies it. The reason is required and is stored with the Slice, so the next reader knows why the database exists. Neither command contacts AWS.

    What changes

    • The Slice gains drizzle-orm, pg and @aws-sdk/rds-signer, and its data/persistence.json declares SQL.
    • The Foundation source now declares a VPC and Aurora PostgreSQL. They are created the next time the Foundation deploys.
    • Your DynamoDB tables and data stay as they are.

    Deploy

    Run pnpm verify, then deploy. The Foundation deploys first and creates the database; the Slice deploys after it.