mirror of
				https://github.com/pelican-dev/panel.git
				synced 2025-11-04 12:26:53 +01:00 
			
		
		
		
	* Just skip this table because it no longer exists * Add postgresql * This no longer needs to be there * These are the same output in mysql, but different in postgresql * Fix these migrations for postgresql * This table no longer exists * This is expected to be a json column for json operations, required for postgresql * Shoot for the stars * Fix pint * Why was this missing * Updates * Restore this * This needs to be explicit * Don’t like strings * Fix these classes * Use different method to compare dates * Apparently postgresql doesn’t like case insensitivity * Postgresql orders it backwards * Ordered different by postgresql * Unnecessary and breaking * Make sure the order is correct for postresql * Fix this with the order too * Remove this * Force email to be lowercased * Update app/Models/User.php
		
			
				
	
	
		
			77 lines
		
	
	
		
			3.1 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			77 lines
		
	
	
		
			3.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('servers', function (Blueprint $table) {
 | 
						|
            $table->dropForeign(['node']);
 | 
						|
            $table->dropForeign(['owner']);
 | 
						|
            $table->dropForeign(['allocation']);
 | 
						|
            $table->dropForeign(['service']);
 | 
						|
            $table->dropForeign(['option']);
 | 
						|
            $table->dropForeign(['pack']);
 | 
						|
 | 
						|
            if (!in_array(Schema::getConnection()->getDriverName(), ['sqlite', 'pgsql'])) {
 | 
						|
                $table->dropIndex('servers_node_foreign');
 | 
						|
                $table->dropIndex('servers_owner_foreign');
 | 
						|
                $table->dropIndex('servers_allocation_foreign');
 | 
						|
                $table->dropIndex('servers_service_foreign');
 | 
						|
                $table->dropIndex('servers_option_foreign');
 | 
						|
                $table->dropIndex('servers_pack_foreign');
 | 
						|
            }
 | 
						|
 | 
						|
            $table->renameColumn('node', 'node_id');
 | 
						|
            $table->renameColumn('owner', 'owner_id');
 | 
						|
            $table->renameColumn('allocation', 'allocation_id');
 | 
						|
            $table->renameColumn('service', 'service_id');
 | 
						|
            $table->renameColumn('option', 'option_id');
 | 
						|
            $table->renameColumn('pack', 'pack_id');
 | 
						|
 | 
						|
            $table->foreign('node_id')->references('id')->on('nodes');
 | 
						|
            $table->foreign('owner_id')->references('id')->on('users');
 | 
						|
            $table->foreign('allocation_id')->references('id')->on('allocations');
 | 
						|
            $table->foreign('service_id')->references('id')->on('services');
 | 
						|
            $table->foreign('option_id')->references('id')->on('service_options');
 | 
						|
 | 
						|
            // Pack ID was forgotten until multiple releases later, therefore it is
 | 
						|
            // contained in '2017_03_18_204953_AddForeignKeyToPacks'
 | 
						|
        });
 | 
						|
    }
 | 
						|
 | 
						|
    /**
 | 
						|
     * Reverse the migrations.
 | 
						|
     */
 | 
						|
    public function down(): void
 | 
						|
    {
 | 
						|
        Schema::table('servers', function (Blueprint $table) {
 | 
						|
            $table->dropForeign(['node_id']);
 | 
						|
            $table->dropForeign(['owner_id']);
 | 
						|
            $table->dropForeign(['allocation_id']);
 | 
						|
            $table->dropForeign(['service_id']);
 | 
						|
            $table->dropForeign(['option_id']);
 | 
						|
 | 
						|
            $table->renameColumn('node_id', 'node');
 | 
						|
            $table->renameColumn('owner_id', 'owner');
 | 
						|
            $table->renameColumn('allocation_id', 'allocation');
 | 
						|
            $table->renameColumn('service_id', 'service');
 | 
						|
            $table->renameColumn('option_id', 'option');
 | 
						|
            $table->renameColumn('pack_id', 'pack');
 | 
						|
 | 
						|
            $table->foreign('node')->references('id')->on('nodes');
 | 
						|
            $table->foreign('owner')->references('id')->on('users');
 | 
						|
            $table->foreign('allocation')->references('id')->on('allocations');
 | 
						|
            $table->foreign('service')->references('id')->on('services');
 | 
						|
            $table->foreign('option')->references('id')->on('service_options');
 | 
						|
            $table->foreign('pack')->references('id')->on('service_packs');
 | 
						|
        });
 | 
						|
    }
 | 
						|
};
 |