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

Diff of /contributions/modules/type_local_nids/type_local_nids.install

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

revision 1.2, Sun Mar 23 02:48:30 2008 UTC revision 1.3, Thu Sep 24 17:50:19 2009 UTC
# Line 1  Line 1 
1  <?php  <?php
2  // $Id$  // $Id: type_local_nids.install,v 1.1.2.1 2008/03/25 03:51:40 jbrown Exp $
3    
4    
5  function type_local_nids_install() {  /**
6    * @file
7    * Install, update and uninstall functions for the type_local_nids module.
8    */
9    
10    
11    /**
12    * Implement hook_schema().
13    */
14    function type_local_nids_schema() {
15    
16            $schema['node_lnid_next'] = array(
17                    'description' => 'Maintains the next lnid for each node type.',
18                    'fields' => array(
19                            'type' => array(
20                                    'description' => 'The node type.',
21                                    'type' => 'varchar',
22                                    'length' => 32,
23                                    'not null' => TRUE
24                            ),
25                            'next_lnid' => array(
26                                    'description' => 'The next lnid.',
27            'type' => 'int',
28            'unsigned' => TRUE,
29            'not null' => TRUE
30                            )
31                    ),
32                    'primary key' => array('type')
33            );
34    
35            $schema['node_lnid'] = array(
36                    'description' => 'Maintains the lnid for each node',
37                    'fields' => array(
38                            'nid' => array(
39                                    'description' => 'The nid.',
40            'type' => 'int',
41            'unsigned' => TRUE,
42            'not null' => TRUE
43                            ),
44                            'lnid' => array(
45                                    'description' => 'The lnid.',
46            'type' => 'int',
47            'unsigned' => TRUE,
48            'not null' => TRUE
49                            )
50                    ),
51                    'primary key' => array('nid')
52            );
53    
54          switch ($GLOBALS['db_type']) {          return $schema;
                 case 'mysql':  
                 case 'mysqli':  
   
                         db_query("  
                                 CREATE TABLE node_lnid_next (  
                                         type VARCHAR(32) NOT NULL,  
                                         next_lnid INT(10) UNSIGNED NOT NULL,  
                                         PRIMARY KEY (type)  
                                 )  
                         ");  
   
                         db_query("  
                                 CREATE TABLE node_lnid (  
                                         nid int(10) unsigned NOT NULL,  
                                         lnid int(10) unsigned NOT NULL,  
                                         PRIMARY KEY (nid)  
                                 )  
                         ");  
   
                         break;  
   
                 case 'pgsql':  
                         break;  
         }  
 }  
   
   
 function type_local_nids_uninstall() {  
   db_query('DROP TABLE {node_lnid_next}');  
   db_query('DROP TABLE {node_lnid}');  
55  }  }
56    

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

  ViewVC Help
Powered by ViewVC 1.1.2