Error in `migrate` command: `PostgresError: no schema has been selected to create in`

bunx drizzle-kit migrate
No config path provided, using default 'drizzle.config.ts'
Reading config file '/Users/ftzi/dev/main-nextstack-website/drizzle.config.ts'
postgresql://neondb_owner:DkIm2cK9NiCe@ep-raspy-math-a2mlj10n-pooler.eu-central-1.aws.neon.tech/neondb?sslmode=require
Using 'postgres' driver for database querying
[⣟] applying migrations...PostgresError: no schema has been selected to create in
    at ErrorResponse (file:///Users/ftzi/dev/main-nextstack-website/node_modules/postgres/src/connection.js:788:26)
    at handle (file:///Users/ftzi/dev/main-nextstack-website/node_modules/postgres/src/connection.js:474:6)
    at TLSSocket.data (file:///Users/ftzi/dev/main-nextstack-website/node_modules/postgres/src/connection.js:315:9)
    at TLSSocket.emit (node:events:518:28)
    at addChunk (node:internal/streams/readable:561:12)
    at readableAddChunkPushByteMode (node:internal/streams/readable:512:3)
    at Readable.push (node:internal/streams/readable:392:5)
    at TLSWrap.onStreamRead (node:internal/stream_base_commons:189:23) {
  severity_local: 'ERROR',
  severity: 'ERROR',
  code: '3F000',
  position: '14',
  file: 'namespace.c',
  line: '702',
  routine: 'RangeVarGetCreationNamespace'
}


My config. If I console.log something there, it's properly printed when the command above is run.

import type { Config } from "drizzle-kit";

export default {
  schema: "./src/server/db/schema",
  dialect: "postgresql",

  dbCredentials: {
    url: process.env.DATABASE_URL ?? "MISSING",
  },

  migrations: {
    table: "__drizzle_migrations",
    schema: "drizzle",
  },
} satisfies Config;
Was this page helpful?