git - Load more than one database for a single project
问题描述
Does anyone know if there a way I can have more than one db associated with a single Ddev project?
I'm working on a version-controlled project which uses Ddev as the hosting environment. I want to run an upgrade on a CMS in my project and have created a new branch for the purpose and would like to create a separate database for the upgrade too so that when I switch between branches it switches database too.
But it seems that Ddev only allows one db to be linked to a project at one time.
This Github issue suggests creating a separate Ddev project for each Git branch but because everything in my repos also gets deployed to branches on the server, they'd end up with Ddev config files that they don't need, so I'd like to avoid that.
解决方案
你打赌,ddev import-db
接受一个--target-db
参数,所以你可以ddev import-db --src=/path/to/import.sql.gz --target-db=myseconddb
,它会自动创建一个名为“myseconddb”的新数据库。
这也包含在“我可以使用其他数据库”下的ddev 常见问题解答中。
在DDEV-本地数据库管理一文中,还全面讨论了管理数据库的所有方法
推荐阅读
- excel - Excel 排序和过滤中断公式
- java - Android Studio“尚未附加片段”
- javascript - 当我选择文件上传时,react-native-webview 在 Android 上崩溃
- java - 尝试访问已加载实体的集合时发生 LazyInitializationException
- sql - 简化相关嵌套子查询
- reactjs - 使当您单击块内的项目时,会出现另一个块(每个块都有自己的)
- c++ - VSCode 语法错误突出显示不适用于 C++ 代码
- docker - Docker 容器构建失败:“exec:\”flask\”:$PATH 中找不到可执行文件”:未知
- xml - 使用 XSLT 将 XML 拆分为多个文件的问题
- c - 在返回布尔值的方法中循环