Stars: 106
Forks: 9
Pull Requests: 151
Issues: 75
Watchers: 4
Last Updated: 2023-09-13 10:22:33
Laravel migration support tool, Always generate the latest migration files on schema.yml
License: MIT License
Languages: PHP, Makefile
Dacapo is a Laravel migration file creation support library. Define the table structure in the schema yml file, Always generate the latest and tidy migration file.
This library is intended for use only in the coding phase. In the operation phase, uninstall and return to normal migration operation.
$ composer require --dev ucan-lab/laravel-dacapo
$ php artisan dacapo:init
database/schemas/default.yml
By default, a schema file for Laravel8 is generated.
users:
columns:
id:
name: string
email:
type: string
unique:
email_verified_at:
type: timestamp
nullable:
password: string
rememberToken:
timestamps:
password_resets:
columns:
email:
type: string
index:
token: string
created_at:
type: timestamp
nullable:
failed_jobs:
columns:
id:
uuid:
type: string
unique:
connection: text
queue: text
payload: longText
exception: longText
failed_at:
type: timestamp
useCurrent:
$ php artisan dacapo
3 files are generated and migrate fresh.
# Execute migrate and seeding
$ php artisan dacapo --seed
# Do not execute migrate
$ php artisan dacapo --no-migrate
{}
any valuedatabase/schemas/*.yml
php artisan make:migration
# COMMENT
{TableName}:
columns:
{ColumnName}: {ColumnType}
{ColumnName}:
type: {ColumnType}
{ColumnName}:
unique: true
nullable: true
default: {DefaultValue}
comment: {ColumnName}
{ColumnModifier}: {ColumnModifierValue}
indexes:
- columns: {ColumnName}
type: {IndexType}
- columns: [{ColumnName}, {ColumnName}]
type: {IndexType}
- columns: {ColumnName}
type: {IndexType}
name: {IndexName}
foreign_keys:
- columns: {ColumnName}
references: {ReferenceColumnName}
table: {ReferenceTableName}
- columns: {ColumnName}
references: {ReferenceColumnName}
table: {ReferenceTableName}
onUpdateAction: {ConstraintProperty}
onDeleteAction: {ConstraintProperty}
- columns: [{ColumnName}, {ColumnName}]
references: [{ReferenceColumnName}, {ReferenceColumnName}]
table: {ReferenceTableName}
{TableName}:
columns:
{ColumnName}: {ColumnType}
$ php artisan dacapo:clear
$ php artisan dacapo:clear --all
--all
Delete including standard migration files.$ php artisan dacapo:stub:publish
$ php artisan dacapo:uninstall
$ composer remove --dev ucan-lab/laravel-dacapo