学无先后,达者为师

网站首页 编程语言 正文

golang使用migrate迁移pg数据库表报错处理

作者:大鱼天 更新时间: 2024-07-15 编程语言
migrate -database postgres://greenlight:xxxxxx@localhost:55433/greenlight?sslmode=disable  -path ./migrations/  up

报错信息:

error: pq: permission denied for schema public in line 0: CREATE TABLE IF NOT EXISTS "public"."schema_migrations" (version bigint not null primary key, dirty boolean not null)

处理办法

使用postgres用户登录数据库,执行下面命令:

grant all privileges on database greenlight to greenlight

alter database greenlight owner to greenlight

然后重新执行上面migrate命令,成功执行:

1/u create_movies_table (19.429ms)
2/u add_movies_check_constraints (30.8229ms)

原文链接:https://blog.csdn.net/kfeng632/article/details/140371073

  • 上一篇:没有了
  • 下一篇:没有了
栏目分类
最近更新