1
我的代码是在这里,当我尝试使用laravel
public function up()
{
Schema::create('semesters', function (Blueprint $table) {
// $table->increments('id');
$table->engine = 'InnoDB';
$table->string('semester_id')->unique()->unsigned();
$table->timestamps();
});
}
错误添加主键的数据类型为字符串错误发生在这里
[照亮\数据库\ QueryException] SQLSTATE [ 42000]:语法错误 或访问冲突:1064您的SQL语法中有错误;检查 对应于您MariaDB的服务器版本的 正确的语法使用手动接近“无符号不为空,
created_at
倍夯实 默认0不为空,updated_at
时报”在1号线(SQL:CREATE TABLEsemesters
(semester_id
文本签名不为空,created_at
时间戳默认0不为空,updated_at
时间戳默认0不 空)默认字符S等UTF8整理utf8_unicode_ci发动机= InnoDB的)
你不混合型? 'string' VS'unsigned'? ();}无符号();' 到 – Alex
我想要字符串数据类型到我的主键 –
所以删除' - >无符号();'部分然后 – Alex