Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MySQL Time is not resolved in YAML #7

Open
anrichter opened this issue Mar 11, 2012 · 2 comments
Open

MySQL Time is not resolved in YAML #7

anrichter opened this issue Mar 11, 2012 · 2 comments

Comments

@anrichter
Copy link

The generated .yml files doesn't contain the right values for time fields in a mysql database. For example the created_at and updated_at fields.

Here is a part from a yml file:
updated_at: !ruby/object:Mysql::Time {}

ActiveRecord::Base.connection.select_all generate an array with hashes. The value for the time fields in the hashes is a Mysql::Time instead of an string. I think YAML.dump can't convert an instance from Mysql::Time into a string.

It would be nice, if you can fix this bug.

@mattconnolly
Copy link
Owner

Thanks for reporting this bug. It seems that mysql time objects really don't play nice with yaml in ruby 1.9.3 and appear as empty objects {}.

Can you try add this to your gem file:

gem 'rails-backup-migrate', :git => "git://github.com/mattconnolly/rails-backup-migrate.git", :branch => "7-mysql-times"

and then bundle exec rake site:backup and bundle exec rake site:restore and let me know if it works.

This might slow it down if you have a large data set. But more important for it to work.

@anrichter
Copy link
Author

Ok. Thanks for the fix. It worked like a charm :)

mattconnolly added a commit that referenced this issue Mar 22, 2012
Updating version to 0.0.11, including fixes from issue #7.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants