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

Diff of /contributions/modules/planet/planet.install

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

revision 1.4 by swe3tdave, Wed Mar 11 23:15:34 2009 UTC revision 1.5 by rockyroad, Mon Jun 8 19:22:28 2009 UTC
# Line 10  function planet_schema() { Line 10  function planet_schema() {
10      'description' => t('The base table for planet.'),      'description' => t('The base table for planet.'),
11      'fields' => array(      'fields' => array(
12        'fid' => array(        'fid' => array(
13          'description' => t('The primary identifier for a planet_feeds table.'),          'description' => t('Primary Key: Unique identifier for a planet RSS feed.'),
14          'type' => 'serial',          'type' => 'serial',
15          'unsigned' => TRUE,          'unsigned' => TRUE,
16          'not null' => TRUE,          'not null' => TRUE,
17        ),        ),
18        'uid' => array(        'uid' => array(
19            'description' => t('Foreign key to {users}.uid . Identifies user who choose the feed.'),
20          'type' => 'int',          'type' => 'int',
21          'unsigned' => 1,          'unsigned' => 1,
22          'not null' => FALSE,          'not null' => FALSE,
23        ),        ),
24        'title' => array(        'title' => array(
25          'type' => 'varchar',          'type' => 'varchar',
26            'description' => t('Title of the feed.'),
27          'length' => 50,          'length' => 50,
28          'not null' => TRUE,          'not null' => TRUE,
29        ),        ),
30        'link' => array(        'link' => array(
31          'type' => 'varchar',          'type' => 'varchar',
32            'description' => t('URL to the feed'),
33          'length' => 80,          'length' => 80,
34          'not null' => TRUE,          'not null' => TRUE,
35        ),        ),
36        'image' => array(        'image' => array(
37            'description' => t('An image representing the feed'),
38          'type' => 'varchar',          'type' => 'varchar',
39          'length' => 120,          'length' => 120,
40          'not null' => FALSE,          'not null' => FALSE,
41        ),        ),
42        'checked' => array(        'checked' => array(
43            'description' => t('Last time feed was checked for new items, as Unix timestamp'),
44          'type' => 'int',          'type' => 'int',
45          'not null' => FALSE,          'not null' => FALSE,
46        ),        ),
47        'frozen' => array(        'frozen' => array(
48          'type' => 'int',            // TODO: add field description        'description' => t(''),
49              'type' => 'int',        // TODO change to boolean when supported
50          'not null' => TRUE,          'not null' => TRUE,
51          'default' => 0,          'default' => 0,
52        ),        ),
53          'hash' => array(
54            'type' => 'varchar',
55            'length' => 32,
56            'description' => t("A hash of the feed's headers."),
57          ),
58          'error' => array(
59            'type' => 'int',
60            'not null' => TRUE,
61            'default' => 0,
62            'length' => 1,
63            'description' => t("Whether the feed is throwing errors or not."),
64          ),
65      ),      ),
66      'primary key' => array('fid'),      'primary key' => array('fid'),
67        'indexes' => array(
68          'error' => array('error'),
69        ),
70    );    );
71    
72    $schema['planet_items'] = array(    $schema['planet_items'] = array(
73      'description' => t('contain feed id and its corresponding nid'),      'description' => t('contain feed id and its corresponding nid'),
74      'fields' => array(      'fields' => array(
75        'id' => array(        'id' => array(
76          'description' => t('The primary identifier for a planet_items table'),          'description' => t('Primary key: Unique identifier for a planet feed item'),
77          'type' => 'serial',          'type' => 'serial',
78          'unsigned' => 1,          'unsigned' => 1,
79          'not null' => TRUE,          'not null' => TRUE,
# Line 67  function planet_schema() { Line 88  function planet_schema() {
88          'unsigned' => 1,          'unsigned' => 1,
89          'not null' => FALSE,          'not null' => FALSE,
90        ),        ),
91          'iid' => array(
92            'type' => 'varchar',
93            'length' => 32,
94            'not null' => TRUE,
95            'description' => t("md5 of the feed item's title and body."),
96          ),
97        'guid' => array(        'guid' => array(
98          'type' => 'varchar',          'type' => 'varchar',
99          'length' => 120,          'length' => 120,
# Line 91  function planet_schema() { Line 118  function planet_schema() {
118  /**  /**
119   * Implementation of hook_install()   * Implementation of hook_install()
120   *   *
121   * This will automatically install the database tables for the planet module for MySQL.   * This will automatically install the database tables for the planet
122     * module, using Drupal's data abstraction layer.
123   *   *
  * If you are using another database, you will have to install the tables by hand, using the queries below as a reference.  
  *  
  *  
124   */   */
125    
126  function planet_install() {  function planet_install() {
# Line 106  function planet_install() { Line 131  function planet_install() {
131  /**  /**
132   * Implementation of hook_uninstall()   * Implementation of hook_uninstall()
133   *   *
134   * This will automatically uninstall the database tables for the planet module for MySQL.   * Uninstalls planet module by removing its own database tables, nodes
135     * and persistent variables.
136   *   *
  *  
137   */   */
138    
139  function planet_uninstall() {  function planet_uninstall() {
# Line 120  function planet_uninstall() { Line 145  function planet_uninstall() {
145    db_query("DELETE FROM {node} WHERE type = '%s'", planet);    db_query("DELETE FROM {node} WHERE type = '%s'", planet);
146    
147  }  }
148    
149    function planet_update_1() {
150      $ret = array();
151      db_add_field($ret, 'planet_feeds', 'hash', array(
152            'type' => 'varchar',
153            'length' => 32,
154            'description' => t("A hash of the feed's headers."),
155          )
156        );
157      return $ret;
158    }
159    
160    function planet_update_2() {
161      $ret = array();
162      db_add_field($ret, 'planet_items', 'iid', array(
163            'type' => 'varchar',
164            'length' => 32,
165            'not null' => TRUE,
166            'default' => '',
167            'description' => t("md5 of the feed item's title and body."),
168          )
169        );
170      return $ret;
171    }
172    
173    function planet_update_3() {
174      $ret = array();
175      db_add_field($ret, 'planet_feeds', 'error', array(
176            'type' => 'int',
177            'not null' => TRUE,
178            'default' => 0,
179            'size' => 'tiny',
180            'description' => t("Whether the feed is throwing errors or not."),
181          )
182        );
183      db_add_index($ret, 'planet_feeds', 'error', array('error'));
184    
185      return $ret;
186    }

Legend:
Removed from v.1.4  
changed lines
  Added in v.1.5

  ViewVC Help
Powered by ViewVC 1.1.3