新手问题 Rails 默认使用 PostgreSQL 生成的数据库文件在哪 ?

springwq · September 23, 2014 · Last by springwq replied at September 24, 2014 · 2445 hits

我在 Mac 上用 Postgres.app 安装的 postgresql 数据库。

用 Rails 新建项目的时候,用的默认设置:

rails new depot --database=postgresql

rake db:create db:migrate

现在 rails s 可以正常启动了,http://localhost:3000 可以访问。

但是 我在 depot/db 里面没有看到数据库文件,请问 postgresql 把它的数据库文件放哪了?

取决于 Postgres.app 的设置。

只有 SQLite3 的数据库文件会放在 db 下面…

OSX,我用 homebrew 安装的话,默认是放在了 /usr/local/var/postgres 这个目录里面

Postgres.app 的话,看看这里 ~/Library/Application Support/Postgres

#3 楼 @lgn21st 谢谢 Daniel. 发现里面有好多东东,要读读文档看看都是干嘛的。

You need to Sign in before reply, if you don't have an account, please Sign up first.