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

Diff of /contributions/modules/attachment/attachment.install

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

revision 1.2, Tue Sep 12 18:06:44 2006 UTC revision 1.3, Tue Jul 17 19:50:04 2007 UTC
# Line 1  Line 1 
1  <?php  <?php
2    
3  // $Id:$  // $Id$
4    
5  /**  /**
6   * Update the tables to UTF-8   * Update the tables to UTF-8
# Line 13  function attachment_update_1() { Line 13  function attachment_update_1() {
13   * Install the initial schema.   * Install the initial schema.
14   */   */
15  function attachment_install() {  function attachment_install() {
16    switch ($GLOBALS['db_type']) {    if (!db_table_exists('attachment')) {
17      case 'mysql':      switch ($GLOBALS['db_type']) {
18      case 'mysqli':        case 'mysql':
19        db_query(        case 'mysqli':
20    <<<MYSQL_UPDATE          db_query(
21          CREATE TABLE {attachment} (  <<<MYSQL_UPDATE
22            aid int(10) unsigned NOT NULL,            CREATE TABLE {attachment} (
23            nid int(10) unsigned NOT NULL,              aid int(10) unsigned NOT NULL,
24            fid int(10) unsigned NOT NULL,              nid int(10) unsigned NOT NULL,
25            filename varchar(255) NOT NULL,              fid int(10) unsigned NOT NULL,
26            title varchar(255) NOT NULL,              filename varchar(255) NOT NULL,
27            description varchar(255) NOT NULL,              title varchar(255) NOT NULL,
28            size int(12) NOT NULL,              description varchar(255) NOT NULL,
29            hidden char(1) NOT NULL,              size int(12) NOT NULL,
30            PRIMARY KEY (aid)              hidden char(1) NOT NULL,
31          ) /*!40100 DEFAULT CHARACTER SET utf8 */;              PRIMARY KEY (aid)
32              ) /*!40100 DEFAULT CHARACTER SET utf8 */;
33  MYSQL_UPDATE  MYSQL_UPDATE
34        );          );
35        break;          break;
36    
37      case 'pgsql':        case 'pgsql':
38        db_query(          db_query(
39  <<<PGSQL_UPDATE  <<<PGSQL_UPDATE
40        create table {attachment} (          create table {attachment} (
41          aid serial primary key,            aid serial primary key,
42          nid integer not null,            nid integer not null,
43          fid integer not null,            fid integer not null,
44          filename varchar(255) not null,            filename varchar(255) not null,
45          title varchar(255) not null,            title varchar(255) not null,
46          description varchar(255) not null,            description varchar(255) not null,
47          size integer not null,            size integer not null,
48          hidden char(1) not null            hidden char(1) not null
49        );          );
50  PGSQL_UPDATE  PGSQL_UPDATE
51        );          );
52        break;          break;
53        } // End switch($GLOBALS['db_type'])
54      } // End if( ! db_table_exists('attachment') )
55    }
56    
57    /**
58     * Uninstall table
59     */
60    function attachment_uninstall() {
61      db_query('DROP TABLE {attachment}');
62      variable_del('attachment_display_teaser');
63      variable_del('attachment_private_files');
64      variable_del('attachment_text_rename_whitelist');
65      $nodetypes = node_get_types();
66      foreach ($nodetypes as $type => $v) {
67        variable_del('attachment_node_'. $type);
68    }    }
69  }  }

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

  ViewVC Help
Powered by ViewVC 1.1.2