[Feature Request] Allow non-interactive mode for payload migrate:create to support CI/CD and hand-written migrations
#15359
Replies: 7 comments
-
|
Hello @joshuatza, can i give it a try? |
Beta Was this translation helpful? Give feedback.
-
|
Yes you can what do you need |
Beta Was this translation helpful? Give feedback.
-
|
Thanks! I'll take a look at the codebase and come back if I have questions. I'm thinking the --non-interactive flag is the cleanest solution - does that work for you? |
Beta Was this translation helpful? Give feedback.
-
|
Hello there, i created a PR. im happy to fix mongo, and any other integration, as well as the rest of the of the commands. |
Beta Was this translation helpful? Give feedback.
-
|
Is there non-interactive flag for |
Beta Was this translation helpful? Give feedback.
-
|
There is a new PR opened by the Payload team that may be related to this feature request: #15285 |
Beta Was this translation helpful? Give feedback.
-
|
^ that one is slightly different, I'll convert this to a feature request and put it on the backlog |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Description
When writing hand-written/manual migrations (for data transformations, complex schema changes, etc.), there's no way to generate the corresponding JSON schema snapshot without running the interactive
payload migrate:createcommand.This causes problems because:
migrate:createwill try to re-create the same schema changes (duplicate columns, tables, etc.)Current Behavior
payload migrate:createis always interactive, prompting for each table change:Expected Behavior
Provide one or more of these options:
--non-interactiveflag: Auto-select default options (create table vs rename)--json-onlyflag: Generate only the JSON schema snapshot without the TypeScript migration file--from-migration <name>flag: Generate JSON snapshot based on the schema state after a specific migration runsUse Case
We have hand-written migrations for complex data transformations:
This migration has no JSON file because it was hand-written. Now when we run
migrate:create, it wants to re-createestate_sub_statusesbecause Payload doesn't know it already exists.Environment
@payloadcms/db-postgresPossible Solutions
--yesor--non-interactiveflag to accept defaultspayload migrate:snapshotpayload migrate:syncBeta Was this translation helpful? Give feedback.
All reactions