DT
Drizzle Team•3mo ago
Eric

Error creating migration in PayloadCMS

Not sure if this is the place to ask, but as Payload is just using Drizzle for DB Management and Migrations, I figured this might be a drizzle issue and not a payload issue. Anyways, when I try to create a new migration, I get the following error:
/node_modules/.pnpm/[email protected][email protected][email protected]/node_modules/payload/src/bin/migrate.ts:100
throw new Error(Error creating migration: ${error})
^


Error: Error creating migration: [
{
"code": "invalid_literal",
"expected": "7",
"path": [
"version"
],
"message": "Invalid literal value, expected "7""
},
{
"code": "invalid_literal",
"expected": "postgresql",
"path": [
"dialect"
],
"message": "Invalid literal value, expected "postgresql""
},
{
"code": "invalid_type",
"expected": "object",
"received": "undefined",
"path": [
"tables"
],
"message": "Required"
},
{
"code": "invalid_type",
"expected": "object",
"received": "undefined",
"path": [
"enums"
],
"message": "Required"
},
{
"code": "invalid_type",
"expected": "object",
"received": "undefined",
"path": [
"schemas"
],
"message": "Required"
},
{
"code": "invalid_type",
"expected": "object",
"received": "undefined",
"path": [
"_meta"
],
"message": "Required"
},
{
"code": "invalid_type",
"expected": "string",
"received": "undefined",
"path": [
"prevId"
],
"message": "Required"
}
]
at migrate (/node_modules/payload/src/bin/migrate.ts💯15)
at async start (/node_modules/.pnpm/[email protected][email protected][email protected]/node_modules/payload/bin.js:30:7)

Node.js v23.11.1
 ELIFECYCLE  Command failed with exit code 1.
/node_modules/.pnpm/[email protected][email protected][email protected]/node_modules/payload/src/bin/migrate.ts:100
throw new Error(Error creating migration: ${error})
^


Error: Error creating migration: [
{
"code": "invalid_literal",
"expected": "7",
"path": [
"version"
],
"message": "Invalid literal value, expected "7""
},
{
"code": "invalid_literal",
"expected": "postgresql",
"path": [
"dialect"
],
"message": "Invalid literal value, expected "postgresql""
},
{
"code": "invalid_type",
"expected": "object",
"received": "undefined",
"path": [
"tables"
],
"message": "Required"
},
{
"code": "invalid_type",
"expected": "object",
"received": "undefined",
"path": [
"enums"
],
"message": "Required"
},
{
"code": "invalid_type",
"expected": "object",
"received": "undefined",
"path": [
"schemas"
],
"message": "Required"
},
{
"code": "invalid_type",
"expected": "object",
"received": "undefined",
"path": [
"_meta"
],
"message": "Required"
},
{
"code": "invalid_type",
"expected": "string",
"received": "undefined",
"path": [
"prevId"
],
"message": "Required"
}
]
at migrate (/node_modules/payload/src/bin/migrate.ts💯15)
at async start (/node_modules/.pnpm/[email protected][email protected][email protected]/node_modules/payload/bin.js:30:7)

Node.js v23.11.1
 ELIFECYCLE  Command failed with exit code 1.
If this is not the right place to ask, I apologize, but maybe someone has an idea on how to debug this further, thanks!
1 Reply
Eric
EricOP•3mo ago
Couriously, after running pnpm payload migrate:create your_migration_name --force-accept-warning --skip-empty, I was able to create new migrations just fine again … Not sure what the issue was, but I guess it’s fixed?

Did you find this page helpful?