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.

Module specific table_name_prefix

#4032

The attached patch adds the ability to specify a table_name_prefix on the parent module of namespaced models. This is useful when building engines/plugins for reuse in different applications to help prevent table name conflicts.

There are a few possible areas of contention:

  1. It searches up the parent chain and not just the direct parent - just matching the direct parent may be preferred.
  2. It only takes the first match - combining all of the table name prefixes in the parent chain may be preferred
  3. It ignores the global table name prefix when it finds a module table name prefix - prefixing the module table name prefix with the global table name prefix may be preferred.
  4. The module table name prefix has no effect when the table name is explicitly set. This is the current behaviour of the global table name prefix but there is no test that I can see that explicitly tests this behaviour.

Reported by Andrew White · February 22nd, 2010 @ 11:37 AM

State: committed
Milestone: 2.3.6
Assigned to: Jeremy Kemper Jeremy Kemper
Importance: none

Activity

  1. José Valim
    José Valim
    • Assigned user changed from José Valim to Jeremy Kemper
    • Milestone cleared.

    Assigning to Jeremy Kemper, he's the best person to give feedback on this.

    February 23rd, 2010 @ 07:29 AM

  2. Andrew White
    Andrew White

    Updated patch to apply to latest master - just offsets, no code changes.

    March 15th, 2010 @ 06:17 AM

  3. Repository
    Repository
    • State changed from new to resolved

    March 29th, 2010 @ 07:46 AM

  4. Yehuda Katz (wycats)
    Yehuda Katz (wycats)

    Applied. Would you mind backporting this to 2.3?

    March 29th, 2010 @ 07:46 AM

  5. Jeremy Kemper
    Jeremy Kemper
    • State changed from resolved to open
    • Milestone set to 2.3.6

    March 29th, 2010 @ 07:47 AM

  6. Andrew White
    Andrew White

    Backport to 2.3 patch with the method renamed to full_table_name_prefix

    March 29th, 2010 @ 09:49 AM

  7. Repository
    Repository
    • State changed from open to committed

    (from [03d5d0b5f50161d8ec1b2b627e483aad7100494a]) Add the ability to specify table_name_prefix on individual modules

    [#4032 Module specific table_name_prefix state:committed]

    Signed-off-by: Jeremy Kemper jeremy@bitsweat.net
    http://github.com/rails/rails/commit/03d5d0b5f50161d8ec1b2b627e483a...

    March 29th, 2010 @ 04:57 PM

  8. phs
    phs

    cross linking #4230 [PATCH] AR migration generator includes model's modules in table name. . The question is whether the module-specific stuff in this patch can be harnessed in the model generator.

    April 11th, 2010 @ 12:41 AM