rembrembdocs

Workflows

How to include unsupported database features for projects that use 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:

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:

migration.sql

CREATE OR REPLACE FUNCTION notify_on_insert()
RETURNS TRIGGER AS $$
BEGIN
  PERFORM pg_notify('new_record', NEW.id::text);
  RETURN NEW;
END;
$$ LANGUAGE plpgsql;