【发布时间】:2017-10-13 05:33:46
【问题描述】:
[Illuminate\Database\QueryException]
SQLSTATE[42000]: Syntax error or access violation: 1075 Incorrect table def
inition; there can be only one auto column and it must be defined as a key
(SQL: create table `students` (`id` int unsigned not null auto_increment pr
imary key, `student_id` int unsigned not null auto_increment primary key, `
stuent_name` varchar(50) not null, `student_email` varchar(50) not null, `s
tudent_username` varchar(50) not null, `student_phone` varchar(50) not null
, `student_photo` text not null, `student_sex` varchar(191) not null, `stud
ent_status` varchar(191) not null, `created_at` timestamp null, `updated_at
` timestamp null) default character set utf8mb4 collate utf8mb4_unicode_ci)
我不知道发生了什么,这个问题是在我尝试迁移时发生的
【问题讨论】:
-
发布您的架构定义
-
php 工匠迁移
-
不是这样,在你的 `App\database\migrations` 中发布代码的架构定义
-
Schema::create('students', function (Blueprint $table) { $table->increments('id'); $table->increments('student_id'); $table-> string('student_name', 50); $table->string('student_email',50); $table->string('student_username',50); $table->string('student_phone',50); $table ->text('student_photo'); $table->string('student_sex'); $table->string('student_status'); $table->timestamps();
标签: php database laravel-5 migration