I am trying to use node-pg-migrate
and run migrations to create tables in my node project.
When I run migrations I get function uuid_generate_v4() does not exist.
I did check in my extensions and uuid-ossp is available.
extname | extowner | extnamespace | extrelocatable | extversion | extconfig | extcondition
-----------+----------+--------------+----------------+------------+-----------+--------------
plpgsql | 10 | 11 | f | 1.0 | |
uuid-ossp | 16384 | 2200 | t | 1.1 | |
(2 rows)
I expect my migrations to run but it fails. I am using Postgres 11 on Mac. Postgres installed from here - https://postgresapp.com/
UUID is an abbreviation for Universal Unique Identifier defined by RFC 4122 and has a size of 128-bit. It is created using internal algorithms that always generate a unique value. PostgreSQL has its own UUID data type and provides modules to generate them.
Description. CREATE EXTENSION loads a new extension into the current database. There must not be an extension of the same name already loaded. Loading an extension essentially amounts to running the extension's script file.
The uuid-ossp module provides functions to generate universally unique identifiers (UUIDs) using one of several standard algorithms. There are also functions to produce certain special UUID constants. This module is only necessary for special requirements beyond what is available in core PostgreSQL.
CREATE EXTENSION IF NOT EXISTS "uuid-ossp";
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With