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@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: ), 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: }