Apply pending migrations to update your database schema according to your akron.json configuration.
Apply pending migration files to update your database schema and synchronize it with your akron.json configuration.
Option | Description | Default |
---|---|---|
--dry-run | Show what would be migrated without applying changes | false |
akron.json
_akron_migrations
tablePreview what changes will be applied without modifying the database:
š Dry run - showing pending migrations: ⢠initial.json ⢠add_user_authentication.json ⢠create_posts_table.json
Apply all pending migrations to the database:
š¦ Applying 3 migration(s)... Applying initial.json... ā Applied initial.json Applying add_user_authentication.json... ā Applied add_user_authentication.json Applying create_posts_table.json... ā Applied create_posts_table.json ā All migrations applied successfully!
When all migrations are already applied:
ā No pending migrations.
When a migration fails:
š¦ Applying 2 migration(s)... Applying initial.json... ā Applied initial.json Applying invalid_migration.json... ā Migration failed: column 'email' already exists Error: Migration stopped due to failure. Please fix the issue and try again.
create_table
- Create new tables with schemadrop_table
- Remove existing tablesadd_column
- Add new columns to tablesdrop_column
- Remove columns (limited support)modify_column
- Change column definitions (limited support)Akron tracks applied migrations in a special table:
SQLite, MySQL, PostgreSQL:
Document database:
Check your database URL in akron.json and ensure the database server is running.
This migration was already applied. Check akron db status for current state.
The migration tries to create a column that already exists. Review your schema changes.
akron db status
--dry-run
first to preview changesakron db status