Vorrei migrare una tabella con gli elementi seguenti.Laravel 5.0, migrazione: come rendere intero non una chiave primaria?
public function up() {
Schema::create('users', function(Blueprint $table) {
$table->increments('id');
$table->integer('LoginID', 9)->unsigned();
$table->string('username');
$table->string('email')->unique();
$table->string('password', 60)->unique();
$table->rememberToken();
$table->timestamps();
});
}
Tuttavia, ho continuato a gestire l'errore di seguito. Qualcuno sa come fare integer "non LoginID una chiave primaria in modo che possa migrare tabella sottostante? Qualche consiglio apprezzato. Grazie in anticipo.
[Illuminate\Database\QueryException]
SQLSTATE[HY000]: General error: 1 table "users" has more than one primary key (SQL: create table "users" ("id" integer not null primary key autoincrement, "LoginID" integer not null primary key autoincrement, "username" varchar not null, "email" varchar not null, "password" varchar not null, "remember_token" varchar null, "created_at" date time not null, "updated_at" datetime not null))
qualcosa è fuori. Non c'è nulla nella migrazione che hai mostrato che possa far sì che LoginID sia una chiave primaria a incremento automatico. – patricus
Non so la causa, ma ha funzionato poche ore dopo. – ILoveBaymax