Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

db:structure:dump broken by 8a5a9dc

#21

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.

Reported by Kyle Hargraves · April 19th, 2008 @ 06:16 AM

State: resolved
Milestone: 2.1.1
Assigned to: Rick Rick
Importance: none

Activity

  1. Michael Koziarski
  2. Steven Soroka
    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.

    April 23rd, 2008 @ 05:27 PM

  3. Kyle Hargraves
    Kyle Hargraves

    Yep, deleting it restored functionality for me, too, tho I forgot to come back and mention that at some point.

    April 23rd, 2008 @ 07:20 PM

  4. Rick
    Rick
    • Milestone set to 2.1.1

    April 30th, 2008 @ 08:50 PM

  5. Steven Soroka
  6. Jordi Bunster
    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.

    May 1st, 2008 @ 04:41 PM

  7. Kyle Hargraves
    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.

    May 1st, 2008 @ 04:51 PM

  8. Jordi Bunster
    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.

    May 1st, 2008 @ 04:56 PM

  9. Steven Soroka
    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.

    May 1st, 2008 @ 05:01 PM

  10. Michael Koziarski
    Michael Koziarski

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

    May 4th, 2008 @ 01:12 AM

  11. Kyle Hargraves
    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.

    May 4th, 2008 @ 07:52 AM

  12. Jordi Bunster
    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!

    May 4th, 2008 @ 03:18 PM

  13. Rick
    Rick
    • State changed from new to resolved

    Cool, rake db:structure:dump works. Merged into rails/master. Thanks everyone.

    May 6th, 2008 @ 07:49 AM