Add api stuff
This commit is contained in:
@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateApiKeysTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('api_keys', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->string('name');
|
||||
$table->string('key', 64);
|
||||
$table->boolean('active')->default(1);
|
||||
$table->timestamps();
|
||||
$table->softDeletes();
|
||||
$table->index('name');
|
||||
$table->index('key');
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('api_keys');
|
||||
}
|
||||
}
|
@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateApiKeyAccessEventsTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('api_key_access_events', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->unsignedInteger('api_key_id');
|
||||
$table->ipAddress('ip_address');
|
||||
$table->text('url');
|
||||
$table->timestamps();
|
||||
$table->index('ip_address');
|
||||
$table->foreign('api_key_id')->references('id')->on('api_keys');
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('api_key_access_events');
|
||||
}
|
||||
}
|
@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateApiKeyAdminEventsTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('api_key_admin_events', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->unsignedInteger('api_key_id');
|
||||
$table->ipAddress('ip_address');
|
||||
$table->string('event');
|
||||
$table->timestamps();
|
||||
$table->index('ip_address');
|
||||
$table->index('event');
|
||||
$table->foreign('api_key_id')->references('id')->on('api_keys');
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('api_key_admin_events');
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user