Creating Migrations in Payload

For creating the migration in the payload

we may need to run the payload script

Create a new migration file in the migrations directory. You can optionally name the migration that will be created. By default, migrations will be named using a timestamp.

npm run payload migrate:create optional-name-here

To run the migrations from the crated fike on the application

The migrate command will run any migrations that have not yet been run.

npm run payload migrate

To view the status of the migrations

The migrate:status command will check the status of migrations and output a table of which migrations have been run, and which migrations have not yet run.

npm run payload migrate:status

To Down the migrations Run the following command:

npm run payload migrate:down

Leave a comment

Your email address will not be published. Required fields are marked *