You are here

function styles_schema in Styles 7

Same name and namespace in other branches
  1. 6.2 styles.install \styles_schema()
  2. 6 styles.install \styles_schema()
  3. 7.2 styles.install \styles_schema()

Implement hook_schema().

File

./styles.install, line 23
Install, update and uninstall functions for the Styles module.

Code

function styles_schema() {
  $schema = array();
  $schema['cache_styles'] = drupal_get_schema_unprocessed('system', 'cache');
  $schema['cache_styles']['description'] = 'Cache table used to store information display manipulations that are in-progress.';
  $schema['styles'] = array(
    'description' => 'Stores configuration options for styles.',
    'fields' => array(
      'sid' => array(
        'description' => 'The primary identifier for a style.',
        'type' => 'serial',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
      'name' => array(
        'description' => 'The style name.',
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
      ),
    ),
    'primary key' => array(
      'sid',
    ),
    'indexes' => array(
      'name' => array(
        'name',
      ),
    ),
  );
  $schema['style_effects'] = array(
    'description' => 'Stores configuration options for style effects.',
    'fields' => array(
      'seid' => array(
        'description' => 'The primary identifier for a style effect.',
        'type' => 'serial',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
      'sid' => array(
        'description' => 'The {styles}.sid for a style.',
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ),
      'weight' => array(
        'description' => 'The weight of the effect in the style.',
        'type' => 'int',
        'unsigned' => FALSE,
        'not null' => TRUE,
        'default' => 0,
      ),
      'name' => array(
        'description' => 'The unique name of the effect to be executed.',
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
      ),
      'data' => array(
        'description' => 'The configuration data for the effect.',
        'type' => 'text',
        'not null' => TRUE,
        'size' => 'big',
        'serialize' => TRUE,
      ),
    ),
    'primary key' => array(
      'seid',
    ),
    'indexes' => array(
      'sid' => array(
        'sid',
      ),
      'weight' => array(
        'weight',
      ),
    ),
    'foreign keys' => array(
      'sid' => array(
        'styles' => 'sid',
      ),
    ),
  );
  return $schema;
}