1

Following the post: How to migrate from SQLite to PostgreSQL (Rails)

I am running sqlite3 development.sqlite3 .dump | psql mypgdb mypguser in my Rails app and I'm getting this error (same for all models/tables in my 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...

Would appreciate some suggestions/fixed. Thanks!

2 Answers 2

2

That's not valid SQL for PostgreSQL - you probably want a SERIAL instead of INTEGER AUTOINCREMENT. You may want to manually set the nextval of thesequence to max(id)+1 too.

Then you'll want to deal with all the other differences between a mostly-typeless sqlite and a strict PostgreSQL.

Then you'll want to stop using different systems on your development setup and in deployment. It's just causing yourself pain.

Sign up to request clarification or add additional context in comments.

Comments

0

I recommand you to use gem "yaml_db", it's purpose is to move tables from one database to another. https://github.com/ludicast/yaml_db#readme

You can get everything done simply by this gem with a nice documentation. It has 2 basic commands so nothing difficult about it.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.