You are here

pathauto_persist.install in Pathauto Persistent State 6

Same filename and directory in other branches
  1. 7 pathauto_persist.install

File

pathauto_persist.install
View source
<?php

/**
 * Implements hook_schema().
 */
function pathauto_persist_schema() {
  $schema['pathauto_persist'] = array(
    'description' => '',
    'fields' => array(
      'entity_type' => array(
        'type' => 'varchar',
        'length' => 32,
        'not null' => TRUE,
        'description' => 'An entity type.',
      ),
      'entity_id' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'description' => 'An entity ID.',
      ),
      'pathauto' => array(
        'type' => 'int',
        'size' => 'tiny',
        'not null' => TRUE,
        'default' => 0,
        'description' => 'The automatic alias status of the entity.',
      ),
    ),
    'primary key' => array(
      'entity_type',
      'entity_id',
    ),
  );
  return $schema;
}

/**
 * Implements hook_install().
 */
function pathauto_persist_install() {
  drupal_install_schema('pathauto_persist');
}

/**
 * Implements hook_uninstall().
 */
function pathauto_persist_uninstall() {
  drupal_uninstall_schema('pathauto_persist');
}

/**
 * Reduce the entity_type column to 32 characters.
 */
function pathauto_persist_update_6000() {
  $ret = array();
  db_drop_primary_key($ret, 'pathauto_persist');
  db_change_field($ret, 'pathauto_persist', 'entity_type', 'entity_type', array(
    'type' => 'varchar',
    'length' => 32,
    'not null' => TRUE,
  ));
  db_add_primary_key($ret, 'pathauto_persist', array(
    'entity_type',
    'entity_id',
  ));
  return $ret;
}

Functions

Namesort descending Description
pathauto_persist_install Implements hook_install().
pathauto_persist_schema Implements hook_schema().
pathauto_persist_uninstall Implements hook_uninstall().
pathauto_persist_update_6000 Reduce the entity_type column to 32 characters.