You are here

asset.install in Asset 6

Same filename and directory in other branches
  1. 5.2 asset.install
  2. 5 asset.install
  3. 7 asset.install

File

asset.install
View source
<?php

/**
 * Implementation of hook_install()
 */
function asset_install() {
  drupal_install_schema('asset');
  drupal_set_message(t('Asset tables have been configured.'));
  if (module_exists('content')) {
    content_notify('install', 'asset');
  }
}

/**
 * Implementation of hook_uninstall()
 */
function asset_uninstall() {
  drupal_uninstall_schema('asset');
  if (module_exists('content')) {
    content_notify('uninstall', 'asset');
  }
}

/**
 * Implementation of hook_schema()
 */
function asset_schema() {
  $schema = array();
  $schema['asset'] = array(
    'fields' => array(
      'aid' => array(
        'type' => 'serial',
        'unsigned' => true,
        'not null' => true,
      ),
      'type' => array(
        'type' => 'varchar',
        'length' => 32,
        'not null' => true,
      ),
      'dirname' => array(
        'type' => 'varchar',
        'length' => 128,
        'not null' => true,
      ),
      'extension' => array(
        'type' => 'varchar',
        'length' => 128,
        'not null' => true,
      ),
      'filename' => array(
        'type' => 'varchar',
        'length' => 255,
        'not null' => true,
      ),
      'filesize' => array(
        'type' => 'int',
        'unsigned' => true,
        'not null' => true,
      ),
      'uid' => array(
        'type' => 'int',
        'unsigned' => true,
        'not null' => true,
      ),
      'status' => array(
        'type' => 'int',
        'size' => 'tiny',
        'unsigned' => true,
        'not null' => true,
      ),
      'author' => array(
        'type' => 'varchar',
        'length' => 128,
        'not null' => true,
      ),
      'title' => array(
        'type' => 'varchar',
        'length' => 128,
        'not null' => true,
      ),
      'description' => array(
        'type' => 'text',
        'not null' => true,
      ),
    ),
    'primary key' => array(
      'aid',
    ),
    'indexes' => array(
      'uid' => array(
        'uid',
      ),
    ),
  );
  $schema['asset_node'] = array(
    'fields' => array(
      'anid' => array(
        'type' => 'serial',
        'unsigned' => true,
        'not null' => true,
      ),
      'aid' => array(
        'type' => 'int',
        'unsigned' => true,
        'not null' => true,
      ),
      'nid' => array(
        'type' => 'int',
        'unsigned' => true,
        'not null' => true,
      ),
      'refs' => array(
        'type' => 'int',
        'unsigned' => true,
        'not null' => true,
      ),
    ),
    'primary key' => array(
      'anid',
    ),
    'unique keys' => array(
      'aid' => array(
        'aid',
        'nid',
      ),
    ),
    'indexes' => array(
      'nid' => array(
        'nid',
      ),
    ),
  );
  $schema['asset_role'] = array(
    'fields' => array(
      'arid' => array(
        'type' => 'serial',
        'unsigned' => true,
        'not null' => true,
      ),
      'aid' => array(
        'type' => 'int',
        'unsigned' => true,
        'not null' => true,
      ),
      'rid' => array(
        'type' => 'int',
        'unsigned' => true,
        'not null' => true,
      ),
      'status' => array(
        'type' => 'int',
        'size' => 'tiny',
        'unsigned' => true,
        'not null' => true,
      ),
    ),
    'primary key' => array(
      'arid',
    ),
    'unique keys' => array(
      'aid' => array(
        'aid',
        'rid',
      ),
    ),
    'indexes' => array(
      'arid' => array(
        'arid',
      ),
    ),
  );
  return $schema;
}

Functions

Namesort descending Description
asset_install Implementation of hook_install()
asset_schema Implementation of hook_schema()
asset_uninstall Implementation of hook_uninstall()