Differential D2494 Diff 6958 src/database/migrations/2016_06_01_000002_create_oauth_access_tokens_table.php
Changeset View
Changeset View
Standalone View
Standalone View
src/database/migrations/2016_06_01_000002_create_oauth_access_tokens_table.php
- This file was added.
<?php | |||||
use Illuminate\Database\Migrations\Migration; | |||||
use Illuminate\Database\Schema\Blueprint; | |||||
use Illuminate\Support\Facades\Schema; | |||||
class CreateOauthAccessTokensTable extends Migration | |||||
{ | |||||
/** | |||||
* The database schema. | |||||
* | |||||
* @var \Illuminate\Database\Schema\Builder | |||||
*/ | |||||
protected $schema; | |||||
/** | |||||
* Create a new migration instance. | |||||
* | |||||
* @return void | |||||
*/ | |||||
public function __construct() | |||||
{ | |||||
$this->schema = Schema::connection($this->getConnection()); | |||||
} | |||||
/** | |||||
* Run the migrations. | |||||
* | |||||
* @return void | |||||
*/ | |||||
public function up() | |||||
{ | |||||
$this->schema->create('oauth_access_tokens', function (Blueprint $table) { | |||||
$table->string('id', 100)->primary(); | |||||
$table->unsignedBigInteger('user_id')->nullable()->index(); | |||||
$table->unsignedBigInteger('client_id'); | |||||
$table->string('name')->nullable(); | |||||
$table->text('scopes')->nullable(); | |||||
$table->boolean('revoked'); | |||||
$table->timestamps(); | |||||
$table->dateTime('expires_at')->nullable(); | |||||
}); | |||||
} | |||||
/** | |||||
* Reverse the migrations. | |||||
* | |||||
* @return void | |||||
*/ | |||||
public function down() | |||||
{ | |||||
$this->schema->dropIfExists('oauth_access_tokens'); | |||||
} | |||||
/** | |||||
* Get the migration connection name. | |||||
* | |||||
* @return string|null | |||||
*/ | |||||
public function getConnection() | |||||
{ | |||||
return config('passport.storage.database.connection'); | |||||
} | |||||
} |