This project is archived and is in readonly mode.

#21 ✓resolved
Kyle Hargraves

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

    Michael Koziarski April 21st, 2008 @ 12:43 AM

    • Assigned user set to “Rick”
  • Steven Soroka

    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

    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

    Rick April 30th, 2008 @ 08:50 PM

    • Milestone set to 2.1.1
  • Steven Soroka
  • Jordi Bunster

    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

    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

    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

    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

    Michael Koziarski May 4th, 2008 @ 01:12 AM

    So has Steven's attached patch fixed the issue for you guys?

  • Kyle Hargraves

    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

    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

    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.

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>

People watching this ticket

Referenced by

Pages