Declarative schema management with automatic migrations in Akron ORM.
Akron features powerful declarative schema management with automatic migration generation and database synchronization. Define your schema in JSON and let Akron handle the implementation.
Initialize Project
Run akron db init
to create akron.json
Define Schema
Edit akron.json to define your database structure
Generate Migrations
Run akron db makemigrations
to create migration files
Apply Changes
Run akron db migrate
to update your database
Start by initializing a new Akron project. This creates the akron.json
schema file and .akron/
directory for migrations.
ā Initialized Akron project Provider: sqlite Database: sqlite:///app.db Schema file: akron.json š Next steps: 1. Edit akron.json to define your schema 2. Run 'akron db makemigrations' to generate migrations 3. Run 'akron db migrate' to apply migrations
Edit the generated akron.json
file to define your database structure with tables, columns, and relationships.
After defining your schema, generate migration files that describe the changes needed to transform your database.
ā Generated migration: add_user_posts File: .akron/add_user_posts.json Steps: 2 š Migration preview: 1. Create table 'users' 2. Create table 'posts'
Apply the pending migrations to update your database schema.
š¦ Applying 1 migration(s)... Applying add_user_posts.json... ā Applied add_user_posts.json ā All migrations applied successfully!
Monitor your schema and migration status at any time.
š Akron Status ================================================== Schema file: akron.json Database: sqlite URL: sqlite:///app.db Tables: 2 ā Schema is up to date Applied migrations: 1 Pending migrations: 0
int
- Integer numbersstr
- String/VARCHARtext
- Long text contentbool
- Boolean valuesfloat
- Floating point numbersdatetime
- Date and timedate
- Date onlytime
- Time onlyjson
- JSON dataConstraint | Type | Description |
---|---|---|
primary_key | boolean | Mark column as primary key |
auto_increment | boolean | Auto-increment values (integers only) |
unique | boolean | Enforce unique constraint |
nullable | boolean | Allow NULL values |
default | any | Default value for column |
max_length | integer | Maximum length (strings) |
Initialize a new Akron project with schema configuration.
akron db init --provider sqlite
Generate migration files from schema changes.
akron db makemigrations --name "add_tables"