FAQ
Troubleshooting
Error Migration on PostgreSQL

Error Migration on PostgreSQL

Prisma migration failed on PostgreSQL, the error message on the command line:

🚫

ERROR: function uuid_generate_v4() does not exist

error postgresql migration

Solution

The error occurred specifically in the older version of the application that was generated. However, the problem with the UUID extension has been fixed in the newer version. If you encounter this error, please refer to the solution provided below.

Enable the uuid-ossp module in PostgreSQL. One way to do this is by enabling manually via administration tool, such as pgAdmin (opens in a new tab).

To enable the uuid-ossp on PostgreSQL, run this SQL script:

CREATE EXTENSION IF NOT EXISTS "uuid-ossp"

enable uuid postgresql

After that go back to the generated application root project and re-run the migration again:

npx prisma generate

and deploy again to the PostgreSQL database:

npx prisma migrate deploy

migration ok