Skip to main content
Prisma Documentation Docs

Search documentation

Type to search this documentation.

On this pageOverview

Unsupported database features (Prisma Migrate)

Prisma Migrate uses the Prisma schema to determine what features to create in the database. However, some database features cannot be represented in the Prisma schema , including but not limited to:

  • Stored procedures
  • Triggers
  • Views
  • Partial indexes

To add an unsupported feature to your database, you must customize a migration to include that feature before you apply it.

To customize a migration to include an unsupported feature:

  1. Use the --create-only flag to generate a new migration without applying it:

    bunx prisma migrate dev --create-only
    Bash
    pnpm prisma migrate dev --create-only
    Bash
    yarn prisma migrate dev --create-only
    Bash
    npx prisma migrate dev --create-only
    1. Open the generated migration.sql file and add the unsupported feature - for example, a partial index:
      SQL
      CREATE UNIQUE INDEX tests_success_constraint
        ON posts (subject, target)
        WHERE success;
    2. Apply the migration:
  2. Open the generated migration.sql file and add the unsupported feature - for example, a partial index:

    CREATE UNIQUE INDEX tests_success_constraint
    
      ON posts (subject, target)
    
      WHERE success;
  3. Apply the migration:

    bunx prisma migrate dev
    Bash
    pnpm prisma migrate dev
    Bash
    yarn prisma migrate dev
    Bash
    npx prisma migrate dev
    1. Commit the modified migration to source control.
  4. Commit the modified migration to source control.

Suggest an edit

Propose a replacement for this page. The site team reviews it before applying any changes.

Export
Documentation menu