home | career | drupal | java | mac | mysql | perl | php | scala | uml | unix

Drupal example source code file (nodeapi_example.install)

This example Drupal source code file (nodeapi_example.install) is included in the DevDaily.com "Drupal Source Code Warehouse" project. The intent of this project is to help you "Learn Drupal by Example".

PHP - Drupal tags/keywords

array, description, for, function, id, int, not, null, php, rating, true, type, unsigned

The nodeapi_example.install Drupal example source code

<?php

/**
 * @file
 * Nodeapi example module's install and uninstall code.
 */

/**
 * Implementation of hook_install().
 */
function nodeapi_example_install() {
  drupal_install_schema('nodeapi_example');
}

/**
 * Implementation of hook_uninstall().
 */
function nodeapi_example_uninstall() {
  drupal_uninstall_schema('nodeapi_example');
}

/**
 * Implementation of hook_schema().
 */
function nodeapi_example_schema() {
  $schema['nodeapi_example'] = array(
  'fields' => array(
      'id' => array(
      'type' => 'serial',
      'not null' => TRUE,
      'description' => t('Primary Key: Unique ID.'),
    ),
    'nid' => array(
      'type' => 'int',
      'unsigned' => TRUE,
      'not null' => TRUE,
      'default' => 0,
      'description' => t('node id for the rating'),
    ),
    'vid' => array(
      'type' => 'int',
      'unsigned' => TRUE,
      'not null' => TRUE,
      'default' => 0,
      'description' => t('version id for rating'),
    ),
    'rating' => array(
      'type' => 'int',
      'unsigned' => TRUE,
      'not null' => TRUE,
      'default' => 0,
      'description' => t('rating for this node'),
    ),
  ),
  'primary key' => array('id'),
  );
  return $schema;
}

function nodeapi_example_update_1() {
  return _system_update_utf8(array('nodeapi_example'));
}

Other Drupal examples (source code examples)

Here is a short list of links related to this Drupal nodeapi_example.install source code file:

new blog posts

"Drupal" is a registered trademark of Dries Buytaert.

my drupal tutorials and examples  

Copyright 1998-2016 Alvin Alexander, alvinalexander.com
All Rights Reserved.

Beginning in 2016, a portion of the proceeds from pages under the '/drupal-code-examples/' URI will be donated to charity.