marick / classless-migrations-for-laravel
v0.0.4
2024-09-11 09:25 UTC
Requires
- php: ^8.1
- thecodingmachine/safe: ^2.5
Requires (Dev)
- doctrine/dbal: ^3.9
- larastan/larastan: ^2.9
- laravel/pint: ^1.13
- nunomaduro/collision: ^7.0|^8.0
- orchestra/testbench: ^8.0|^9.0
- thecodingmachine/phpstan-safe-rule: ^1.2
README
此包允许您创建如下无类的迁移
<?php declare(strict_types=1); use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; Schema::create('posts', function (Blueprint $table) { $table->id(); $table->string('title'); $table->string('slug'); $table->text('body'); $table->boolean('published')->default(false); $table->timestamps(); $table->softDeletes(); });
您可能注意到没有回滚此迁移的方法。这是故意的。本包是为那些已经在迁移中跳过 down() 方法的冒险者准备的。现在,您甚至没有这个选项——从此处开始,只能向前推进!
安装
composer require marick/classless-migrations-for-laravel
就这些。您现在可以编写无类的迁移了。
发布迁移存根
php artisan classless-migrations:make-stub
将发布迁移存根,以便 php artisan make:migration 创建无类的迁移。
重要问题
我应该使用这个吗?
也许吧!你应该吗?
我的团队或我的公司应该使用这个吗?
可能不应该!