【发布时间】:2022-01-24 09:13:02
【问题描述】:
朋友们,我在使用 postgres 进行 laravel 迁移时遇到以下问题,当我对迁移进行更改时,在这种情况下是用户表,但是我在尝试从键中删除索引时遇到错误,请你帮帮我遇到这个问题。
这是我的迁移代码:
public function up() {
Schema::create('users', function (Blueprint $table) {
$table->id();
$table->integer('idProfile');
$table->string('name');
$table->string('surname');
$table->string('email')->unique();
$table->string('photo')->nullable();
$table->timestamp('email_verified_at')->nullable();
$table->string('password');
$table->rememberToken();
$table->timestamps();
});
}
public function down() {
Schema::dropIfExists('users');
Schema::table('users', function (Blueprint $table){
$table->dropPrimary('id');
$table->dropIndex('users_pkey');
});
}
从我的控制台响应:
这些是列出我的索引:
这是最终表的结构:
评论,有待改进的地方我都在听
【问题讨论】:
-
永远不要使用图像来显示堆栈溢出中的错误或代码。
标签: laravel postgresql eloquent laravel-8