You are here

uptolike.install in Uptolike share buttons 7

Install and uninstall functions for Uptolike module.

File

uptolike.install
View source
<?php

/**
 * @file
 * Install and uninstall functions for Uptolike module.
 */

/**
 * Implements hook_schema().
 */
function uptolike_schema() {
  $schema['uptolike_preset'] = array(
    'description' => 'Table storing Uptolike presets definitions.',
    'export' => array(
      'key' => 'name',
      'key name' => 'Name',
      'primary key' => 'pid',
      // Exports will be defined as $uptolike.
      'identifier' => 'uptolike',
      // Function hook name.
      'default hook' => 'default_uptolike_preset',
      'api' => array(
        'owner' => 'uptolike',
        // Base name for api include files.
        'api' => 'default_uptolike_presets',
        'minimum_version' => 1,
        'current_version' => 1,
      ),
    ),
    'fields' => array(
      'name' => array(
        'type' => 'varchar',
        'length' => '255',
        'description' => 'Unique ID for presets. Used to identify them programmatically.',
      ),
      'pid' => array(
        'type' => 'serial',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'description' => 'Primary ID field for the table. Not used for anything except internal lookups.',
        // Do not export database-only keys.
        'no export' => TRUE,
      ),
      'admin_title' => array(
        'type' => 'varchar',
        'length' => '255',
        'description' => 'A human readable name of a preset.',
      ),
      'code' => array(
        'type' => 'text',
        'size' => 'big',
        'description' => 'Uptolike exportable configuration code.',
      ),
      'json' => array(
        'type' => 'text',
        'size' => 'big',
        'description' => 'Uptolike exportable configuration json.',
      ),
    ),
    'primary key' => array(
      'pid',
    ),
    'unique keys' => array(
      'name' => array(
        'name',
      ),
    ),
  );
  return $schema;
}

/**
 * Implements hook_uninstall().
 */
function uptolike_uninstall() {

  // Delete module variables.
  db_delete('variable')
    ->condition('name', 'uptolike_%', 'LIKE')
    ->execute();
}

Functions

Namesort descending Description
uptolike_schema Implements hook_schema().
uptolike_uninstall Implements hook_uninstall().