|
| 1 | +<?php |
| 2 | + |
| 3 | + |
| 4 | +use Illuminate\Database\Migrations\Migration; |
| 5 | +use Illuminate\Database\Schema\Blueprint; |
| 6 | +use Illuminate\Support\Facades\Schema; |
| 7 | +use Modules\Admin\Supports\Constant; |
| 8 | +use Modules\Admin\Supports\DefaultValue; |
| 9 | + |
| 10 | +class CreateUsersTable extends Migration |
| 11 | +{ |
| 12 | + /** |
| 13 | + * Run the migrations. |
| 14 | + * |
| 15 | + * @return void |
| 16 | + */ |
| 17 | + public function up() |
| 18 | + { |
| 19 | + Schema::create('users', function (Blueprint $table) { |
| 20 | + $table->id(); |
| 21 | + $table->string('name'); |
| 22 | + $table->string('email')->nullable()->unique(); |
| 23 | + $table->string('username')->nullable()->unique(); |
| 24 | + $table->string('mobile')->nullable()->unique(); |
| 25 | + $table->string('password'); |
| 26 | + $table->boolean('force_pass_reset')->default(false); |
| 27 | + $table->string('remarks')->nullable(); |
| 28 | + $table->enum('enabled', array_keys(Constant::ENABLED_OPTIONS)) |
| 29 | + ->default(DefaultValue::ENABLED_OPTION)->nullable(); |
| 30 | + $table->rememberToken(); |
| 31 | + $table->foreignId('created_by')->index()->nullable(); |
| 32 | + $table->foreignId('updated_by')->index()->nullable(); |
| 33 | + $table->foreignId('deleted_by')->index()->nullable(); |
| 34 | + $table->dateTime('email_verified_at')->nullable(); |
| 35 | + $table->dateTime('created_at')->nullable(); |
| 36 | + $table->dateTime('updated_at')->nullable(); |
| 37 | + $table->dateTime('deleted_at')->nullable(); |
| 38 | + }); |
| 39 | + } |
| 40 | + |
| 41 | + /** |
| 42 | + * Reverse the migrations. |
| 43 | + * |
| 44 | + * @return void |
| 45 | + */ |
| 46 | + public function down() |
| 47 | + { |
| 48 | + Schema::dropIfExists('users'); |
| 49 | + } |
| 50 | +} |
0 commit comments