vendredi 15 mai 2020

Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server

I want to migrate this file:


use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class ModifySubdomainsAndDomains extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up() {
        Schema::table('vornam', function (Blueprint $table) {
//            $table->unsignedInteger('ticket_id')->nullable();

            $table->unsignedInteger('lastname')->change();
        });
        Schema::table('domains', function (Blueprint $table) {
            $table->dropColumn('expire_at');
        });
        }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down() {
        Schema::table('vorname', function (Blueprint $table) {
//            $table->dropColumn('ticket_id');

            $table->string('lastname')->change();
        });
        Schema::table('names', function (Blueprint $table) {
            $table->timestamp('expire_at');
        });
    }
}

but if I run php artisan migrate, Im getting this errors:

SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error i n your SQL syntax; check the manual that corresponds to your MySQL server v ersion for the right syntax to use near 'CHARACTER SET utf8 NOT NULL COLLAT E utf8_unicode_ci' at line 1 (SQL: ALTER TABLE subdomains CHANGE domain d omain BIGINT UNSIGNED CHARACTER SET utf8 NOT NULL COLLATE utf8_unicode_ci )

SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error i n your SQL syntax; check the manual that corresponds to your MySQL server v ersion for the right syntax to use near 'CHARACTER SET utf8 NOT NULL COLLAT E utf8_unicode_ci' at line 1

SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error i n your SQL syntax; check the manual that corresponds to your MySQL server v ersion for the right syntax to use near 'CHARACTER SET utf8 NOT NULL COLLAT E utf8_unicode_ci' at line 1

But If I remove the line, everything is working...

            $table->unsignedInteger('names')->change();

I'm using 5.8.37 Can someone help me that I can use unsignedInteger or find another solution?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire