From GeeklogWiki
Jump to: navigation, search

Geeklog 2 has redesigned many of the look-up tables that exist in the 1.3.x codebase (e.g. commentcode, commentmodes, cookiecodes, etc. The main reason for this is that most of the look-up tables simply don't justify the need for their own table structure. Second, the only way to changs those look-up tables was to issue SQL direct to the database (i.e. there was no administration screen). In Geeklog 2, there is a single table, gl2_list_item, that holds all look-up lists. Each list is identified by a group name so, for example, one set of list items might be identified by the name STATES and within that list you'd have a listing of the 50 states in the U.S. Another set of list items might have be named COMMENTMODE and would have 'nested', 'flat' and 'threaded' as options.

Some DBA purists might argue this design since we will have a ton of foreign keys (a concept that GL 1.3.x, specifically MySQL didn't support) against this table. While that is true, that in and of itself is not a bad thing and the upside is we have an administration screen that let's Geeklog 2 Administrators manage their sets of list items.

Management list items won't happen very much in production environment. In fact, the only time it is really feasible to change list items is during the development process. Once code has been written that depends on those list items being there, it will be quite easy for administrators to render their Geeklog 2 installation useless. That being said, we will probably not include access to the screen by default. This will be achieved by simply removing the entry for that view from the MVCnPHP configuration file.

The organization of the List Item table is quite simple:

  1. List Item ID - This is the primary key and is used for all foreign key references
  2. group_name - This is the identifier for the list item group. You'll notice we denormalized this as there was no need to take the performance penalty with doing a join to table that would hold the list item groups separately....especially considering that this table will be read a lot
  3. short_name - This is the short name that is often used via the code. For example, continuing with the STATES example, one short name might be 'IA' for Iowa.
  4. description - This is a description field for the list item. In the STATES example, this value might be 'Iowa' (see short name above)
  5. enabled - This is a flag that indicates if whether or not the list item is enabled or not. When disabled, a list item would cease to appear within Geeklog 2
  6. sort order - Not always used but this field allows each of the entries within a list item group to be given a sort order which is then used when displaying them within Geeklog 2

Hopefully this is straightforward enough to understand. Anyone wanting to help with Geeklog 2 development will need to understand this and Geeklog 2 administrators need to at least understand how this works so that they know the impact it might have when changes are made.