Generate migration files automatically from schema changes in your akron.json configuration.
Automatically generate migration files by comparing your current schema with the last snapshot.
Option | Description | Default |
---|---|---|
--name | Custom name for the migration file | Auto-generated |
akron.json
schema definition.akron/
directoryGenerate migration with automatic naming:
ā Generated migration: migration_0001 File: .akron/migration_0001.json Steps: 3 š Migration preview: 1. Create table 'users' 2. Create table 'posts' 3. Create table 'comments'
Generate migration with descriptive name:
ā Generated migration: add_user_authentication File: .akron/add_user_authentication.json Steps: 2 š Migration preview: 1. Add column 'password_hash' to 'users' 2. Add column 'last_login' to 'users'
When schema hasn't changed:
ā No changes detected in schema.
Example migration file structure:
create_table
- Create new tablesdrop_table
- Remove existing tablesadd_column
- Add new columnsdrop_column
- Remove columnsmodify_column
- Change column typesakron db migrate --dry-run
to preview changesakron db migrate
akron db status