Answer a question

I am trying to migrate a SQLite3 database to a PostgreSQL database using the 'taps' gem ( https://github.com/ricardochimal/taps ), as described in Change from SQLite to PostgreSQL in a fresh Rails project and in http://railscasts.com/episodes/342-migrating-to-postgresql

I have a Windows 7 machine, have a Rails app in c:\Sites\MySite, and the database in c:\Sites\MySite\db\development.sqlite3

Whenever I try to start the taps server, I get this exception:

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: unable to open database file (Sequel::DatabaseConnectionError)

Here's what I tried (all tried while running the command prompt with Administrator privileges):

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

None of the above worked. Documentation for the taps gem did not prove helpful. What is the correct way of doing this?

Answers

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
Logo

PostgreSQL社区为您提供最前沿的新闻资讯和知识内容

更多推荐