mirror of
				https://github.com/pelican-dev/panel.git
				synced 2025-10-31 17:06:52 +01:00 
			
		
		
		
	
		
			
				
	
	
		
			41 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			41 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
| <?php
 | |
| 
 | |
| use Illuminate\Support\Facades\Schema;
 | |
| use Illuminate\Database\Schema\Blueprint;
 | |
| use Illuminate\Database\Migrations\Migration;
 | |
| 
 | |
| return new class extends Migration
 | |
| {
 | |
|     /**
 | |
|      * Run the migrations.
 | |
|      */
 | |
|     public function up(): void
 | |
|     {
 | |
|         Schema::table('api_keys', function (Blueprint $table) {
 | |
|             if (Schema::getConnection()->getDriverName() !== 'sqlite') {
 | |
|                 $table->dropForeign('api_keys_user_foreign');
 | |
|                 $table->dropIndex('api_keys_user_foreign');
 | |
|             }
 | |
| 
 | |
|             $table->renameColumn('user', 'user_id');
 | |
|             $table->foreign('user_id')->references('id')->on('users');
 | |
|         });
 | |
|     }
 | |
| 
 | |
|     /**
 | |
|      * Reverse the migrations.
 | |
|      */
 | |
|     public function down(): void
 | |
|     {
 | |
|         Schema::table('api_keys', function (Blueprint $table) {
 | |
|             if (Schema::getConnection()->getDriverName() !== 'sqlite') {
 | |
|                 $table->dropForeign('api_keys_user_id_foreign');
 | |
|                 $table->dropIndex('api_keys_user_id_foreign');
 | |
|             }
 | |
| 
 | |
|             $table->renameColumn('user_id', 'user');
 | |
|             $table->foreign('user')->references('id')->on('users');
 | |
|         });
 | |
|     }
 | |
| };
 | 
