Cli
Migrate
Migrate
migrate
Apply database migrations to update your database schema.
Usage
nailgun migrateDescription
The migrate command applies all pending database migrations for special schema changes only. It runs migrations, applies fixtures, and handles predefined data. For general schema synchronization, use the sync command.
What It Does
- Starts up the Zodula server
- Applies all pending migrations (special schema changes only)
- Syncs database schema with current doctype definitions
- Applies fixtures (sample data)
- Applies predefined data
Migration Process
The migration process includes:
- Special Schema Changes: Applies custom migrations for complex schema changes (for example, adding a new field to a doctype)
- Data Migrations: Transforms existing data as needed
- Fixtures: Applies sample/test data
- Predefined Data: Sets up initial system data
When to Use
Run migrate when:
- After creating custom migrations for special schema changes
- After generating new migrations
- When setting up a fresh database
- After pulling changes that include migrations
- When you need to apply fixtures and predefined data
Note: For regular doctype changes, the schema will be automatically synced. Use nailgun sync for manual schema synchronization.
Example
$ nailgun migrate
✓ Applying migrations...
✓ Applying fixtures...
✓ Applying predefined data...
✓ Syncing database schema...
✓ Migration completed successfullyImportant Notes
- Always backup your database before running migrations in production
- Test migrations in a development environment first
- Some migrations may be irreversible
- The command will exit after completion
Troubleshooting
If migrations fail:
- Check the error messages in the terminal
- Ensure your database is accessible
- Verify migration files are valid
- Consider restoring from backup if needed
Tips
- Run
nailgun generatebeforemigrateto create new migrations for special schema changes - Use
nailgun syncfor regular schema synchronization - Use
nailgun backupbefore major migrations - Test migrations in development first
- Keep your database backups up to date
- Migrations are now only for special cases - regular doctype changes are handled automatically
Zodula