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.

[patch] SchemaDumper works bad with table_prefix

#2751

When setting ActiveRecord::Base.table_name_prefix or table_name_suffix, Rails will dump all tables found in the database (except schema_migrations). This is a little dangerous when you do ie. rake db:reset. IMHO, the convention should be to dump only tables with the set prefix and suffix.

Of course, there is ActiveRecord::SchemaDumper.ignore_tables, but it lets you only define a blacklist, which is cumbersome on prefixes. A prefix like 'abc' would need

ActiveRecord::SchemaDumper.ignore_tables = [ /^(?!abc)/ ]
which is advanced regex magic and maybe too complicated for beginners.

Therefore I propose adding ActiveRecord::SchemaDumper.dump_only_with_prefix and -suffix, where you can turn off the new default behaviour.

This also fixes a small bug, where the table name 'schema_migrations' is hard coded instead of being used through ActiveRecord::Migrator.schema_migrations_table_name.

Reported by Christoph Petschnig · June 3rd, 2009 @ 02:30 PM

State: stale
Milestone: 3.x
Assigned to: nobody
Importance: none

Activity

  1. Jeremy Kemper
    Jeremy Kemper
    • Milestone changed from 2.x to 3.x

    May 4th, 2010 @ 06:48 PM

  2. Rohit Arondekar
    Rohit Arondekar
    • State changed from new to stale
    • Importance changed from to

    Marking ticket as stale. If this is still an issue please leave a comment with suggested changes, creating a patch with tests, rebasing an existing patch or just confirming the issue on a latest release or master/branches.

    October 9th, 2010 @ 04:04 AM