Tell me more ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

Trying to convert my MYSQL db to postgreSQL so it will play nicely with heroku. I installed the gem mysql2psql and run it. When I run it, I get...

mysql2psql
Creating table breads...
Created table breads
Creating table sammiches...
Created table sammiches
Creating table schema_migrations...
Created table schema_migrations
Counting rows of breads... 
Rows counted
Loading breads...

33 rows loaded in 0min 0s
Counting rows of sammiches... 
Rows counted
Loading sammiches...

161 rows loaded in 0min 0s
Counting rows of schema_migrations... 
Rows counted
Loading schema_migrations...

4 rows loaded in 0min 0s
Indexing table breads...
Indexed table breads
Indexing table sammiches...
Indexed table sammiches
Indexing table schema_migrations...
Indexed table schema_migrations
Table creation 0 min, loading 0 min, indexing 0 min, total 0 min

if I am in pg:psql I can run queries and I know that the columns imported correctly to the table, but there are no entries...

I tried-

heroku rake db:migrate
WARNING: `heroku rake` has been deprecated. Please use `heroku run rake` instead.
Running `rake db:migrate` attached to terminal... up, run.6669
DEPRECATION WARNING: You have Rails 2.3-style plugins in vendor/plugins! Support for these plugins will be removed in Rails 4.0. Move them out and bundle them in your Gemfile, or fold them in to your app as lib/myplugin/* and config/initializers/myplugin.rb. See the release notes for more on this: http://weblog.rubyonrails.org/2012/1/4/rails-3-2-0-rc2-has-been-released. (called from <top (required)> at /app/Rakefile:7)
DEPRECATION WARNING: You have Rails 2.3-style plugins in vendor/plugins! Support for these plugins will be removed in Rails 4.0. Move them out and bundle them in your Gemfile, or fold them in to your app as lib/myplugin/* and config/initializers/myplugin.rb. See the release notes for more on this: http://weblog.rubyonrails.org/2012/1/4/rails-3-2-0-rc2-has-been-released. (called from <top (required)> at /app/Rakefile:7)
Connecting to database specified by DATABASE_URL
Migrating to CreateSammiches (20130428211616)

But it is still empty. Empty likeeeee

dbl77pdgmr9l10=> select * from sammiches;                                                                                                                        id | name | image | country | description | created_at | updated_at 
----+------+-------+---------+-------------+------------+------------
(0 rows)

dbl77pdgmr9l10=> 

Any ideas? Thanks!

mysql2psql file-

mysql:
 hostname: localhost
 port: 3306
 socket: /tmp/mysql.sock
 username: root
 password: ####
 database: sandwich_development

destination:
 # if file is given, output goes to file, else postgres
 file: 
 postgres:
  hostname: localhost
  port: 5432
  username: root
  password: 
  database: pgmysql_db

# if tables is given, only the listed tables will be converted.  leave empty to convert all tables.
#tables:
#- table1
#- table2
# if exclude_tables is given, exclude the listed tables from the conversion.
#exclude_tables:
#- table3
#- table4


# if supress_data is true, only the schema definition will be exported/migrated, and not the data
supress_data: false

# if supress_ddl is true, only the data will be exported/imported, and not the schema
supress_ddl: false

# if force_truncate is true, forces a table truncate before table loading
force_truncate: false
share|improve this question
If you know the data structure, what is to stop you writing your own convertor? – Daniel Casserly yesterday

1 Answer

up vote 1 down vote accepted

Check your database.yaml configuration

suppress_data: true

Might be not moving data, only schema

share|improve this answer
Hmm, it is set to false. Thanks! – DynastySS yesterday
I added the mysqlpsql yml file. – DynastySS yesterday
try dumping to file to see if insert statements for existing data are present, rather than straight to postgres – mconlin yesterday
Hmm, the file dump has all the information. I am wondering if it is an issue with the formatting of the content? Like one of my entries looks like 135 Smörgåstårta //upload.wikimedia.org/wikipedia/en/thumb/a/a7/Sm%C3%B6rg%C3%A5‌​st%C3%A5rta.jpg/120px-Sm%C3%B6rg%C3%A5st%C3%A5rta.jpg Sweden Multiple layers of white or light rye bread containing creamy fillings, such as egg and mayonnaise, liver paté, olives, shrimp, ham, various cold cuts, caviar, tomato, cucumber, cheese and smoked salmon 2013-05-09 22:11:37 2013-05-09 22:11:37 – DynastySS yesterday
now try running those dump files into mysql from command line and see if you get any errors? – mconlin yesterday
show 1 more comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.