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

Contents of /contributions/modules/role_weights/role_weights.install

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


Revision 1.8 - (show annotations) (download) (as text)
Tue Feb 19 18:09:35 2008 UTC (21 months, 1 week ago) by leafishpaul
Branch: MAIN
CVS Tags: DRUPAL-6--1-5, HEAD
Branch point for: DRUPAL-6--1
Changes since 1.7: +1 -1 lines
File MIME type: text/x-php
Oops.
1 <?php
2 //$Id$
3
4 // role_weights.install
5
6 function role_weights_install() {
7
8 // Create tables.
9 drupal_install_schema('role_weights');
10
11 db_query("INSERT INTO {role_weights} (rid, weight) VALUES (1, 0)");
12 db_query("INSERT INTO {role_weights} (rid, weight) VALUES (2, -1)");
13 }
14
15 function role_weights_schema() {
16 $schema['role_weights'] = array(
17 'fields' => array(
18 'rid' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0),
19 'weight' => array('type' => 'int', 'not null' => TRUE, 'default' => 0, 'size' => 'tiny')
20 ),
21 'primary key' => array('rid'),
22 );
23
24 return $schema;
25 }
26
27 function role_weights_uninstall() {
28 // Remove tables.
29 drupal_uninstall_schema('role_weights');
30 }
31
32 /* updates */
33 function role_weights_update_1() {
34 // invert the weights of all role_weights set
35 // part of reversing our weights to coincide with Drupal standards: http://drupal.org/node/75877
36 $items = array();
37 $items[] = update_sql("UPDATE {role_weights} SET weight = 0 - weight");
38 return $items;
39 }
40

  ViewVC Help
Powered by ViewVC 1.1.2