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

Drupal example source code file (panels_node.install)

This example Drupal source code file (panels_node.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

255, array, database, function, length, php, pipeline, return, schema, sql, true, type, varchar, where

The panels_node.install Drupal example source code

<?php
// $Id: panels_node.install,v 1.3.4.2 2010/07/22 22:20:52 merlinofchaos Exp $

/**
 * Implementation of hook_schema().
 */
function panels_node_schema() {
  // This should always point to our 'current' schema. This makes it relatively easy
  // to keep a record of schema as we make changes to it.
  return panels_node_schema_1();
}

/**
 * Schema version 1 for Panels in D6.
 */
function panels_node_schema_1() {
  $schema = array();

  $schema['panels_node'] = array(
    'fields' => array(
      'nid' => array(
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
      ),
      'css_id' => array(
        'type' => 'varchar',
        'length' => '255',
      ),
      'did' => array(
        'type' => 'int',
        'not null' => TRUE,
      ),
      'pipeline' => array(
        'type' => 'varchar',
        'length' => '255',
      ),
    ),
    'primary key' => array('did'),
  );

  return $schema;
}

/**
 * Implementation of hook_install().
 */
function panels_node_install() {
  db_query("UPDATE {system} SET weight = 11 WHERE name = 'panels_node'");
  drupal_install_schema('panels_node');
}

/**
 * Implementation of hook_uninstall().
 */
function panels_node_uninstall() {
  // TODO: Delete all actual nodes that are panels_nodes.
  db_query("DELETE FROM {node} WHERE type = 'panel'");
  drupal_uninstall_schema('panels_node');
}

/**
 * Implementation of hook_update to handle adding a pipeline
 */
function panels_node_update_6001() {
  $ret = array();
  $field = array(
    'type' => 'varchar',
    'length' => '255',
  );

  db_add_field($ret, 'panels_node', 'pipeline', $field);
  return $ret;
}

Other Drupal examples (source code examples)

Here is a short list of links related to this Drupal panels_node.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.