pierre@0: . pierre@0: */ pierre@0: pierre@0: /** pierre@0: * Implementation of hook_schema(). pierre@0: */ pierre@0: function ad_image_schema() { pierre@0: $schema['ad_image'] = array( pierre@0: 'description' => 'The ad_image table stores image information such as file ID, title, width, height of corresponding image ads.', pierre@0: 'fields' => array( pierre@0: 'aid' => array( pierre@0: 'type' => 'int', pierre@0: 'unsigned' => TRUE, pierre@0: 'not null' => TRUE, pierre@0: 'default' => 0, pierre@0: ), pierre@0: 'fid' => array( pierre@0: 'type' => 'int', pierre@0: 'unsigned' => TRUE, pierre@0: 'not null' => TRUE, pierre@0: 'default' => 0, pierre@0: ), pierre@0: 'url' => array( pierre@0: 'type' => 'varchar', pierre@0: 'length' => '255', pierre@0: 'not null' => TRUE, pierre@0: 'default' => '', pierre@0: ), pierre@0: 'tooltip' => array( pierre@0: 'type' => 'varchar', pierre@0: 'length' => '255', pierre@0: 'not null' => TRUE, pierre@0: 'default' => '', pierre@0: ), pierre@1: 'remote_image' => array( pierre@1: 'type' => 'varchar', pierre@1: 'length' => '255', pierre@1: 'not null' => TRUE, pierre@1: 'default' => '', pierre@1: ), pierre@0: 'width' => array( pierre@0: 'type' => 'int', pierre@0: 'unsigned' => TRUE, pierre@0: 'not null' => TRUE, pierre@0: 'default' => 0, pierre@0: ), pierre@0: 'height' => array( pierre@0: 'type' => 'int', pierre@0: 'unsigned' => TRUE, pierre@0: 'not null' => TRUE, pierre@0: 'default' => 0, pierre@0: ), pierre@0: ), pierre@0: 'unique keys' => array( pierre@0: 'aid' => array('aid') pierre@0: ), pierre@0: ); pierre@0: $schema['ad_image_format'] = array( pierre@0: 'description' => 'The ad_image_format table stores dimensions for image ads.', pierre@0: 'fields' => array( pierre@0: 'gid' => array( pierre@0: 'type' => 'int', pierre@0: 'unsigned' => TRUE, pierre@0: 'not null' => TRUE, pierre@0: ), pierre@0: 'min_width' => array( pierre@0: 'type' => 'int', pierre@0: 'unsigned' => TRUE, pierre@0: 'not null' => TRUE, pierre@0: 'default' => 0, pierre@0: ), pierre@0: 'max_width' => array( pierre@0: 'type' => 'int', pierre@0: 'unsigned' => TRUE, pierre@0: 'not null' => TRUE, pierre@0: 'default' => 0, pierre@0: ), pierre@0: 'min_height' => array( pierre@0: 'type' => 'int', pierre@0: 'unsigned' => TRUE, pierre@0: 'not null' => TRUE, pierre@0: 'default' => 0, pierre@0: ), pierre@0: 'max_height' => array( pierre@0: 'type' => 'int', pierre@0: 'unsigned' => TRUE, pierre@0: 'not null' => TRUE, pierre@0: 'default' => 0, pierre@0: ), sly@2: 'max_size' => array( sly@2: 'type' => 'int', sly@2: 'unsigned' => TRUE, sly@2: 'not null' => TRUE, sly@2: 'default' => 0, sly@2: ), pierre@0: ), pierre@0: 'primary key' => array('gid'), pierre@0: ); pierre@0: pierre@0: return $schema; pierre@0: } pierre@0: pierre@0: pierre@0: /** pierre@0: * ad_image module installation. pierre@0: */ pierre@0: function ad_image_install() { pierre@0: drupal_install_schema('ad_image'); pierre@0: } pierre@0: pierre@0: /** pierre@0: * Allow complete uninstallation of the ad_image module. pierre@0: */ pierre@0: function ad_image_uninstall() { pierre@0: // Delete all ad_image content. pierre@0: $result = db_query("SELECT aid FROM {ad_image}"); pierre@0: while ($aid = db_result($result)) { pierre@0: node_delete($aid); pierre@0: } pierre@0: pierre@0: // Remove tables. pierre@0: drupal_uninstall_schema('ad_image'); pierre@0: } pierre@1: pierre@1: /** pierre@1: * Introduce remote_image field for remotely hosted images. pierre@1: */ pierre@1: function ad_image_update_6001() { pierre@1: $ret = array(); pierre@1: db_add_field($ret, 'ad_image', 'remote_image', pierre@1: array( pierre@1: 'type' => 'varchar', pierre@1: 'length' => '255', pierre@1: 'not null' => TRUE, pierre@1: 'default' => '', pierre@1: )); pierre@1: return $ret; pierre@1: } sly@2: sly@2: /** sly@2: * Introduce remote_image field for remotely hosted images. sly@2: */ sly@2: function ad_image_update_6002() { sly@2: $ret = array(); sly@2: db_add_field($ret, 'ad_image_format', 'max_size', sly@2: array( sly@2: 'type' => 'int', sly@2: 'unsigned' => TRUE, sly@2: 'not null' => TRUE, sly@2: 'default' => '0', sly@2: )); sly@2: return $ret; sly@2: }