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

Contents of /contributions/modules/letters/letters.install

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


Revision 1.5 - (show annotations) (download) (as text)
Mon Jun 22 20:31:08 2009 UTC (5 months, 1 week ago) by seanr
Branch: MAIN
CVS Tags: DRUPAL-6--1-4, DRUPAL-6--1-3, HEAD
Changes since 1.4: +2 -2 lines
File MIME type: text/x-php
#490718 - Invalid default value on install
1 <?php
2 // $Id: letters.install,v 1.4 2009/06/08 15:19:09 seanr Exp $
3 function letters_install() {
4 drupal_install_schema('letters');
5 }
6
7 function letters_uninstall() {
8 drupal_uninstall_schema('letters');
9 }
10
11 /**
12 * Implementation of hook_schema().
13 */
14 function letters_schema() {
15 $schema['letters_newspapers'] = array(
16 'fields' => array(
17 'newsid' => array('type' => 'serial', 'unsigned' => TRUE, 'not null' => TRUE),
18 'title' => array('type' => 'varchar', 'not null' => TRUE, 'length' => 255),
19 'address' => array('type' => 'varchar', 'not null' => FALSE, 'length' => 255),
20 'city' => array('type' => 'varchar', 'not null' => FALSE, 'length' => 255),
21 'state' => array('type' => 'varchar', 'not null' => FALSE, 'length' => 2),
22 'zip' => array('type' => 'varchar', 'not null' => FALSE, 'length' => 10),
23 'phone' => array('type' => 'varchar', 'not null' => FALSE, 'length' => 15),
24 'fax' => array('type' => 'varchar', 'not null' => FALSE, 'length' => 15),
25 'email' => array('type' => 'varchar', 'not null' => FALSE, 'length' => 255),
26 'homepage' => array('type' => 'varchar', 'not null' => FALSE, 'length' => 255),
27 'statewide' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0),
28 ),
29 'indexes' => array(
30 'letters_zip' => array('zip')
31 ),
32 'primary key' => array('newsid'),
33 );
34 return $schema;
35 }
36
37 /**
38 * Implementation of hook_update().
39 */
40 function letters_update_1() {
41 $ret = array();
42 db_drop_primary_key($ret, 'letters_newspapers');
43 db_change_field($ret, 'letters_newspapers', 'newsid', 'newsid',
44 array('type' => 'serial', 'not null' => TRUE),
45 array('primary key' => array('newsid'))
46 );
47 return $ret;
48 }

  ViewVC Help
Powered by ViewVC 1.1.2