laravel - Laravel 迁移修饰符 ->after('column') 不起作用
问题描述
为表设置迁移。
Schema::create('users', function (Blueprint $table) {
$table->bigIncrements('id');
$table->string('name');
$table->string('email')->unique();
$table->timestamp('email_verified_at')->nullable();
$table->string('password');
$table->rememberToken();
$table->timestamps();
$table->unsignedBigInteger('created_by')->nullable()->after('created_at');
});
问题在于->after('created_at')
.
Illuminate\Database\QueryException : SQLSTATE[42000]: 语法错误或访问冲突:1064 您的 SQL 语法有错误;检查与您的 MySQL 服务器版本相对应的手册,以
created_at
在第 1 行的默认字符集 utf8mb4 collate 'utf8mb4_unicode_ci'' 附近使用正确的语法(SQL:创建表users
(id
bigint unsigned not null auto_increment 主键,name
varchar(255) not null,email_verified_at
timestamp null,password
varchar(255) not null,remember_token
varchar(100) null,created_at
timestamp null,updated_at
timestamp null,created_by
bigint unsigned null aftercreated_at
) 默认字符集 utf8mb4 collate 'utf8mb4_unicode_ci')]
我正在使用 Laragon 开发平台。
mysql Ver 14.14 Distrib 5.7.24,适用于 Win64 (x86_64)
解决方案
推荐阅读
- r - 从 dplyr 到 base:为变量的每个级别创建第一个和最后一个索引的数据框
- git - 将发布分支合并到 master 后,release 仍然显示为在 master 之前提交了这么多提交
- spring - “对于没有 MD5 摘要元数据的上传 InputStream,markSupported() 方法必须评估为真。” 在 Spring 集成 AWS
- javascript - 如何创建可以在表列中包含键值对的数据库?
- python - 将哈希和文件名添加到列表和字典
- python - 使用 leidenalg 和 igraph 查找簇,然后输出 gml 文件
- node.js - nodeJS typescript的中间件中未定义req.headers
- php - 如何用 smarty 渲染 Html
- docker - 将 Docker 与官方 Progress OpenEdge RDBMS 映像一起使用
- regex - Regex a portion of string with a specific patten