Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

nafeeur10's avatar

SQLSTATE[70100]: \Unknown error>>: 1317 Query execution was interrupted

I am trying to execute this query but giving me this error: I will change a column from not unique to Unique. partner_id is a foreign key. N:B: I am working in Laravel 5.3

class ChangePartnerToPartnerFinancialInformationsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::table('partner_financial_informations', function (Blueprint $table) {
            DB::statement('ALTER TABLE `partner_financial_informations` CHANGE `partner_id` `partner_id` INTEGER UNSIGNED UNIQUE;');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::table('partner_financial_informations', function (Blueprint $table) {
            DB::statement('ALTER TABLE `partner_financial_informations` CHANGE `partner_id` `partner_id` INTEGER UNSIGNED NOT NULL;');
        });
    }
}

Full Error:

  [Illuminate\Database\QueryException]                                                                                                                                                   
  SQLSTATE[70100]: \Unknown error>>: 1317 Query execution was interrupted (SQL: ALTER TABLE `partner_financial_informations` CHANGE `partner_id` `partner_id` INTEGER UNSIGNED UNIQUE;)  
                                        
  [PDOException]                                                           
  SQLSTATE[70100]: \Unknown error>>: 1317 Query execution was interrupted
0 likes
3 replies
Sinnbeck's avatar

Are you running a very old mysql version? Can you try upgrading?

Nakov's avatar
Nakov
Best Answer
Level 73

You don't need to wrap a statement within a Schema.

This

Schema::table('partner_financial_informations', function (Blueprint $table) {
	DB::statement('ALTER TABLE `partner_financial_informations` CHANGE `partner_id` `partner_id` INTEGER UNSIGNED UNIQUE;');
});

can be just

DB::statement('ALTER TABLE `partner_financial_informations` CHANGE `partner_id` `partner_id` INTEGER UNSIGNED UNIQUE;');

but you can consider using Laravel only: https://laravel.com/docs/9.x/migrations#prerequisites

this maybe:

Schema::table('partner_financial_informations', function (Blueprint $table) {
	$table->foreignId('partner_id')->unique()->change();
});
1 like
jlrdw's avatar

If partner_financial_informations is a child table, wouldn't partner_id have many child records?

Please or to participate in this conversation.