Mercurial > defr > drupal > core
diff modules/upload/upload.install @ 1:c1f4ac30525a 6.0
Drupal 6.0
author | Franck Deroche <webmaster@defr.org> |
---|---|
date | Tue, 23 Dec 2008 14:28:28 +0100 |
parents | |
children | 3edae6ecd6c6 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/modules/upload/upload.install Tue Dec 23 14:28:28 2008 +0100 @@ -0,0 +1,85 @@ +<?php +// $Id: upload.install,v 1.6.2.1 2008/02/08 18:01:14 goba Exp $ + +/** + * Implementation of hook_install(). + */ +function upload_install() { + // Create table. The upload table might have been created in the Drupal 5 + // to Drupal 6 upgrade, and was migrated from the file_revisions table. So + // in this case, there is no need to create the table, it is already there. + if (!db_table_exists('upload')) { + drupal_install_schema('upload'); + } +} + +/** + * Implementation of hook_uninstall(). + */ +function upload_uninstall() { + // Remove tables. + drupal_uninstall_schema('upload'); +} + +/** + * Implementation of hook_schema(). + */ +function upload_schema() { + $schema['upload'] = array( + 'description' => t('Stores uploaded file information and table associations.'), + 'fields' => array( + 'fid' => array( + 'type' => 'int', + 'unsigned' => TRUE, + 'not null' => TRUE, + 'default' => 0, + 'description' => t('Primary Key: The {files}.fid.'), + ), + 'nid' => array( + 'type' => 'int', + 'unsigned' => TRUE, + 'not null' => TRUE, + 'default' => 0, + 'description' => t('The {node}.nid associated with the uploaded file.'), + ), + 'vid' => array( + 'type' => 'int', + 'unsigned' => TRUE, + 'not null' => TRUE, + 'default' => 0, + 'description' => t('Primary Key: The {node}.vid associated with the uploaded file.'), + ), + 'description' => array( + 'type' => 'varchar', + 'length' => 255, + 'not null' => TRUE, + 'default' => '', + 'description' => t('Description of the uploaded file.'), + ), + 'list' => array( + 'type' => 'int', + 'unsigned' => TRUE, + 'not null' => TRUE, + 'default' => 0, + 'size' => 'tiny', + 'description' => t('Whether the file should be visibly listed on the node: yes(1) or no(0).'), + ), + 'weight' => array( + 'type' => 'int', + 'not null' => TRUE, + 'default' => 0, + 'size' => 'tiny', + 'description' => t('Weight of this upload in relation to other uploads in this node.'), + ), + ), + 'primary key' => array('vid', 'fid'), + 'indexes' => array( + 'fid' => array('fid'), + 'nid' => array('nid'), + ), + ); + + return $schema; +} + +