简体   繁体   English

Adonis JS 5 模型不同连接

[英]Adonis JS 5 Model Different Connection

I use AdonisJS v5 and I use multiple databases in my service.我使用 AdonisJS v5,并且在我的服务中使用了多个数据库。 Can I set the connection on the model, without Database.manager?我可以在没有 Database.manager 的情况下在模型上设置连接吗?

I don't think you can.我不认为你可以。 You have to define your connections in the database config file and then define the connection in the model您必须在数据库配置文件中定义连接,然后在模型中定义连接

 public static connection = 'DB_USERS'

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM