Files
Document-Management-System-…/database/migrations/2021_04_03_040100_create_users_table.php
2021-04-25 04:29:56 -07:00

51 lines
1.3 KiB
PHP

<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateUsersTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('users', function (Blueprint $table) {
$table->string('id', 20)->primary();
$table->string('name');
$table->string('email')->unique();
$table->string('tel')->unique();
$table->date('birthday')->nullable();
$table->string('department_id', 7);
$table->string('title_id', 5);
$table->timestamp('email_verified_at')->nullable();
$table->string('password');
$table->boolean('active')->default(true);
$table->rememberToken();
$table->timestamps();
$table->foreign('department_id')
->references('id')
->on('departments')
->onUpdate('cascade');
$table->foreign('title_id')
->references('id')
->on('titles')
->onUpdate('cascade');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('users');
}
}