Error de migracion en Laravel
Publicado por Adrian (1 intervención) el 07/10/2019 15:14:27
Estoy intentando migrar la siguiente tabla:
Pero al tipear 'php artisan migrate', me salta el siguiente error (Ya estoy trabajando con Laravel hace tiempo y es la primera vez que veo este error):
Illuminate\Database\QueryException : SQLSTATE[42000]: Syntax error or access violation: 1075 Incorrect table definition; there can be only one auto column and it must be defined as a key (SQL: create table `userprofiles` (`id` bigint unsigned not null auto_increment primary key, `uid` int null auto_increment primary key, `firstname` varchar(50) null, `lastname` varchar(50) null, `age` int null auto_increment primary key, `birthdate` date null, `description` varchar(1000) null, `gender` varchar(45) null, `career` varchar(100) null, `career_grade` varchar(45) null, `created_at` timestamp null, `updated_at`
timestamp null) default character set utf8mb4 collate 'utf8mb4_unicode_ci')
Se los agradecería me ayudaran, no se en queé me estoy equivocando.
1
2
3
4
5
6
7
8
9
10
11
12
13
Schema::create('userprofiles', function (Blueprint $table) {
$table->bigIncrements('id');
$table->bigInteger('uid',10)->nullable();
$table->string('firstname',50)->nullable();
$table->string('lastname',50)->nullable();
$table->integer('age',2)->nullable();
$table->date('birthdate')->nullable();
$table->string('description',1000)->nullable();
$table->string('gender',45)->nullable();
$table->string('career',100)->nullable();
$table->string('career_grade',45)->nullable();
$table->timestamps();
});
Pero al tipear 'php artisan migrate', me salta el siguiente error (Ya estoy trabajando con Laravel hace tiempo y es la primera vez que veo este error):
Illuminate\Database\QueryException : SQLSTATE[42000]: Syntax error or access violation: 1075 Incorrect table definition; there can be only one auto column and it must be defined as a key (SQL: create table `userprofiles` (`id` bigint unsigned not null auto_increment primary key, `uid` int null auto_increment primary key, `firstname` varchar(50) null, `lastname` varchar(50) null, `age` int null auto_increment primary key, `birthdate` date null, `description` varchar(1000) null, `gender` varchar(45) null, `career` varchar(100) null, `career_grade` varchar(45) null, `created_at` timestamp null, `updated_at`
timestamp null) default character set utf8mb4 collate 'utf8mb4_unicode_ci')
Se los agradecería me ayudaran, no se en queé me estoy equivocando.
Valora esta pregunta


0