You are here

patterns.install in Patterns 6.2

File

patterns.install
View source
<?php

/**
 * Implementation of hook_install().
 */
function patterns_install() {
  drupal_install_schema('patterns');
}

/**
* Implementation of hook_schema().
*/
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.',
      ),
      'status' => array(
        'type' => 'int',
        'size' => 'tiny',
        'unsigned' => TRUE,
        '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',
        'not null' => TRUE,
        'description' => 'A serialized array containing pattern code.',
      ),
    ),
    'primary key' => array(
      'pid',
    ),
    'unique keys' => array(
      'name' => array(
        'name',
      ),
    ),
  );
  return $schema;
}

/**
 * Implementation of hook_uninstall().
 */
function patterns_uninstall() {
  drupal_uninstall_schema('patterns');
}

/**
 * Implementation of hook_update_N().
 */
function patterns_update_6100() {
  $ret = array();

  // Increase size of the field 'pattern'.
  $new_field = array(
    'type' => 'text',
    'size' => 'medium',
    'not null' => TRUE,
    'description' => 'A serialized array containing pattern code.',
  );
  db_change_field($ret, 'patterns', 'pattern', 'pattern', $new_field);
  return $ret;
}

Functions

Namesort descending Description
patterns_install Implementation of hook_install().
patterns_schema Implementation of hook_schema().
patterns_uninstall Implementation of hook_uninstall().
patterns_update_6100 Implementation of hook_update_N().