Closed (duplicate)
Project:
Drupal core
Version:
7.x-dev
Component:
database system
Priority:
Critical
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
9 Aug 2007 at 04:43 UTC
Updated:
16 May 2008 at 01:58 UTC
We now have this nice primary key in the blocks table; block_roles should reference it, rather than the old crusty module/delta combo.
I filed under 6, as this seems like a clear over-sight, but in case it's too major to fix there, please re-file against 7.
Comments
Comment #1
chx commentedthere is no DB change now. But I agree this must be fixed in D7 hence the critical.
Comment #2
marcingy commentedsubscribe
Comment #3
cburschkaUpdating the title. This typo confused the hell out of me when trying to grep for the mysteriously non-existant table.
For further information, here are the current references to {blocks_roles} in HEAD.
Comment #4
moshe weitzman commentedSimilarly, when we configure asingle block we should load/save referencing bid, not module+delta
Comment #5
pwolanin commented@webchick - are you sure? I think this proposed change is wrong. Note that the you can have multiple themes where a single block is active, but bid will only link to a block within a SINGLE theme.
Comment #6
webchickUpon further inspection, I think pwolanin is right, and I have no idea why bid is even there to begin with? Why do we need a unique id for a block/theme/region correlation?
Comment #7
Crell commentedEvery table needs a primary key; If for no other reason than various database management tools break if you don't. :-) However, that doesn't mean it has to be a surrogate key (bid). If module/delta/theme provides a suitably unique value, then the bid is extraneous.
Comment #8
pwolanin commentedwe added the new UNIQUE key here: http://cvs.drupal.org/viewvc.py/drupal/drupal/modules/block/block.instal...
I guess we could have removed bid then by making that the PRIMARY key? I don't remember whether that was on the table, or it just seemed an extra fight to remove bid too (given that I think that patch went in pretty late)
Comment #9
neclimdulMy gut is telling me varchar keys are expensive. That might just be superstitious, but I'd like to see how it affects things.
the becoming tied to a theme thing is also interesting...
Comment #10
pwolanin commented@neclimdul - this is not a large table, so I don't think it will really be an issue - we already use varchar PRIMARY for a couple tables (e.g. menu_router)
Comment #11
dropcube commentedI thinks that something similar to the proposed here would be OK: http://drupal.org/node/257032#comment-843364
Getting rid of the block deltas and use instead unique blocks' ID for each block and for the primary key of the blocks table is worth considering. Each module should provide blocks with unique names, in accordance with Drupal namespace rules (i.e. MODULE_block_id). Then the relation bid, theme, region is stored in a separate blocks_regions table.
Comment #12
pwolanin commented@dropcube - no, I think there is no reason to have bid at all. If each block has a unique name, then you should use that as the primary key.
Comment #13
dropcube commented@pwolanin: I agree, with bid I meant a block unique ID, which is in fact the block_name.
I am setting the status to duplicate to continue the discussion of the block system and block database schema refactoring at http://drupal.org/node/257032