/migration-stub-extention

extention migration stub files for Laravel

Primary LanguagePHPMIT LicenseMIT

kosa3/migrationStubExtention

Software License

Install

Require this package with composer using the following command:

composer require --dev kosa3/migration-stub-extention:dev-master

After updating composer, add the migration directory to the resources stubs blank.stub create.stub update.stub

You can customize the stub file freely.

public function up()
{
    Schema::create('DummyTable', function (Blueprint $table) {
        $table->bigIncrements('id');
        $table->timestamp('created_at')->nullable();
        $table->string('create_type', 32)->nullable()->default(null);
        $table->integer('create_id')->nullable()->default(null);
        $table->timestamp('updated_at')->nullable();
        $table->string('update_type', 32)->nullable()->default(null);
        $table->integer('update_id')->nullable()->default(null);
    });
}

After edited, make migration file by artisan command.

php artisan make:migration CreateUser --create users
class CreateUser extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('users', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->timestamp('created_at')->nullable();
            $table->string('create_type', 32)->nullable()->default(null);
            $table->integer('create_id')->nullable()->default(null);
            $table->timestamp('updated_at')->nullable();
            $table->string('update_type', 32)->nullable()->default(null);
            $table->integer('update_id')->nullable()->default(null);
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('users');
    }
}

License

The package is open-source software licensed under the MIT license.