2017-02-10 22:29:10 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
use Illuminate\Support\Facades\Schema;
|
|
|
|
use Illuminate\Database\Schema\Blueprint;
|
|
|
|
use Illuminate\Database\Migrations\Migration;
|
|
|
|
|
|
|
|
class UpdateAPIKeyColumnNames extends Migration
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Run the migrations.
|
|
|
|
*/
|
2022-11-25 20:29:04 +00:00
|
|
|
public function up(): void
|
2017-02-10 22:29:10 +00:00
|
|
|
{
|
|
|
|
Schema::table('api_keys', function (Blueprint $table) {
|
2022-11-25 20:29:04 +00:00
|
|
|
$table->dropForeign(['user']);
|
2017-02-10 22:29:10 +00:00
|
|
|
|
|
|
|
$table->renameColumn('user', 'user_id');
|
|
|
|
$table->foreign('user_id')->references('id')->on('users');
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Reverse the migrations.
|
|
|
|
*/
|
2022-11-25 20:29:04 +00:00
|
|
|
public function down(): void
|
2017-02-10 22:29:10 +00:00
|
|
|
{
|
|
|
|
Schema::table('api_keys', function (Blueprint $table) {
|
2022-11-25 20:29:04 +00:00
|
|
|
$table->dropForeign(['user_id']);
|
2017-02-10 22:29:10 +00:00
|
|
|
|
|
|
|
$table->renameColumn('user_id', 'user');
|
|
|
|
$table->foreign('user')->references('id')->on('users');
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|