0

I'm trying to migrate from Sqlite to Postgres with gem 'yaml_db'. On my locale development everything goes fine. But when I tried to do the same on production server I see the error: PG::InvalidParameterValue: ERROR: new encoding (UTF8) is incompatible with the encoding of the template database (SQL_ASCII)

What should I do to keep my data and move it from one DB to another?

database.yml

on the locale computer

default: &default
  adapter: sqlite3
  pool: 5
  timeout: 5000

development:
  <<: *default
  database: db/development.sqlite3

on the server

production:
  adapter: sqlite3
  database: db/production.sqlite3

But the file has UTF-8 encoding:

$ file -i data.yml
data.yml: text/plain; charset=utf-8
nobilik
  • 736
  • 9
  • 29
  • is it possible that you didn't initialized you pg database with the right encoding? – devanand Feb 09 '16 at 09:13
  • I do it for first time in my life, so everything maybe) I'd install it step-by-step like it written [here](http://stackoverflow.com/questions/11092807/installing-postgresql-on-ubuntu-for-ruby-on-rails) – nobilik Feb 09 '16 at 09:18
  • 1
    try running this command `psql -U USER DATABASE -c 'SHOW SERVER_ENCODING'`. replace USER and DATABASE – devanand Feb 09 '16 at 09:30
  • db doesn't exists. thanks, your comment helps me. it happens because I was looking in two guides at the same time. Migration is done. – nobilik Feb 09 '16 at 10:21
  • then you should close the question as well :) – devanand Feb 09 '16 at 11:53
  • @devanand do you mean, that I should answer my own question? or what? – nobilik Feb 09 '16 at 11:56
  • yes, in a way you should mark the question as answered. but i don't know how to do :) – devanand Feb 09 '16 at 16:25
  • @devanand I think it'll be very stupid to post thi like an answer. If you don't mind I'll just delete it. – nobilik Feb 09 '16 at 16:29

0 Answers0