You are here

function patterns_schema in Patterns 7.2

Same name and namespace in other branches
  1. 6.2 patterns.install \patterns_schema()
  2. 6 patterns.install \patterns_schema()
  3. 7 patterns.install \patterns_schema()

Implements hook_schema().

File

./patterns.install, line 34

Code

function patterns_schema() {
  $schema['patterns'] = array(
    'description' => 'Stores patterns information.',
    'fields' => array(
      'pid' => array(
        'type' => 'serial',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'description' => 'Primary Key: Unique pattern ID.',
      ),
      'name' => array(
        'type' => 'varchar',
        'length' => 55,
        'default' => '',
        'description' => 'Machine readable name of this pattern.',
      ),
      'format' => array(
        'type' => 'varchar',
        'length' => 10,
        'default' => '',
        'description' => 'Format of the patterns (XML, YAML, etc.).',
      ),
      /*
       * STATUSES:
       *
       *    0: installed, not enabled
       *    1: installed, enabled
       *
       *    -1: invalid
       *    -5: removed
       */
      'status' => array(
        'type' => 'int',
        'size' => 'tiny',
        'not null' => TRUE,
        'default' => 0,
        'description' => 'Boolean indicating whether the pattern has been executed (enabled).',
      ),
      'public' => array(
        'type' => 'int',
        'size' => 'tiny',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
        'description' => 'Boolean indicating whether the pattern is published (available for sharing via patterns server).',
      ),
      'file' => array(
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'default' => '',
        'description' => 'Path of the pattern file relative to Drupal root.',
      ),
      'updated' => array(
        'type' => 'varchar',
        'length' => 10,
        'not null' => TRUE,
        'default' => '0',
        'description' => 'The Unix timestamp indicating when the pattern file was last time updated (modified).',
      ),
      'enabled' => array(
        'type' => 'varchar',
        'length' => 10,
        'not null' => TRUE,
        'default' => '0',
        'description' => 'The Unix timestamp indicating when the pattern was last time executed.',
      ),
      'title' => array(
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'default' => '',
        'description' => 'Title of the pattern.',
      ),
      'description' => array(
        'type' => 'text',
        'not null' => TRUE,
        'description' => 'Description of the pattern.',
      ),
      'pattern' => array(
        'type' => 'text',
        'size' => 'medium',
        'not null' => TRUE,
        'description' => 'A serialized array containing pattern code.',
      ),
      'uuuid' => array(
        'type' => 'varchar',
        'length' => 50,
        'default' => '',
        'description' => 'Identify patterns and their parent',
      ),
      'author' => array(
        'type' => 'varchar',
        'length' => 20,
        'default' => '',
        'description' => 'pattern\'s author',
      ),
    ),
    'primary key' => array(
      'pid',
    ),
    'unique keys' => array(
      'name' => array(
        'name',
      ),
    ),
  );
  return $schema;
}