51 lines
1.5 KiB
PHP
51 lines
1.5 KiB
PHP
<?php
|
|
|
|
use Illuminate\Support\Facades\Schema;
|
|
use Illuminate\Database\Schema\Blueprint;
|
|
use Illuminate\Database\Migrations\Migration;
|
|
|
|
class CreateUsersTable extends Migration
|
|
{
|
|
/**
|
|
* Run the migrations.
|
|
*/
|
|
public function up()
|
|
{
|
|
// necessary for SQLlite
|
|
Schema::enableForeignKeyConstraints();
|
|
|
|
Schema::create('users', function (Blueprint $table) {
|
|
$table->id();
|
|
$table->unsignedBigInteger('account_id');
|
|
$table->string('first_name');
|
|
$table->string('last_name');
|
|
$table->string('email')->unique();
|
|
$table->timestamp('email_verified_at')->nullable();
|
|
$table->string('password');
|
|
$table->boolean('is_account_administrator')->default(false);
|
|
$table->rememberToken();
|
|
$table->timestamps();
|
|
$table->foreign('account_id')->references('id')->on('accounts')->onDelete('cascade');
|
|
});
|
|
|
|
Schema::create('vaults', function (Blueprint $table) {
|
|
$table->id();
|
|
$table->unsignedBigInteger('account_id');
|
|
$table->string('type');
|
|
$table->string('name');
|
|
$table->string('description')->nullable();
|
|
$table->timestamps();
|
|
$table->foreign('account_id')->references('id')->on('accounts')->onDelete('cascade');
|
|
});
|
|
}
|
|
|
|
/**
|
|
* Reverse the migrations.
|
|
*/
|
|
public function down()
|
|
{
|
|
Schema::dropIfExists('users');
|
|
Schema::dropIfExists('vaults');
|
|
}
|
|
}
|