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

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)

相关推荐

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

    2024-07-12 15:40:05       23 阅读
  2. 使用virsh migrate进行虚拟机迁移

    2024-07-12 15:40:05       54 阅读
  3. 使用Ora2Pg迁移oracle数据到openGauss

    2024-07-12 15:40:05       38 阅读
  4. 笔记:Entity Framework Core 数据库迁移add-migration

    2024-07-12 15:40:05       26 阅读
  5. 使用ora2pg迁移mysql到KADB

    2024-07-12 15:40:05       38 阅读

最近更新

  1. docker php8.1+nginx base 镜像 dockerfile 配置

    2024-07-12 15:40:05       67 阅读
  2. Could not load dynamic library ‘cudart64_100.dll‘

    2024-07-12 15:40:05       72 阅读
  3. 在Django里面运行非项目文件

    2024-07-12 15:40:05       58 阅读
  4. Python语言-面向对象

    2024-07-12 15:40:05       69 阅读

热门阅读

  1. C#,开发过程中技术点GPT问答记录

    2024-07-12 15:40:05       19 阅读
  2. 学生管理系统(残缺版)

    2024-07-12 15:40:05       22 阅读
  3. IPython多核并行编程指南:并发任务处理

    2024-07-12 15:40:05       22 阅读
  4. 【LeetCode】快乐数

    2024-07-12 15:40:05       21 阅读
  5. 数据分析如何正确地学习与使用

    2024-07-12 15:40:05       21 阅读
  6. MySQL 常用功能

    2024-07-12 15:40:05       25 阅读
  7. keep-alive缓存组件

    2024-07-12 15:40:05       19 阅读