🧪 This package is currently under development. Features, APIs and behavior may change at any time.
Generate Laravel migration files based on a simple DSL (domain-specific language) written in a single file: schema.db
.
Then run:
composer require gabrielrcosta1/laravel-schema
- Adds Artisan commands:
schema:create
schema:migrate
schema:reset
- Lets you define your database tables in a single DSL file
- Generates Laravel-compatible migration files into
database/migrations
- Tracks schema changes and generates only incremental migrations
- Supports full or table-specific reset
- Lets you run
php artisan migrate
as usual
php artisan schema:create
This will create the file:
/your-laravel-project/database/schema.db
With default content for:
posts
Edit database/schema.db
like this:
table posts {
id primary
title string
body text
published_at timestamp nullable
user_id foreign:users.id
timestamps
softDeletes
}
php artisan schema:migrate
This will:
- Parse
schema.db
- Compare with previous schema
- Generate new migrations:
- full table migrations
- incremental
add_
/remove_
migrations
php artisan migrate
If you want to delete generated migrations and schema cache:
php artisan schema:reset --all
php artisan schema:reset
# You will be prompted for the table name
This deletes:
- The migration files related to the selected table(s)
- The schema cache files (.json and .hash)
Command | Description |
---|---|
schema:create |
Create schema.db with default tables |
schema:migrate |
Generate migrations from schema (full or incremental) |
schema:reset |
Delete generated migrations and cache (--all or specific) |
php artisan migrate |
Apply the generated migrations |
This package is in development.
Use at your own risk in production environments.
Contributions, ideas, and issues are welcome.
MIT — © Gabriel R. Costa