1

投稿に続いて: SQLite から PostgreSQL (Rails) に移行する方法

sqlite3 development.sqlite3 .dump | psql mypgdb mypguserRails アプリで実行していますが、このエラーが発生します (アプリ内のすべてのモデル/テーブルで同じです):

ERROR:  current transaction is aborted, commands ignored until end of transaction block
ERROR:  current transaction is aborted, commands ignored until end of transaction block
ERROR:  current transaction is aborted, commands ignored until end of transaction block
ERROR:  current transaction is aborted, commands ignored until end of transaction block
ERROR:  current transaction is aborted, commands ignored until end of transaction block
ERROR:  current transaction is aborted, commands ignored until end of transaction block
ERROR:  current transaction is aborted, commands ignored until end of transaction block
ERROR:  current transaction is aborted, commands ignored until end of transaction block
ERROR:  current transaction is aborted, commands ignored until end of transaction block
ERROR:  current transaction is aborted, commands ignored until end of transaction block
ERROR:  current transaction is aborted, commands ignored until end of transaction block
ERROR:  syntax error at or near "AUTOINCREMENT"
LINE 1: ...E TABLE "projects" ("id" INTEGER PRIMARY KEY AUTOINCREM...

いくつかの提案/修正をいただければ幸いです。ありがとう!

4

2 に答える 2

2

これはPostgreSQLの有効なSQLではありません。INTEGERAUTOINCREMENTの代わりにSERIALが必要になる可能性があります。シーケンスのnextvalを手動でmax(id)+1に設定することもできます。

次に、ほとんどタイプレスのsqliteと厳密なPostgreSQLの間の他のすべての違いに対処する必要があります。

次に、開発セットアップと展開で異なるシステムの使用を停止する必要があります。それはあなた自身に痛みを引き起こしているだけです。

于 2012-07-02T10:23:08.217 に答える
0

を使用することをお勧めしますgem "yaml_db"。その目的は、あるデータベースから別のデータベースにテーブルを移動することです。 https://github.com/ludicast/yaml_db#readme

優れたドキュメントを使用して、このgemだけですべてを実行できます。2つの基本的なコマンドがあるので、難しいことは何もありません。

于 2012-09-15T12:18:16.410 に答える