【发布时间】:2019-09-16 18:59:54
【问题描述】:
迁移文件
$table->increments('id');
$table->foreign('user_id')->references('id')->on('users');
$table->foreign('band_id')->references('id')->on('bands');
$table->foreign('genre_id')->references('id')->on('genres');
$table->foreign('cate_id')->references('id')->on('cates');
$table->foreign('type_id')->references('id')->on('types');
$table->integer('status');
$table->date('date');
$table->time('time');
$table->decimal('price');
$table->tinyIncrements('instrument');
$table->string('instrument_detail',255);
$table->timestamps();
运行 php artisan migrate 后
SQLSTATE[42000]:语法错误或访问冲突:1075 不正确 表定义;只能有一个自动列,并且必须是 定义为键 (SQL: create table
bookings(idint unsigned not null auto_increment 主键,statusint not null,date日期不为空,time时间不为空,price十进制(8, 2) 不为空,instrumenttinyint unsigned not null auto_increment 主键,instrument_detailvarchar(255) 不为空,created_at时间戳 null,updated_attimestamp null) 默认字符集 utf8mb4 整理 utf8mb4_unicode_ci)
下面是这个
SQLSTATE[42000]:语法错误或访问冲突:1075 不正确 表定义;只能有一个自动列,并且必须是 定义为键
【问题讨论】:
标签: php laravel artisan-migrate