This project is archived and is in readonly mode.
db:structure:dump broken by 8a5a9dc
-
Michael Koziarski
- Assigned user set to Rick
-
Steven Soroka
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
Yep, deleting it restored functionality for me, too, tho I forgot to come back and mention that at some point.
-
Rick
- Milestone set to 2.1.1
-
Steven Soroka
Here's a patch. Hopefully this makes it in to 2.1 :)
-
Jordi Bunster
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
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
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
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
So has Steven's attached patch fixed the issue for you guys?
-
Kyle Hargraves
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
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
- State changed from new to resolved
Cool, rake db:structure:dump works. Merged into rails/master. Thanks everyone.
