Skip to content

Prisma Migrate fails when using @prisma/adapter-pg through prisma.config.ts #27403

Description

@fmauNeko

Bug description

When using prisma.config.ts with an adapter defined with the property migrate.adapter, any migrate command fail due to the name column type, which is an alias for varchar(64).

Example output of a command ran in the repro repo linked:

# npx prisma migrate dev --name init
Loaded Prisma config from "D:\Code\prisma-migrate-adapter-pg-name-repro\prisma.config.ts".
Prisma config detected, skipping environment variable loading.
Prisma schema loaded from prisma\schema.prisma
Datasource "db": PostgreSQL database "db", schema "public" using driver adapter "@prisma/adapter-pg"


WARNING: Your schema specifies the following datasource properties but you are using a Driver Adapter via prisma.config.ts:
- url

The values from your schema will NOT be used!

We recommend you to remove those properties from your schema to avoid confusion if you are only using driver adapters.
Error: Column type 'name' could not be deserialized from the database.
   0: sql_schema_connector::flavour::postgres::describe_schema_with
           with circumstances=BitFlags<Circumstances>(0b100, CanPartitionTables) preview_features=BitFlags<PreviewFeature>(0b0) namespaces=None schema="public"
             at schema-engine/connectors/sql-schema-connector/src/flavour/postgres.rs:601
   1: schema_engine_wasm::wasm::engine::DevDiagnostic
             at schema-engine/schema-engine-wasm/src/wasm/engine.rs:205

Severity

⚠️ Major: Breaks core functionality (e.g., migrations fail)

Reproduction

https://github.com/fmauNeko/prisma-migrate-adapter-pg-name-repro

Expected vs. Actual Behavior

Expected: All migrations commands run correctly
Actual: No migration command work

Frequency

Consistently reproducible

Does this occur in development or production?

Only in development (e.g., CLI tools, migrations, Prisma Studio)

Is this a regression?

No

Workaround

Patching https://github.com/prisma/prisma/blob/main/packages/adapter-pg/src/conversion.ts#L214 to add a case 19: fixes the issue but doesn't look like a good solution. pg doesn't include a ScalarColumnType.NAME enum entry as it's an alias, and they are ignored according to https://github.com/brianc/node-pg-types/blob/master/lib/builtins.js#L8

Prisma Schema & Queries

generator client {
  provider        = "prisma-client"
  previewFeatures = ["driverAdapters", "queryCompiler"]
  output          = "../src/generated/prisma"
}

datasource db {
  provider = "postgresql"
  url      = "postgresql://user:pass@localhost:5432/db?schema=public" // Unused dummy URL because we are not yet allowed to remove this line
}

model Test {
  id        String   @id @default(cuid(2))
  createdAt DateTime @default(now())
  updatedAt DateTime @updatedAt
}

Prisma Config

import { PrismaPg } from "@prisma/adapter-pg";
import fs from "node:fs";
import { type PrismaConfig } from "prisma/config";

function adapter(): Promise<PrismaPg> {
  const config = JSON.parse(fs.readFileSync("config.json", "utf-8"));

  if (!config.database.url) {
    throw new Error("Database URL is not defined in the configuration.");
  }

  return Promise.resolve(
    new PrismaPg({
      connectionString: config.database.url,
    }),
  );
}

export default {
  earlyAccess: true,
  migrate: {
    adapter,
  },
  studio: {
    adapter,
  },
} satisfies PrismaConfig;

Logs & Debug Info

prisma:cli:bin Failed to initialize the command state: Error: ENOENT: no such file or directory, open 'C:\Users\fmaun\AppData\Roaming\prisma-nodejs\Config\commands.json' +304ms
prisma:config:loadConfigFromFile Config file loaded in 57.69ms +172ms
prisma:config:PrismaConfig Parsed `PrismaConfig` shape: '{\n  "earlyAccess": true,\n  "studio": {},\n  "migrate": {}\n}' +1ms
prisma:config:defineConfig [default]: '{\n  "earlyAccess": true,\n  "loadedFromFile": null\n}' +1ms
prisma:config:defineConfig [config.studio]: '{}' +0ms
prisma:config:defineConfig [config.schema]: '{}' +0ms
Loaded Prisma config from "D:\Code\prisma-migrate-adapter-pg-name-repro\prisma.config.ts".
prisma:getSchema prismaConfig {
  "packagePath": "D:\\Code\\prisma-migrate-adapter-pg-name-repro\\package.json"
} +62ms
prisma:getSchema Checking existence of D:\Code\prisma-migrate-adapter-pg-name-repro\schema.prisma +1ms        
prisma:getSchema Reading schema from single file D:\Code\prisma-migrate-adapter-pg-name-repro\schema.prisma +0ms
prisma:getSchema Checking existence of D:\Code\prisma-migrate-adapter-pg-name-repro\prisma\schema.prisma +0ms 
prisma:getSchema Reading schema from single file D:\Code\prisma-migrate-adapter-pg-name-repro\prisma\schema.prisma +0ms
prisma:getConfig Using getConfig Wasm +1ms
prisma:getConfig config data retrieved without errors in getConfig Wasm +9ms
prisma:engines binaries to download  +374ms
Prisma config detected, skipping environment variable loading.
prisma:getSchema prismaConfig {
  "packagePath": "D:\\Code\\prisma-migrate-adapter-pg-name-repro\\package.json"
} +2ms
prisma:getSchema Checking existence of D:\Code\prisma-migrate-adapter-pg-name-repro\schema.prisma +0ms        
prisma:getSchema Reading schema from single file D:\Code\prisma-migrate-adapter-pg-name-repro\schema.prisma +0ms
prisma:getSchema Checking existence of D:\Code\prisma-migrate-adapter-pg-name-repro\prisma\schema.prisma +0ms 
prisma:getSchema Reading schema from single file D:\Code\prisma-migrate-adapter-pg-name-repro\prisma\schema.prisma +0ms
Prisma schema loaded from prisma\schema.prisma
prisma:getConfig Using getConfig Wasm +1ms
prisma:getConfig config data retrieved without errors in getConfig Wasm +0ms
prisma:config:defineConfig [config.migrate.adapter]: '@prisma/adapter-pg' +16ms
Datasource "db": PostgreSQL database "db", schema "public" using driver adapter "@prisma/adapter-pg"

prisma:validate Using validate Wasm +2ms
prisma:driver-adapter:pg [js::query_raw] '{\n' +
  `  "sql": "SELECT EXISTS(SELECT 1 FROM pg_namespace WHERE nspname = $1), version(), current_setting('server_version_num')::integer as numeric_version;",\n` +
  '  "args": [\n' +
  '    "public"\n' +
  '  ],\n' +
  '  "argTypes": [\n' +
  '    "Text"\n' +
  '  ]\n' +
  '}' +78ms
prisma:schemaEngine:wasm:stderr {"level":"INFO","fields":{"message":"Starting schema-engine-wasm","git_hash":"81e4af48011447c3cc503a190e86995b66d2a28e"},"target":"schema_engine_wasm::wasm::engine"}
 +85ms

WARNING: Your schema specifies the following datasource properties but you are using a Driver Adapter via prisma.config.ts:
- url

The values from your schema will NOT be used!

We recommend you to remove those properties from your schema to avoid confusion if you are only using driver adapters.
prisma:schemaEngine:wasm:stdout [devDiagnostic] input: '{\n' +
  '  "migrationsList": {\n' +
  '    "baseDir": "D:\\\\Code\\\\prisma-migrate-adapter-pg-name-repro\\\\prisma\\\\migrations",\n' +
  '    "lockfile": {\n' +
  '      "path": "migration_lock.toml",\n' +
  '      "content": null\n' +
  '    },\n' +
  '    "migrationDirectories": []\n' +
  '  }\n' +
  '}' +2ms
prisma:driver-adapter:pg [js::query_raw] '{\n' +
  '  "sql": "SELECT \\"id\\", \\"checksum\\", \\"finished_at\\", \\"migration_name\\", \\"logs\\", \\"rolled_back_at\\", \\"started_at\\", \\"applied_steps_count\\" FROM \\"_prisma_migrations\\" ORDER BY \\"started_at\\" ASC",\n' +
  '  "args": [],\n' +
  '  "argTypes": []\n' +
  '}' +68ms
prisma:driver-adapter:pg Error in performIO: '{\n' +
  '  "length": 124,\n' +
  '  "name": "error",\n' +
  '  "severity": "ERREUR",\n' +
  '  "code": "42P01",\n' +
  '  "position": "126",\n' +
  '  "file": "parse_relation.c",\n' +
  '  "line": "1452",\n' +
  '  "routine": "parserOpenTable"\n' +
  '}' +3ms
driver-adapter-utils [error@wrapAsync] {
  "name": "DriverAdapterError",
  "cause": {
    "kind": "TableDoesNotExist"
  }
} +93ms
prisma:driver-adapter:pg [js::query_raw] '{\n' +
  `  "sql": "SELECT EXISTS(SELECT 1 FROM pg_namespace WHERE nspname = $1), version(), current_setting('server_version_num')::integer as numeric_version;",\n` +
  '  "args": [\n' +
  '    "public"\n' +
  '  ],\n' +
  '  "argTypes": [\n' +
  '    "Text"\n' +
  '  ]\n' +
  '}' +179ms
prisma:driver-adapter:pg [js::query_raw] '{\n' +
  '  "sql": "SELECT namespace.nspname as namespace_name\\nFROM pg_namespace as namespace\\nWHERE namespace.nspname = ANY ( $1 )\\nORDER BY namespace_name;\\n",\n' +
  '  "args": [\n' +
  '    [\n' +
  '      "public"\n' +
  '    ]\n' +
  '  ],\n' +
  '  "argTypes": [\n' +
  '    "Array"\n' +
  '  ]\n' +
  '}' +31ms
driver-adapter-utils [error@wrapAsync] {
  "name": "DriverAdapterError",
  "cause": {
    "kind": "UnsupportedNativeDataType",
    "type": "name"
  }
} +211ms
prisma:driver-adapter:pg [js::query_raw] '{\n' +
  '  "sql": "SELECT namespace.nspname as namespace_name\\nFROM pg_namespace as namespace\\nWHERE namespace.nspname = ANY ( $1 )\\nORDER BY namespace_name;\\n",\n' +
  '  "args": [\n' +
  '    [\n' +
  '      "public"\n' +
  '    ]\n' +
  '  ],\n' +
  '  "argTypes": [\n' +
  '    "Array"\n' +
  '  ]\n' +
  '}' +73ms
driver-adapter-utils [error@wrapAsync] {
  "name": "DriverAdapterError",
  "cause": {
    "kind": "UnsupportedNativeDataType",
    "type": "name"
  }
} +100ms
prisma:schemaEngine:wasm:stdout [devDiagnostic] error: '{\n  "name": "SchemaConnectorError"\n}' +317ms
prisma:schemaEngine:wasm:stderr e.message Column type 'name' could not be deserialized from the database.     
   0: sql_schema_connector::flavour::postgres::describe_schema_with
           with circumstances=BitFlags<Circumstances>(0b100, CanPartitionTables) preview_features=BitFlags<PreviewFeature>(0b0) namespaces=None schema="public"
             at schema-engine/connectors/sql-schema-connector/src/flavour/postgres.rs:601
   1: schema_engine_wasm::wasm::engine::DevDiagnostic
             at schema-engine/schema-engine-wasm/src/wasm/engine.rs:205 +0ms
prisma:schemaEngine:wasm:stderr e.cause undefined +1ms
prisma:schemaEngine:wasm:stderr e.stack SchemaConnectorError: Column type 'name' could not be deserialized from the database.
   0: sql_schema_connector::flavour::postgres::describe_schema_with
           with circumstances=BitFlags<Circumstances>(0b100, CanPartitionTables) preview_features=BitFlags<PreviewFeature>(0b0) namespaces=None schema="public"
             at schema-engine/connectors/sql-schema-connector/src/flavour/postgres.rs:601
   1: schema_engine_wasm::wasm::engine::DevDiagnostic
             at schema-engine/schema-engine-wasm/src/wasm/engine.rs:205
    at Kpt (D:\Code\prisma-migrate-adapter-pg-name-repro\node_modules\prisma\build\index.js:160:2009)
    at wasm://wasm/00edcdf2:wasm-function[4785]:0x30ccd0
    at wasm://wasm/00edcdf2:wasm-function[1424]:0x2920e8
    at wasm://wasm/00edcdf2:wasm-function[135]:0xb095d
    at wasm://wasm/00edcdf2:wasm-function[1515]:0x29a81a
    at wasm://wasm/00edcdf2:wasm-function[4694]:0x30bf58
    at wasm://wasm/00edcdf2:wasm-function[4908]:0x30d865
    at mpt (D:\Code\prisma-migrate-adapter-pg-name-repro\node_modules\prisma\build\index.js:160:154)
    at a (D:\Code\prisma-migrate-adapter-pg-name-repro\node_modules\prisma\build\index.js:159:12362)
    at node:internal/process/task_queues:151:7 +0ms
Error: SchemaConnectorError: Column type 'name' could not be deserialized from the database.
   0: sql_schema_connector::flavour::postgres::describe_schema_with
           with circumstances=BitFlags<Circumstances>(0b100, CanPartitionTables) preview_features=BitFlags<PreviewFeature>(0b0) namespaces=None schema="public"
             at schema-engine/connectors/sql-schema-connector/src/flavour/postgres.rs:601
   1: schema_engine_wasm::wasm::engine::DevDiagnostic
             at schema-engine/schema-engine-wasm/src/wasm/engine.rs:205
    at Kpt (D:\Code\prisma-migrate-adapter-pg-name-repro\node_modules\prisma\build\index.js:160:2009)
    at wasm://wasm/00edcdf2:wasm-function[4785]:0x30ccd0
    at wasm://wasm/00edcdf2:wasm-function[1424]:0x2920e8
    at wasm://wasm/00edcdf2:wasm-function[135]:0xb095d
    at wasm://wasm/00edcdf2:wasm-function[1515]:0x29a81a
    at wasm://wasm/00edcdf2:wasm-function[4694]:0x30bf58
    at wasm://wasm/00edcdf2:wasm-function[4908]:0x30d865
    at mpt (D:\Code\prisma-migrate-adapter-pg-name-repro\node_modules\prisma\build\index.js:160:154)
    at a (D:\Code\prisma-migrate-adapter-pg-name-repro\node_modules\prisma\build\index.js:159:12362)
    at node:internal/process/task_queues:151:7

Environment & Setup

  • OS: Windows 11
  • Database: PostgreSQL (Tested on 16 and 17)
  • Node.js version: 24.2.0

Prisma Version

Loaded Prisma config from "D:\Code\prisma-migrate-adapter-pg-name-repro\prisma.config.ts".
Prisma config detected, skipping environment variable loading.
Prisma schema loaded from prisma\schema.prisma
prisma                  : 6.9.0
@prisma/client          : Not found
Computed binaryTarget   : windows
Operating System        : win32
Architecture            : x64
Node.js                 : v24.2.0
TypeScript              : 5.8.3
Query Engine (Node-API) : libquery-engine 81e4af48011447c3cc503a190e86995b66d2a28e (at node_modules\@prisma\engines\query_engine-windows.dll.node)
Schema Engine           : schema-engine-cli 81e4af48011447c3cc503a190e86995b66d2a28e (at node_modules\@prisma\engines\schema-engine-windows.exe)
Schema Wasm             : @prisma/prisma-schema-wasm 6.9.0-10.81e4af48011447c3cc503a190e86995b66d2a28e        
Default Engines Hash    : 81e4af48011447c3cc503a190e86995b66d2a28e
Studio                  : 0.511.0
Preview Features        : driverAdapters, queryCompiler

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions