/ / Migration von sqlite3 zu postgresql auf Rails 3? - Datenbank, Ruby-on-Schienen-3, SQLite, Postgresql

Migration von sqlite3 zu postgresql auf Rails 3? - Datenbank, Ruby-On-Rails-3, SQLite, Postgresql

Nach dem Beitrag: Migrieren von SQLite nach PostgreSQL (Rails)

ich renne sqlite3 development.sqlite3 .dump | psql mypgdb mypguser In meiner Rails-App wird dieser Fehler angezeigt (dies gilt für alle Modelle / Tabellen in meiner App):

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...

Würde mich über einige Anregungen freuen. Vielen Dank!

Antworten:

2 für die Antwort № 1

Das ist keine gültige SQL für PostgreSQL SERIAL anstelle von INTEGER AUTOINCREMENT. Du möchtest vielleicht Stellen Sie den nächsten Wert manuell ein von dieser Folge zu max (id) +1 auch.

Dann wollen Sie sich mit allen anderen Unterschieden zwischen einem meist typlosen sqlite und einem strengen PostgreSQL auseinandersetzen.

Dann möchten Sie in Ihrer Entwicklungsumgebung und in der Bereitstellung keine anderen Systeme mehr verwenden.


0 für die Antwort № 2

Ich empfehle Ihnen zu verwenden gem "yaml_db"ist der Zweck, Tabellen von einer Datenbank in eine andere zu verschieben. https://github.com/ludicast/yaml_db#readme

Sie können alles mit diesem Schmuckstück mit einer schönen Dokumentation erledigen. Es hat 2 grundlegende Befehle, also nichts Schwieriges.