db:structure:dump broken by 8a5a9dc
Reported by Kyle Hargraves | April 19th, 2008 @ 06:16 AM | in 2.1.1
Commit 8a5a9dc to active_record/connection_adapters/abstract/schema_statements.rb removed the method dump_schema_information, which is called in the db:structure:dump task. This prevents db:test:clone_structure, which depends on it, from running successfully.
I'm not familiar enough with the new UTC migrations / schema_migrations structure to feel comfortable trying to fix this.
Comments and changes to this ticket
-
Michael Koziarski April 21st, 2008 @ 12:43 AM
- → Assigned user changed from to rick
-
Steven Soroka April 23rd, 2008 @ 05:27 PM
Looks like this isn't necessary anymore. I removed the lines:
if ActiveRecord::Base.connection.supports_migrations?
File.open("db/#{RAILS_ENV}_structure.sql", "a") { |f| f << ActiveRecord::Base.connection.dump_schema_information }
end
and it works for me. It doesn't look like anything else needs to be dumped from what I can see.
I could try to make a patch for it.
-

Kyle Hargraves April 23rd, 2008 @ 07:20 PM
Yep, deleting it restored functionality for me, too, tho I forgot to come back and mention that at some point.
-
rick April 30th, 2008 @ 08:50 PM
- → Milestone changed from to 2.1.1
-
-
Jordi Bunster May 1st, 2008 @ 04:41 PM
Kyle Hargraves / Steven Soroka: Are you using migrations, and is your schema dump format set to SQL?
If so, I think I might know what the problem is. Removing those lines will "fix" it, but you will not be able to run migrations on a database created using db:structure:dump.
I'll take a look at fixing it after hearing from you guys. The fix is rather trivial, but I'd like to make sure I understand the problem first.
-

Kyle Hargraves May 1st, 2008 @ 04:51 PM
Jordi: Yes, I am using migrations, and the dump format is SQL. It did not occur to me to worry about whether migrations would continue to run after removing those lines, as the only use-case I have for db:structure:dump is as a dependency for db:test:clone_structure.
-
Jordi Bunster May 1st, 2008 @ 04:56 PM
Ok, cool. The bad news is that the removal of those lines is not an acceptable fix.
The good news is that the fix is trivial. I'll take a look at it as soon as I can, understanding the urgency of 2.1.
-
Steven Soroka May 1st, 2008 @ 05:01 PM
My schema dump format is sql, and i'm using migrations.
I also noticed there's no db:structure:load to match the db:schema:load, which could make db:reset work regardless of ruby or sql schema types.
-
Michael Koziarski May 4th, 2008 @ 01:12 AM
So has Steven's attached patch fixed the issue for you guys?
-

Kyle Hargraves May 4th, 2008 @ 07:52 AM
Steven's patch was sufficient to fix db:test:clone_structure, the only thing I use db:structure:dump for, but Jordi is right that it would produce databases that could not (easily) be migrated further.
Attached is a patch which restores the dump_schema_information method, updated to support the timestamped migrations.
-
Jordi Bunster May 4th, 2008 @ 03:18 PM
It's Sunday morning, and you sit down to work on Rails patches ... but then you see someone else has done the work for you. Life is good.
Thanks Kyle!
-
rick May 6th, 2008 @ 07:49 AM
- → State changed from new to resolved
Cool, rake db:structure:dump works. Merged into rails/master. Thanks everyone.
Please Login or create a free account to add a new comment.
You can update this ticket by sending an email to from your email client. (help)
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
Source available from github
The Git repository resides at http://github.com/rails
Check out the current development trunk (Edge Rails) with:
git clone git://github.com/rails/rails.git
Creating or reviewing a patch
See the contributor guide.
Creating a feature request
Please don't. If you want a new feature in Rails, you'll have to pull up your sleeves and get busy yourself. Or convince someone else to do it. See the contributor guide on how to get going. But posting them here is just going to lead to ticket root.
Creating a bug report
When creating a bug report, be sure to include as much relevant information as possible. Post the code sample that causes the problem. Preferably, alter the unit tests and show through either changed or added tests how the expected behavior is not occuring.
Security vulnerabilities should be reported via an email to security@rubyonrails.org, do not use trac for reporting security vulnerabilities. All content in trac is publicly available as soon as it is posted.
Then don't get your hopes up. Unless you have a "Code Red, Mission Critical, The World is Coming to an End" kinda bug, you're creating this ticket in the hope that others with the same problem will be able to collaborate with you on solving it. Do not expect that the ticket automatically will see any activity or that others will jump to fix it. Creating a ticket like this is mostly to help yourself start on the path of fixing the problem and for others to sign on to with a "I'm having this problem too".
