| Line # | Frequency | Source Line | | 1 | | <?php | | 2 | | // $Id: filter.install,v 1.7 2008/03/15 12:31:28 dries Exp $ | | 3 | | | | 4 | | /** | | 5 | | * Implementation of hook_schema(). | | 6 | | */ | | 7 | | function filter_schema() { | | 8 | | $schema['filters'] = array( | | 9 | 1 | 'description' => t('Table that maps filters (HTML corrector) to input formats (Filtered HTML).'), | | 10 | | 'fields' => array( | | 11 | | 'fid' => array( | | 12 | | 'type' => 'serial', | | 13 | | 'not null' => TRUE, | | 14 | | 'description' => t('Primary Key: Auto-incrementing filter ID.'), | | 15 | | ), | | 16 | | 'format' => array( | | 17 | | 'type' => 'int', | | 18 | | 'not null' => TRUE, | | 19 | | 'default' => 0, | | 20 | | 'description' => t('Foreign key: The {filter_formats}.format to which this filter is assigned.'), | | 21 | | ), | | 22 | | 'module' => array( | | 23 | | 'type' => 'varchar', | | 24 | | 'length' => 64, | | 25 | | 'not null' => TRUE, | | 26 | | 'default' => '', | | 27 | | 'description' => t('The origin module of the filter.'), | | 28 | | ), | | 29 | | 'delta' => array( | | 30 | | 'type' => 'int', | | 31 | | 'not null' => TRUE, | | 32 | | 'default' => 0, | | 33 | | 'size' => 'tiny', | | 34 | | 'description' => t('ID to identify which filter within module is being referenced.'), | | 35 | | ), | | 36 | | 'weight' => array( | | 37 | | 'type' => 'int', | | 38 | | 'not null' => TRUE, | | 39 | | 'default' => 0, | | 40 | | 'size' => 'tiny', | | 41 | | 'description' => t('Weight of filter within format.'), | | 42 | | ) | | 43 | | ), | | 44 | | 'primary key' => array('fid'), | | 45 | | 'unique keys' => array( | | 46 | | 'fmd' => array('format', 'module', 'delta'), | | 47 | | ), | | 48 | | 'indexes' => array( | | 49 | | 'list' => array('format', 'weight', 'module', 'delta'), | | 50 | | ), | | 51 | | ); | | 52 | | $schema['filter_formats'] = array( | | 53 | 1 | 'description' => t('Stores input formats: custom groupings of filters, such as Filtered HTML.'), | | 54 | | 'fields' => array( | | 55 | | 'format' => array( | | 56 | | 'type' => 'serial', | | 57 | | 'not null' => TRUE, | | 58 | | 'description' => t('Primary Key: Unique ID for format.'), | | 59 | | ), | | 60 | | 'name' => array( | | 61 | | 'type' => 'varchar', | | 62 | | 'length' => 255, | | 63 | | 'not null' => TRUE, | | 64 | | 'default' => '', | | 65 | | 'description' => t('Name of the input format (Filtered HTML).'), | | 66 | | ), | | 67 | | 'roles' => array( | | 68 | | 'type' => 'varchar', | | 69 | | 'length' => 255, | | 70 | | 'not null' => TRUE, | | 71 | | 'default' => '', | | 72 | | 'description' => t('A comma-separated string of roles; references {role}.rid.'), // This is bad since you can't use joins, nor index. | | 73 | | ), | | 74 | | 'cache' => array( | | 75 | | 'type' => 'int', | | 76 | | 'not null' => TRUE, | | 77 | | 'default' => 0, | | 78 | | 'size' => 'tiny', | | 79 | | 'description' => t('Flag to indicate whether format is cachable. (1 = cachable, 0 = not cachable)'), | | 80 | | ), | | 81 | | 'weight' => array( | | 82 | | 'type' => 'int', | | 83 | | 'not null' => TRUE, | | 84 | | 'default' => 0, | | 85 | | 'size' => 'tiny', | | 86 | | 'description' => t('Weight of input format to use when listing.'), | | 87 | | ) | | 88 | | ), | | 89 | | 'primary key' => array('format'), | | 90 | | 'unique keys' => array( | | 91 | | 'name' => array('name'), | | 92 | | ), | | 93 | | ); | | 94 | | | | 95 | 1 | $schema['cache_filter'] = drupal_get_schema_unprocessed('system', 'cache'); | | 96 | 1 | $schema['cache_filter']['description'] = t('Cache table for the Filter module to store already filtered pieces of text, identified by input format and md5 hash of the text.'); | | 97 | | | | 98 | 1 | return $schema; | | 99 | | } | | 100 | | | | 101 | | /** | | 102 | | * Add a weight column to the filter formats table. | | 103 | | */ | | 104 | | function filter_update_7000() { | | 105 | | $ret = array(); | | 106 | | db_add_field($ret, 'filter_formats', 'weight', array('type' => 'int', 'not null' => TRUE, 'default' => 0, 'size' => 'tiny')); | | 107 | | return $ret; | | 108 | | } |
|