hughcube / laravel-migration
The Laravel Migration package.
1.0.0
2020-03-26 02:11 UTC
Requires
- php: >=7.0
- illuminate/database: ^5.0|^6.0|^7.0
Requires (Dev)
- phpstan/phpstan: ^0.9.0|^0.11.0|^0.12.0
- phpunit/phpunit: ^6.0|^7.0|^8.0
- squizlabs/php_codesniffer: ^3.0
This package is auto-updated.
Last update: 2024-10-26 12:50:00 UTC
README
Installing
$ composer require hughcube/laravel-migration -vvv
Basic Usage (In artisan file)
#!/usr/bin/env php <?php use Symfony\Component\Console\Input\ArgvInput; use Symfony\Component\Console\Output\ConsoleOutput; /* |-------------------------------------------------------------------------- | Create The Application |-------------------------------------------------------------------------- | | First we need to get an application instance. This creates an instance | of the application / container and bootstraps the application so it | is ready to receive HTTP / Console requests from the environment. | */ $app = require __DIR__ . '/bootstrap/app.php'; /* |-------------------------------------------------------------------------- | Run The Artisan Application |-------------------------------------------------------------------------- | | When we run the console application, the current CLI command will be | executed in this console and the response sent back to a terminal | or another output device for the developers. Here goes nothing! | */ $kernel = $app->make( 'Illuminate\Contracts\Console\Kernel' ); /** !!! Register after kernel is created */ $app->register(\HughCube\Laravel\Migrations\ServiceProvider::class); exit($kernel->handle(new ArgvInput, new ConsoleOutput));
Example
<?php use Illuminate\Database\Migrations\Migration; use HughCube\Laravel\Migrations\Blueprint; use HughCube\Laravel\Migrations\Schema; class CreateExampleTable extends Migration { /** * Run the migrations. * * @return void */ public function up() { Schema::create('example', function (Blueprint $table) { $table->id(); $table->timestamps(); /** Set table comment */ $table->comment = "Example"; }); } /** * Reverse the migrations. * * @return void */ public function down() { Schema::dropIfExists('example'); } }