You are here

ad_text.install in Advertisement 6.2

Ad_text module database schema.

Copyright (c) 2005-2009. Jeremy Andrews <jeremy@tag1consulting.com>.

File

text/ad_text.install
View source
<?php

/**
 * @file
 * Ad_text module database schema.
 *
 * Copyright (c) 2005-2009.
 *   Jeremy Andrews <jeremy@tag1consulting.com>.
 */

/**
 * Implementation of hook_schema().
 */
function ad_text_schema() {
  $schema['ad_text'] = array(
    'description' => 'The ad_text table stores sources of text ads.',
    'fields' => array(
      'aid' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ),
      'url' => array(
        'type' => 'varchar',
        'length' => '255',
        'not null' => TRUE,
        'default' => '',
      ),
      'adheader' => array(
        'type' => 'varchar',
        'length' => '255',
        'not null' => TRUE,
        'default' => '',
      ),
      'adbody' => array(
        'type' => 'text',
        'not null' => FALSE,
      ),
    ),
    'primary key' => array(
      'aid',
    ),
  );
  return $schema;
}

/**
 * ad_text module installation.
 */
function ad_text_install() {
  drupal_install_schema('ad_text');
}

/**
 * Allow complete uninstallation of the ad_text module.
 */
function ad_text_uninstall() {

  // Delete all ad_text content.
  $result = db_query("SELECT aid FROM {ad_text}");
  while ($aid = db_result($result)) {
    node_delete($aid);
  }

  // Remove tables.
  drupal_uninstall_schema('ad_text');
}

Functions

Namesort descending Description
ad_text_install ad_text module installation.
ad_text_schema Implementation of hook_schema().
ad_text_uninstall Allow complete uninstallation of the ad_text module.