50 lines
1.4 KiB
PHP
50 lines
1.4 KiB
PHP
|
<?php
|
||
|
|
||
|
use Illuminate\Database\Migrations\Migration;
|
||
|
use Illuminate\Database\Schema\Blueprint;
|
||
|
use Illuminate\Support\Facades\DB;
|
||
|
use Illuminate\Support\Facades\Schema;
|
||
|
|
||
|
return new class extends Migration
|
||
|
{
|
||
|
/**
|
||
|
* Run the migrations.
|
||
|
*
|
||
|
* @return void
|
||
|
*/
|
||
|
public function up()
|
||
|
{
|
||
|
Schema::create('users', function (Blueprint $table) {
|
||
|
$table->id();
|
||
|
$table->string('guid')->unique()->nullable();
|
||
|
$table->string('domain')->nullable();
|
||
|
$table->string('name');
|
||
|
$table->string('username')->unique()->nullable();
|
||
|
$table->string('password')->nullable();
|
||
|
$table->rememberToken();
|
||
|
|
||
|
$table->unsignedBigInteger('loaner_type_id')->default(1);
|
||
|
$table->unsignedBigInteger('role_id')->default(2);
|
||
|
|
||
|
$table->timestamp('created_at')->default(DB::raw('CURRENT_TIMESTAMP'));
|
||
|
$table->timestamp('updated_at')->default(DB::raw('CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP'));
|
||
|
$table->timestamp('deleted_at')->nullable();
|
||
|
|
||
|
$table->foreign('loaner_type_id')->references('id')->on('loaner_types')->onDelete('cascade');
|
||
|
$table->foreign('role_id')->references('id')->on('roles')->onDelete('cascade');
|
||
|
|
||
|
|
||
|
});
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* Reverse the migrations.
|
||
|
*
|
||
|
* @return void
|
||
|
*/
|
||
|
public function down()
|
||
|
{
|
||
|
Schema::dropIfExists('users');
|
||
|
}
|
||
|
};
|