启动/停止每个项目的 postgres

问题描述 投票:0回答:1

我有几个使用不同版本的 Postgres 的项目。我们使用 asdf 插件 来配置它们。每次我转移到不同的项目时都必须启动和停止 Postgres,这很烦人。有什么方法可以自动化这个吗?我正在考虑将其添加到我们的开发中

Procfile
,但是由于
pg_ctl
进程在启动服务器后立即退出,因此
foreman
也会退出。

postgresql foreman procfile
1个回答
0
投票

我当前的解决方案是添加一个别名,在运行之前启动数据库

foreman
并在运行后关闭它。它并不完美,因为这意味着我需要启动服务器才能运行测试:

alias fsd="pg_ctl start && foreman start -f Procfile.dev; pg_ctl stop"
© www.soinside.com 2019 - 2024. All rights reserved.