Mik*_*ski 3 ruby sqlite postgresql ruby-on-rails
我有一个 Rails 应用程序,最初使用 SQLite3 创建。现在我需要将它与所有数据一起移动到 PostgreSQL。
我尝试按照“如何从 SQLite 迁移到 PostgreSQL (Rails) ”中的建议使用:
sqlite3 development.db .dump | psql dbname username
Run Code Online (Sandbox Code Playgroud)
就我而言,它是:
sqlite3 development.sqlite3 .dump | psql dev_db deployer
Run Code Online (Sandbox Code Playgroud)
我得到了这个:
ERROR: syntax error at or near "PRAGMA"
LINE 1: PRAGMA foreign_keys=OFF;
^
BEGIN
ERROR: syntax error at or near "AUTOINCREMENT"
LINE 1: CREATE TABLE "people" ("id" INTEGER PRIMARY KEY AUTOINCREMEN...
Run Code Online (Sandbox Code Playgroud)
那些只是 SQL 实现的差异吗?我该如何解决这个问题?
感谢@theTinMan
gem install sequel
sequel -C sqlite://db/development.sqlite3 postgres://user:password@localhost/dbname
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
3998 次 |
| 最近记录: |