【发布时间】:2021-06-19 02:42:28
【问题描述】:
我有以下 laravel 迁移 up 方法
public function up()
{
Schema::create('users', function (Blueprint $table) {
$table->id();
$table->string('name');
$table->string('email')->unique();
$table->string('mobile')->unique();
$table->timestamp('email_verified_at')->nullable();
$table->string('password');
// $table->string('sports');
$table->date('dob');
$table->string('height');
$table->rememberToken();
$table->timestamps();
});
DB::statement('ALTER TABLE users ADD COLUMN sports TYPE text[] AFTER password');
}
当我运行迁移时,它会显示 SQLSTATE[42601]: Syntax error: 7 ERROR: syntax error at or near "text" LINE 1: ALTER TABLE users ADD COLUMN sports TYPE text[] AFTER passwo ... ^ (SQL: ALTER TABLE users ADD COLUMN sports TYPE text[] AFTER password)。不知道有什么问题?
【问题讨论】:
标签: laravel postgresql laravel-migrations