2017-02-10 17:29:10 -05:00
|
|
|
<?php
|
|
|
|
|
|
2026-10-05 18:10:18 -04:00
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
2017-02-10 17:29:10 -05:00
|
|
|
use Illuminate\Database\Migrations\Migration;
|
2026-10-05 18:10:18 -04:00
|
|
|
use Illuminate\Database\Schema\Blueprint;
|
|
|
|
|
use Illuminate\Support\Facades\Schema;
|
2017-02-10 17:29:10 -05:00
|
|
|
|
|
|
|
|
class UpdateAPIKeyColumnNames extends Migration
|
|
|
|
|
{
|
|
|
|
|
/**
|
|
|
|
|
* Run the migrations.
|
|
|
|
|
*/
|
2024-10-21 19:18:20 -06:00
|
|
|
public function up(): void
|
2017-02-10 17:29:10 -05:00
|
|
|
{
|
2026-10-05 18:10:18 -04:00
|
|
|
Schema::table('api_keys', function (Blueprint $table): void {
|
2024-10-21 19:18:20 -06:00
|
|
|
$table->dropForeign(['user']);
|
2017-02-10 17:29:10 -05:00
|
|
|
|
|
|
|
|
$table->renameColumn('user', 'user_id');
|
|
|
|
|
$table->foreign('user_id')->references('id')->on('users');
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Reverse the migrations.
|
|
|
|
|
*/
|
2024-10-21 19:18:20 -06:00
|
|
|
public function down(): void
|
2017-02-10 17:29:10 -05:00
|
|
|
{
|
2026-10-05 18:10:18 -04:00
|
|
|
Schema::table('api_keys', function (Blueprint $table): void {
|
2024-10-21 19:18:20 -06:00
|
|
|
$table->dropForeign(['user_id']);
|
2017-02-10 17:29:10 -05:00
|
|
|
|
|
|
|
|
$table->renameColumn('user_id', 'user');
|
|
|
|
|
$table->foreign('user')->references('id')->on('users');
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|