You are here

module_builder.install in Module Builder 6

Same filename and directory in other branches
  1. 8.3 module_builder.install

File

module_builder.install
View source
<?php

/**
 * Implementation of hook_install().
 */
function module_builder_install() {

  // Create tables.
  drupal_install_schema('module_builder');
  drupal_set_message('Module builder installed');
}

/**
 * Implementation of hook_uninstall().
 */
function module_builder_uninstall() {

  // Remove tables.
  drupal_uninstall_schema('module_builder');
}
function module_builder_schema() {
  $schema['module_builder_basic'] = array(
    'description' => t('Stores data having to do with modules.'),
    'fields' => array(
      'mid' => array(
        'type' => 'serial',
        'description' => t('The id of the module.'),
        'not null' => TRUE,
      ),
      'name' => array(
        'type' => 'varchar',
        'length' => '255',
        'default' => '',
        'not null' => TRUE,
        'description' => t('The name of the module.'),
      ),
    ),
    'primary key' => array(
      'mid',
    ),
  );
  $schema['module_builder_data'] = array(
    'description' => t('Stores data having to do with modules built with the module builder.'),
    'fields' => array(
      'mid' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
        'description' => t('The module this data is attached to.'),
      ),
      'type' => array(
        'type' => 'varchar',
        'length' => '64',
        'default' => '',
        'not null' => TRUE,
        'description' => t('The type, such as "node" or "comment" or "menu".'),
      ),
      'data' => array(
        'type' => 'blob',
        'description' => t('The data'),
        'serialize' => TRUE,
      ),
    ),
    'indexes' => array(
      'data' => array(
        'mid',
        'type',
      ),
    ),
  );
  return $schema;
}

Functions