2

我正在尝试使用 'taps' gem ( https://github.com/ricardochimal/taps ) 将 SQLite3 数据库迁移到 PostgreSQL 数据库,如在新的 Rails 项目中从 SQLite 更改为 PostgreSQLhttp:/中所述/railscasts.com/episodes/342-migrating-to-postgresql

我有一台 Windows 7 机器,在 c:\Sites\MySite 中有一个 Rails 应用程序,在 c:\Sites\MySite\db\development.sqlite3 中有数据库

每当我尝试启动 Taps 服务器时,都会出现以下异常:

C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/sequel-3.20.0/lib/sequel/adapters/sqlite.rb:62:in `initialize': SQLite3::CantOpenException: 无法打开数据库文件(Sequel::DatabaseConnectionError)

这是我尝试过的(在以管理员权限运行命令提示符时都尝试过):

rem From C:\Sites\MySite:
taps server sqlite://db/development.sqlite3 eo secret
taps server sqlite:///db/development.sqlite3 eo secret
taps server sqlite://c:/sites/mysite/db/development.sqlite3 eo secret
taps server sqlite:///c:/sites/mysite/db/development.sqlite3 eo secret
rem From C:\Sites\MySite\db:
taps server sqlite://development.sqlite3 eo secret
taps server sqlite:///development.sqlite3 eo secret

以上都没有奏效。Taps gem 的文档没有被证明是有用的。这样做的正确方法是什么?

4

1 回答 1

3

The error indicates the file couldn't be opened, but at least a couple of the connection strings you provided should work.

You could try doing the following from C:\Sites\MySite (uses Sequel directly, not taps):

sequel -C sqlite://db/development.sqlite3 postgres://user:pass@host/database
于 2013-05-10T19:19:42.173 回答