Gobuffalo错误:“没有定义名为development的连接!”

huangapple go评论92阅读模式
英文:

Gobuffalo error "There is no connection named development defined!"

问题

在我的Go项目中,我安装了gobuffalo:

go get github.com/gobuffalo/pop/...

然后我运行soda migrate,但是我遇到了这个错误There is no connection named development defined!

有人知道我面临的问题是什么吗?

英文:

In my go project I install gobuffalo:

go get github.com/gobuffalo/pop/...

And then I run soda migrate but I got this error There is no connection named development defined!

Does anyone know what problem I am facing with?

答案1

得分: 2

首先,快速回答,下面是解释。

1)删除database.yml文件。
2)使用命令"soda g config"强制soda创建相同的文件。
3)之后,我的"soda migrate"命令停止出现错误并正常工作。(不要忘记在生成的文件的第一部分(development)中放入您的数据库配置详细信息)

详细说明

实际上,我复制了一个旧的工作目录来创建另一个目录。在新的位置上它不起作用。我认为那就是问题所在。如果仍然不起作用,请尝试安装SODA并在新位置上执行上述操作,我也这样做了。
https://gobuffalo.io/documentation/database/soda/
https://gobuffalo.io/documentation/database/configuration/

英文:

First a quick reply, explanation below.

  1. Delete the database.yml file.
  2. Force soda to create the same file with the command "soda g config"
  3. After that my "soda migrate" command stopped giving the error and worked. (Don't forget to put your db cofig details in the generated file in the first section (development) only)

In Detail

Actually I copied an old working directory of Go to create another one. In the new place it was not working. I think that was the problem. If still not working try installing SODA and do the above in the new place, I did that also.
https://gobuffalo.io/documentation/database/soda/
https://gobuffalo.io/documentation/database/configuration/

答案2

得分: 0

对于我来说,我最初将文件命名为database.yaml,将文件名更改为database.yml完全没有问题。

英文:

For me, I named the file database.yaml initially, changing the name of file to database.yml worked just fine.

答案3

得分: 0

请确保您没有安装任何格式化扩展,我最初遇到了相同的问题,后来通过“卸载”prettier解决了问题。

我遵循的步骤:

  • 运行'soda g config'并编辑您的database.yml文件(确保它是'database.yml')
  • 我还创建了一些Fizz迁移'soda generate fizz table_name'
  • 编辑database.yml文件的更改(我默认使用Dbeaver,它通常会要求您将用户设置为'postgres',如果您设置了与'postgres'的连接密码,您可以使用相同的密码)
  • 例如:
    development:
    dialect: postgres
    database: db_name
    user: postgres
    password: ****
    host: 127.0.0.1
    pool: 5
  • 现在您可以使用'soda migrate'或'soda migrate up'(如果您有一些用于创建表的代码)。
    希望这种方法有所帮助 Gobuffalo错误:“没有定义名为development的连接!”
英文:

Please ensure you don't have any formatting extension's available I was initially getting the same issue later resolved by 'uninstalling' prettier.

Steps I followed:

  • 'soda g config' and edit your database.yml (make sure it is 'database.yml')
  • I was also creating some Fizz migrations 'soda generate fizz table_name'
  • Edit changes to the database.yml file (I am using Dbeaver by default it usually asks you to set user as 'postgres' and if you have any password set in order to make connection with 'postgres' you can use that same password in the password)
  • i.e
    development:
    dialect: postgres
    database: db_name
    user: postgres
    password: ****
    host: 127.0.0.1
    pool: 5

    • now you can use 'soda migrate' or 'soda migrate up' in case you have some
      code there for creating a table
      may this approach helps Gobuffalo错误:“没有定义名为development的连接!”

huangapple
  • 本文由 发表于 2022年2月23日 21:10:56
  • 转载请务必保留本文链接:https://go.coder-hub.com/71237568.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定