123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116 |
- <?php
- /**
- * @file
- * Installation functions for Feedback module.
- */
- /**
- * Implements hook_schema().
- */
- function feedback_schema() {
- $schema['feedback'] = array(
- 'description' => 'Stores all feedback messages.',
- 'fields' => array(
- 'fid' => array(
- 'description' => 'Feedback message ID.',
- 'type' => 'serial',
- 'unsigned' => TRUE,
- 'not null' => TRUE,
- ),
- 'uid' => array(
- 'description' => 'User ID of the feedback message author.',
- 'type' => 'int',
- 'unsigned' => TRUE,
- 'not null' => TRUE,
- 'default' => 0,
- ),
- 'status' => array(
- 'description' => 'Feedback status (0 = new, 1 = processed).',
- 'type' => 'int',
- 'size' => 'tiny',
- 'unsigned' => TRUE,
- 'not null' => TRUE,
- 'default' => 0,
- ),
- 'message' => array(
- 'description' => 'The feedback message.',
- 'type' => 'text',
- 'size' => 'big',
- 'not null' => TRUE,
- ),
- 'location' => array(
- 'description' => 'System path of the originating page.',
- 'type' => 'text',
- 'not null' => TRUE,
- ),
- 'location_masked' => array(
- 'description' => 'Untranslated system path of the originating page.',
- 'type' => 'text',
- 'not null' => TRUE,
- ),
- 'url' => array(
- 'description' => 'Absolute URL of the originating page.',
- 'type' => 'text',
- 'not null' => TRUE,
- ),
- 'useragent' => array(
- 'description' => 'User agent of the feedback message author.',
- 'type' => 'varchar',
- 'length' => 255,
- 'not null' => TRUE,
- ),
- // @todo Rename to created. Also add 'changed'.
- 'timestamp' => array(
- 'description' => 'UNIX timestamp of the feedback message creation date.',
- 'type' => 'int',
- 'not null' => TRUE,
- 'default' => 0,
- ),
- ),
- 'primary key' => array('fid'),
- 'indexes' => array(
- 'location' => array(array('location', 32)),
- 'location_masked' => array(array('location_masked', 32)),
- ),
- );
- return $schema;
- }
- /**
- * Implements hook_uninstall().
- */
- function feedback_uninstall() {
- db_delete('variable')
- ->condition('name', 'feedback_%', 'LIKE')
- ->execute();
- }
- /**
- * Change fid into type serial field.
- */
- function feedback_update_6100() {
- db_drop_primary_key('feedback');
- db_change_field('feedback', 'fid', 'fid', array(
- 'type' => 'serial',
- 'unsigned' => TRUE,
- 'not null' => TRUE,
- ), array(
- 'primary key' => array('fid'),
- ));
- }
- /**
- * Add column for absolute URL.
- */
- function feedback_update_6101() {
- db_add_field('feedback', 'url', array(
- 'type' => 'text',
- 'not null' => TRUE,
- ));
- // Set 'url' to the value of 'location' for all existing entries.
- db_update('feedback')
- ->expression('url', 'location')
- ->execute();
- }
|