Command:
1 2 3 4 5 6 7 8 9 10 11 |
php artisan make:migration create_user_table --create=user php artisan migrate php artisan migrate:rollback php artisan migrate:reset php artisan migrate:refresh php artisan migrate --seed |
Migration Class:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
<?php use Illuminate\Support\Facades\Schema; use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Migrations\Migration; class CreateChildAccountTable extends Migration { /** * Run the migrations. * * @return void */ public function up() { Schema::create('member_child', function (Blueprint $table) { $table->increments('id'); $table->integer('parent_id')->comment('主帳號ID'); $table->tinyInteger('type'); $table->string('username', 30)->nullable(); $table->string('child', 20)->default('test'); $table->longText('description'); $table->text('description'); $table->tinyInteger('permission')->comment('1:view, 2:inherit'); $table->dateTime('login_time')->nullable(); $table->date('tx_date')->nullable(); $table->decimal('fee', 10, 2)->nullable()->comment('手續費'); $table->timestamps(); //$table->dateTime('created_time'); //$table->dateTime('updated_time')->nullable(); $table->softDeletes(); }); } /** * Reverse the migrations. * * @return void */ public function down() { Schema::dropIfExists('member_child'); } } |
Reference: