/[drupal]/contributions/modules/workflow_named_transitions/workflow_named_transitions.install
ViewVC logotype

Diff of /contributions/modules/workflow_named_transitions/workflow_named_transitions.install

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.1, Mon Sep 8 15:31:51 2008 UTC revision 1.2, Tue Dec 23 06:11:02 2008 UTC
# Line 1  Line 1 
1  <?php  <?php
2  // $Id$  // $Id: workflow_named_transitions.install,v 1.1 2008/09/08 15:31:51 deekayen Exp $
3    
4  /**  /**
5   * @file   * @file
# Line 7  Line 7 
7   */   */
8    
9  /**  /**
10     * Implementation of hook_schema().
11     *
12     * @return unknown
13     */
14    function workflow_named_transitions_schema() {
15      $schema['workflow_named_transitions'] = array(
16        'fields' => array(
17          'tid' => array(
18            'type' => 'int',
19            'unsigned' => TRUE,
20            'not null' => TRUE,
21            'disp-width' => '10'
22          ),
23          'label' => array(
24            'type' => 'varchar',
25            'length' => '255',
26            'not null' => TRUE
27          )
28        ),
29        'primary key' => array('tid')
30      );
31      return $schema;
32    }
33    
34    /**
35   * Implementation of hook_install().   * Implementation of hook_install().
36   *   *
37   * Add the workflow_named_transitions table for storing labels for each   * Add the workflow_named_transitions table for storing labels for each
# Line 15  Line 40 
40   * after the one in the workflow module.   * after the one in the workflow module.
41   */   */
42  function workflow_named_transitions_install($form_id, &$form) {  function workflow_named_transitions_install($form_id, &$form) {
43    switch ($GLOBALS['db_type']) {    drupal_install_schema('workflow_named_transitions');
     case 'mysql':  
     case 'mysqli':  
       db_query("CREATE TABLE {workflow_named_transitions} (  
           tid int(10) UNSIGNED NOT NULL,  
           label varchar(255) NOT NULL,  
           PRIMARY KEY (tid)  
         )");  
       break;  
     case 'pgsql':  
       db_query("CREATE TABLE {workflow_named_transitions} (  
           tid int_unsigned NOT NULL DEFAULT 0,  
           label character varying(255) NOT NULL,  
           CONSTRAINT workflow_named_transitions_pkey PRIMARY KEY (tid)  
         )");  
       break;  
   }  
44    $workflow_weight = db_result(db_query_range("SELECT weight FROM {system} WHERE name = 'workflow'", 0, 1));    $workflow_weight = db_result(db_query_range("SELECT weight FROM {system} WHERE name = 'workflow'", 0, 1));
45    db_query("UPDATE {system} SET weight = %d + 1 WHERE name = 'workflow_named_transitions'", $workflow_weight);    db_query("UPDATE {system} SET weight = %d + 1 WHERE name = 'workflow_named_transitions'", $workflow_weight);
46  }  }
# Line 42  function workflow_named_transitions_inst Line 51  function workflow_named_transitions_inst
51   * Drop the workflow_named_transitions table.   * Drop the workflow_named_transitions table.
52   */   */
53  function workflow_named_transitions_uninstall() {  function workflow_named_transitions_uninstall() {
54    db_query("DROP TABLE {workflow_named_transitions}");    drupal_uninstall_schema('workflow_named_transitions');
55  }  }

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

  ViewVC Help
Powered by ViewVC 1.1.2