rbrecruiter/database/migrations/2021_03_29_224932_api_keys.php

43 lines
972 B
PHP
Raw Normal View History

2021-03-30 00:27:49 +00:00
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class ApiKeys extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
// API keys can only access resources the owner's account can access
Schema::create('api_keys', function (Blueprint $table) {
$table->id();
$table->string('discriminator');
$table->string('secret');
$table->enum('status', ['disabled', 'active']);
$table->bigInteger('owner_user_id')->unsigned();
$table->foreign('owner_user_id')
->references('id')
->on('users')
->cascadeOnDelete()
->cascadeOnUpdate();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
//
}
}