liquid207 / laravel-enum-migration
为迁移枚举列提供宏。
v1.0.0
2019-08-01 08:19 UTC
Requires
- illuminate/database: 5.4.*|5.5.*|5.6.*|5.7.*|5.8.*
This package is auto-updated.
Last update: 2024-09-07 16:03:46 UTC
README
为迁移枚举列提供宏。
功能
- 向枚举列追加新选项。
- 通过名称从枚举列中移除选项。
安装
- 运行
composer require liquid207/laravel-enum-migration
使用方法
class User extends Migration { /** * Run the migrations. * * @return void */ public function up() { Schema::table('users', function (Blueprint $table) { // Append one $table->enumAppend('type', 'option1'); // Append array $table->enumAppend('type', ['option2', 'option3']); }); } /** * Reverse the migrations. * * @return void */ public function down() { Schema::table('users', function (Blueprint $table) { // Remove one $table->enumRemove('type', 'option1'); // Remove array $table->enumRemove('type', ['option2', 'option3']); }); } }