Newer
Older
Alex Barth
committed
Alex Barth
committed
* Schema definitions install/update/uninstall hooks.
*/
function feeds_schema() {
Alex Barth
committed
$schema = array();
$schema['feeds_importer'] = array(
'description' => 'Configuration of feeds objects.',
'export' => array(
'key' => 'id',
Alex Barth
committed
'identifier' => 'feeds_importer',
'default hook' => 'feeds_importer_default', // Function hook name.
Alex Barth
committed
'owner' => 'feeds',
'api' => 'feeds_importer_default', // Base name for api include files.
'minimum_version' => 1,
'current_version' => 1,
),
),
'fields' => array(
'id' => array(
'type' => 'varchar',
Alex Barth
committed
'length' => 128,
'not null' => TRUE,
'default' => '',
'description' => 'Id of the fields object.',
),
'config' => array(
'type' => 'text',
'not null' => FALSE,
'description' => 'Configuration of the feeds object.',
'serialize' => TRUE,
),
),
Alex Barth
committed
'primary key' => array('id'),
$schema['feeds_source'] = array(
'description' => 'Source definitions for feeds.',
'fields' => array(
'id' => array(
'type' => 'varchar',
Alex Barth
committed
'length' => 128,
'not null' => TRUE,
'default' => '',
'description' => 'Id of the feed configuration.',
),
Alex Barth
committed
'feed_nid' => array(
Alex Barth
committed
'not null' => TRUE,
'default' => 0,
Alex Barth
committed
'description' => 'Node nid if this particular source is attached to a feed node.',
Alex Barth
committed
'config' => array(
Alex Barth
committed
'description' => 'Configuration of the source.',
Alex Barth
committed
'source' => array(
'type' => 'text',
'not null' => TRUE,
Alex Barth
committed
'description' => 'Main source resource identifier. E. g. a path or a URL.',
Alex Barth
committed
),
'type' => 'text',
'size' => 'big',
'not null' => FALSE,
Alex Barth
committed
'description' => 'Cache for batching.',
'description' => 'State of import or clearing batches.',
'serialize' => TRUE,
),
'fetcher_result' => array(
'type' => 'text',
'size' => 'big',
'not null' => FALSE,
'description' => 'Cache for fetcher result.',
Alex Barth
committed
'primary key' => array('id', 'feed_nid'),
Alex Barth
committed
'id' => array('id'),
'feed_nid' => array('feed_nid'),
'id_source' => array('id', array('source', 128)),
),
);
$schema['feeds_node_item'] = array(
Alex Barth
committed
'description' => 'Stores additional information about feed item nodes. Used by FeedsNodeProcessor.',
Alex Barth
committed
'fields' => array(
'nid' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
Alex Barth
committed
'description' => 'Primary Key: The feed item node\'s nid.',
Alex Barth
committed
),
'id' => array(
'type' => 'varchar',
'length' => 128,
'not null' => TRUE,
'default' => '',
'description' => 'The id of the fields object that is the producer of this item.',
),
'feed_nid' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
Alex Barth
committed
'description' => 'Node id of the owner feed, if available.',
Alex Barth
committed
),
'imported' => array(
'type' => 'int',
'not null' => TRUE,
'default' => 0,
Alex Barth
committed
'description' => 'Import date of the feed item, as a Unix timestamp.',
Alex Barth
committed
),
'url' => array(
'type' => 'text',
'not null' => TRUE,
Alex Barth
committed
'description' => 'Link to the feed item.',
Alex Barth
committed
),
'guid' => array(
'type' => 'text',
'not null' => TRUE,
Alex Barth
committed
'description' => 'Unique identifier for the feed item.'
Alex Barth
committed
),
'hash' => array(
'type' => 'varchar',
'length' => 32, // The length of an MD5 hash.
'not null' => TRUE,
'default' => '',
Alex Barth
committed
'description' => 'The hash of the item.',
Alex Barth
committed
),
'primary key' => array('nid'),
'indexes' => array(
'id' => array('id'),
'feed_nid' => array('feed_nid'),
'imported' => array('imported'),
'url' => array(array('url', 255)),
'guid' => array(array('guid', 255)),
),
$schema['feeds_term_item'] = array(
'description' => 'Tracks imported terms.',
'fields' => array(
'tid' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
'description' => 'Imported term id.',
),
'id' => array(
'type' => 'varchar',
'length' => 128,
'not null' => TRUE,
'default' => '',
'description' => 'The id of the fields object that is the creator of this item.',
),
'feed_nid' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
Alex Barth
committed
'description' => 'Node id of the owner feed, if available.',
),
),
'primary key' => array('tid'),
'indexes' => array(
'id_feed_nid' => array('id', 'feed_nid'),
'feed_nid' => array('feed_nid'),
),
);
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
$schema['feeds_push_subscriptions'] = array(
'description' => 'PubSubHubbub subscriptions.',
'fields' => array(
'domain' => array(
'type' => 'varchar',
'length' => 128,
'not null' => TRUE,
'default' => '',
'description' => 'Domain of the subscriber. Corresponds to an importer id.',
),
'subscriber_id' => array(
'type' => 'int',
'not null' => TRUE,
'default' => 0,
'unsigned' => TRUE,
'description' => 'ID of the subscriber. Corresponds to a feed nid.',
),
'timestamp' => array(
'type' => 'int',
'unsigned' => FALSE,
'default' => 0,
'not null' => TRUE,
'description' => 'Created timestamp.',
),
'hub' => array(
'type' => 'text',
'not null' => TRUE,
Alex Barth
committed
'description' => 'The URL of the hub endpoint of this subscription.',
),
'topic' => array(
'type' => 'text',
'not null' => TRUE,
Alex Barth
committed
'description' => 'The topic URL (feed URL) of this subscription.',
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
),
'secret' => array(
'type' => 'varchar',
'length' => 128,
'not null' => TRUE,
'default' => '',
'description' => 'Shared secret for message authentication.',
),
'status' => array(
'type' => 'varchar',
'length' => 64,
'not null' => TRUE,
'default' => '',
'description' => 'Status of subscription.',
),
'post_fields' => array(
'type' => 'text',
'not null' => FALSE,
'description' => 'Fields posted.',
'serialize' => TRUE,
),
),
'primary key' => array('domain', 'subscriber_id'),
'indexes' => array(
'timestamp' => array('timestamp'),
),
);
return $schema;
}
/**
* Rename feeds_source.batch to feeds_source.state, add slot for caching fetcher
* result.
*/
function feeds_update_7100(&$sandbox) {
$spec = array(
'type' => 'text',
'size' => 'big',
'not null' => FALSE,
'description' => 'State of import or clearing batches.',
'serialize' => TRUE,
);
db_change_field('feeds_source', 'batch', 'state', $spec);
$spec = array(
'type' => 'text',
'size' => 'big',
'not null' => FALSE,
'description' => 'Cache for fetcher result.',
'serialize' => TRUE,
);
db_add_field('feeds_source', 'fetcher_result', $spec);
}