You are here

function eck_update_7001 in Entity Construction Kit (ECK) 7.3

Same name and namespace in other branches
  1. 7 eck.install \eck_update_7001()
  2. 7.2 eck.install \eck_update_7001()

Update 7001.

File

./eck.install, line 216
ECK's requirements, schemas, and logic for install and uninstall.

Code

function eck_update_7001() {

  // For importing and exporting things it is always good to have a uuid, so we
  // will add that colunm to the current entity types.
  // Now we add a type (bundle) to the table for each entity in the eck table.
  $results = db_select('eck', 't')
    ->fields('t')
    ->execute();
  foreach ($results as $record) {

    // Also we want to add a field to all the enity tables for the type, and
    // populated with the current type.
    db_add_field("eck_{$record->name}", 'uuid', array(
      'type' => 'char',
      'length' => 36,
      'not null' => TRUE,
      'default' => '',
      'description' => 'The Universally Unique Identifier.',
    ));
  }
}