misc_pterodactyl-panel/database/migrations/2017_02_10_171858_UpdateAPIKeyColumnNames.php

35 lines
854 B
PHP
Raw Normal View History

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.
*/
public function up(): void
2017-02-10 22:29:10 +00:00
{
Schema::table('api_keys', function (Blueprint $table) {
$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.
*/
public function down(): void
2017-02-10 22:29:10 +00:00
{
Schema::table('api_keys', function (Blueprint $table) {
$table->dropForeign(['user_id']);
2017-02-10 22:29:10 +00:00
$table->renameColumn('user_id', 'user');
$table->foreign('user')->references('id')->on('users');
});
}
}