如何从 SQLite 迁移到 PostgreSQL (Rails)

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/4248072/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-20 00:24:08  来源:igfitidea点击:

How to migrate from SQLite to PostgreSQL (Rails)

ruby-on-railssqlitepostgresqlherokudatabase-migration

提问by Leonardo Dario Perna

I'm a DB noob so please be kind with me.

我是 DB noob,所以请善待我。

I'm having some issues pushing my SQLite DB to Heroku via taps gem. Talking with them, they told me one of the solutions could be converting locally my DB from SQLite to PostgreSQL. Is there an easy way to do so?

我在通过 taps gem 将我的 SQLite 数据库推送到 Heroku 时遇到了一些问题。与他们交谈后,他们告诉我其中一种解决方案可能是将我的数据库从 SQLite 本地转换为 PostgreSQL。有没有简单的方法来做到这一点?

Thanks

谢谢

More info: - DB from Rails app - I'm on Mac OS X - Just installed PostgreSQL via macports

更多信息: - 来自 Rails 应用程序的数据库 - 我在 Mac OS X 上 - 刚刚通过 macports 安装了 PostgreSQL

回答by jxpx777

sqlite3 development.db .dump | psql dbname username

sqlite3 development.db .dump | psql dbname username

回答by Mikhail Chuprynski

Sequelwill help you

续集会帮助你

gem install sequel

sequel -C sqlite://db/development.sqlite3 postgres://username:password@localhost/dbname