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

Contents of /contributions/modules/google_pr/google_pr.install

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


Revision 1.3 - (show annotations) (download) (as text)
Thu Aug 14 12:23:26 2008 UTC (15 months, 1 week ago) by deekayen
Branch: MAIN
CVS Tags: HEAD
Changes since 1.2: +29 -15 lines
File MIME type: text/x-php
use the proper schema API method for update 1
1 <?php
2 // $Id: google_pr.install,v 1.2 2008/08/14 05:20:28 deekayen Exp $
3
4 /**
5 * Implementation of hook_schema().
6 */
7 function google_pr_schema() {
8 $schema = array();
9 $schema['google_pr'] = array(
10 'fields' => array(
11 'url' => array(
12 'type' => 'varchar',
13 'length' => '255',
14 'not null' => TRUE
15 ),
16 'pagerank' => array(
17 'type' => 'int',
18 'unsigned' => TRUE,
19 'size' => 'tiny',
20 'not null' => TRUE,
21 'default' => 0,
22 'disp-width' => '4'
23 ),
24 'timestamp' => array(
25 'type' => 'int',
26 'unsigned' => TRUE,
27 'not null' => TRUE,
28 'default' => 0,
29 'disp-width' => '11'
30 )
31 ),
32 'primary key' => array('url')
33 );
34 return $schema;
35 }
36
37 /**
38 * Implementation of hook_install().
39 *
40 * Create a table and print a status message.
41 */
42 function google_pr_install() {
43 drupal_install_schema('google_pr');
44 }
45
46 /**
47 * Implementation of hook_uninstall().
48 *
49 * Cleans up configuration variables.
50 */
51 function google_pr_uninstall() {
52 drupal_uninstall_schema('google_pr');
53 variable_del('google_pr_max');
54 variable_del('google_pr_description');
55 variable_del('google_pr_watchdog');
56 }
57
58 /**
59 * Implmentation of hook_update_X().
60 *
61 * Installs a new database table.
62 */
63 function google_pr_update_1() {
64 $schema = array();
65 $schema['google_pr'] = array(
66 'fields' => array(
67 'url' => array(
68 'type' => 'varchar',
69 'length' => '255',
70 'not null' => TRUE
71 ),
72 'pagerank' => array(
73 'type' => 'int',
74 'unsigned' => TRUE,
75 'size' => 'tiny',
76 'not null' => TRUE,
77 'default' => 0,
78 'disp-width' => '4'
79 ),
80 'timestamp' => array(
81 'type' => 'int',
82 'unsigned' => TRUE,
83 'not null' => TRUE,
84 'default' => 0,
85 'disp-width' => '11'
86 )
87 ),
88 'primary key' => array('url')
89 );
90
91 $ret = array();
92 db_create_table($ret, 'google_pr', $schema['google_pr']);
93 return $ret;
94 }

  ViewVC Help
Powered by ViewVC 1.1.2