【问题标题】:Why can't i create db with mikro-orm?为什么我不能用 mikro-orm 创建数据库?
【发布时间】:2021-07-03 05:09:44
【问题描述】:

所以我尝试使用 mikro-orm 和 postgresql 在visualstudio 代码中创建b,但出现错误:

createdb lireddit
The name "createdb" is not recognized as the name of a cmdlet, function, script file, or executable program. Check the spelling
name, as well as the presence and correctness of the path, and then try again.
+ createdb <<<<  lireddit
    + CategoryInfo          : ObjectNotFound: (createdb:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

在此之前我用 yarn 安装了 mikro-orm 和 postgresql,但它似乎不起作用。

【问题讨论】:

  • 你在运行什么命令?不会在MikroORM.init() 上自动创建数据库。
  • 我在 powershell 中运行“createdb”,但我不知道,我应该运行 MikroORM.init() 吗?
  • 我的意思是你没有做任何与 MikroORM 相关的事情,你正在尝试使用 pg CLI。也没有与 vscode 相关的内容。帮不上什么忙,我自己从未使用过 PG CLI,但我可以看到这个问题是如何被错误命名的,所以如果问题是关于他们可能从未听说过的工具或他们不使用的编辑器,那么不会吸引多少 PG 专家.
  • 也许是关于powershell? stackoverflow.com/questions/24156451/…

标签: postgresql visual-studio-code mikro-orm


【解决方案1】:

在 mikro-orm 文档中没有提到使用 createdb mikro-orm docs 创建数据库的选项。

您所关注的视频已在他的 bash_profile.sh 中设置了一些脚本或别名,并安装了 PG-CLI 以使用终端在本地执行此操作。

如何以原生方式执行此操作的解决方案: 在终端中运行 createdb 不会创建数据库。 首先从EDB Installer site 安装 postgresql 服务器,它提供了运行 postgresql 服务器的所有工具,以及一个名为 pgAdmin 的客户端来与您的 postgresql 服务器交互。

安装完所有要求后。打开 pgAdmin 并创建数据库,如下图所示。

如果您在通过 mikro-orm 从项目迁移到 postgresql 时遇到问题,请告诉我。我可以帮忙

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2014-06-04
    • 2011-09-16
    • 2011-01-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-08-17
    • 2017-01-28
    相关资源
    最近更新 更多