aggregator-2.x-dev/tests/fixtures/update/aggregator_2_1_0.php
tests/fixtures/update/aggregator_2_1_0.php
<?php
/**
* @file
* Contains database additions for testing Aggregator 2.1.0 upgrade paths.
*/
use Drupal\Core\Database\Database;
$connection = Database::getConnection();
$connection->schema()->dropTable('aggregator_feed');
$connection->schema()->dropTable('aggregator_item');
$connection->schema()->createTable('aggregator_feed', [
'fields' => [
'fid' => [
'type' => 'serial',
'not null' => TRUE,
'size' => 'normal',
'unsigned' => TRUE,
],
'uuid' => [
'type' => 'varchar_ascii',
'not null' => TRUE,
'length' => '128',
],
'langcode' => [
'type' => 'varchar_ascii',
'not null' => TRUE,
'length' => '12',
],
'title' => [
'type' => 'varchar',
'not null' => TRUE,
'length' => '255',
],
'url' => [
'type' => 'varchar',
'not null' => TRUE,
'length' => '2048',
],
'refresh' => [
'type' => 'int',
'not null' => FALSE,
'size' => 'normal',
],
'checked' => [
'type' => 'int',
'not null' => FALSE,
'size' => 'normal',
],
'queued' => [
'type' => 'int',
'not null' => TRUE,
'size' => 'normal',
],
'link' => [
'type' => 'varchar',
'not null' => FALSE,
'length' => '2048',
],
'description' => [
'type' => 'text',
'not null' => FALSE,
'size' => 'big',
],
'image' => [
'type' => 'varchar',
'not null' => FALSE,
'length' => '2048',
],
'etag' => [
'type' => 'varchar',
'not null' => FALSE,
'length' => '255',
],
'modified' => [
'type' => 'int',
'not null' => FALSE,
'size' => 'normal',
],
],
'primary key' => [
'fid',
],
'unique keys' => [
'aggregator_feed_field__uuid__value' => [
'uuid',
],
],
'indexes' => [
'aggregator_feed_field__title' => [
[
'title',
'191',
],
],
'aggregator_feed_field__url' => [
[
'url',
'191',
],
],
'aggregator_feed_field__refresh__value' => [
'refresh',
],
'aggregator_feed_field__queued' => [
'queued',
],
],
'mysql_character_set' => 'utf8mb4',
]);
$connection->schema()->createTable('aggregator_item', [
'fields' => [
'iid' => [
'type' => 'serial',
'not null' => TRUE,
'size' => 'normal',
'unsigned' => TRUE,
],
'langcode' => [
'type' => 'varchar_ascii',
'not null' => TRUE,
'length' => '12',
],
'fid' => [
'type' => 'int',
'not null' => FALSE,
'size' => 'normal',
'unsigned' => TRUE,
],
'title' => [
'type' => 'varchar',
'not null' => FALSE,
'length' => '255',
],
'link' => [
'type' => 'varchar',
'not null' => FALSE,
'length' => '2048',
],
'author' => [
'type' => 'varchar',
'not null' => FALSE,
'length' => '255',
],
'description' => [
'type' => 'text',
'not null' => FALSE,
'size' => 'big',
],
'timestamp' => [
'type' => 'int',
'not null' => TRUE,
'size' => 'normal',
],
'guid' => [
'type' => 'text',
'not null' => FALSE,
'size' => 'big',
],
'uuid' => [
'type' => 'varchar_ascii',
'not null' => FALSE,
'length' => '128',
],
],
'primary key' => [
'iid',
],
'unique keys' => [
'aggregator_item_field__uuid__value' => [
'uuid',
],
],
'indexes' => [
'aggregator_item_field__fid__target_id' => [
'fid',
],
'aggregator_item_field__timestamp' => [
'timestamp',
],
],
'mysql_character_set' => 'utf8mb4',
]);
$connection->delete('config')
->condition('name', 'aggregator.settings')
->execute();
$connection->delete('config')
->condition('name', 'views.view.aggregator_rss_feed')
->execute();
$connection->insert('config')
->fields([
'collection',
'name',
'data',
])
->values([
'collection' => '',
'name' => 'aggregator.settings',
'data' => 'a:6:{s:5:"_core";a:1:{s:19:"default_config_hash";s:43:"oqQElnvorzLoHb68o4B3zFkGuMV5_GQEGi7pHfUseVM";}s:7:"fetcher";s:10:"aggregator";s:6:"parser";s:10:"aggregator";s:10:"processors";a:1:{i:0;s:10:"aggregator";}s:5:"items";a:1:{s:6:"expire";i:9676800;}s:6:"source";a:1:{s:8:"list_max";i:3;}}',
])
->values([
'collection' => '',
'name' => 'views.view.aggregator_rss_feed',
'data' => 'a:11:{s:8:"langcode";s:2:"en";s:6:"status";b:1;s:12:"dependencies";a:2:{s:6:"config";a:1:{i:0;s:45:"core.entity_view_mode.aggregator_item.summary";}s:6:"module";a:2:{i:0;s:10:"aggregator";i:1;s:4:"user";}}s:2:"id";s:19:"aggregator_rss_feed";s:5:"label";s:19:"Aggregator RSS feed";s:6:"module";s:10:"aggregator";s:11:"description";s:0:"";s:3:"tag";s:10:"aggregator";s:10:"base_table";s:15:"aggregator_item";s:10:"base_field";s:3:"iid";s:7:"display";a:2:{s:7:"default";a:6:{s:2:"id";s:7:"default";s:13:"display_title";s:7:"Default";s:14:"display_plugin";s:7:"default";s:8:"position";i:0;s:15:"display_options";a:17:{s:5:"title";s:19:"Aggregator RSS feed";s:6:"fields";a:0:{}s:5:"pager";a:2:{s:4:"type";s:4:"full";s:7:"options";a:7:{s:6:"offset";i:0;s:14:"items_per_page";i:10;s:11:"total_pages";i:0;s:2:"id";i:0;s:4:"tags";a:4:{s:4:"next";s:8:"Next ›";s:8:"previous";s:12:"‹ Previous";s:5:"first";s:8:"« First";s:4:"last";s:7:"Last »";}s:6:"expose";a:7:{s:14:"items_per_page";b:0;s:20:"items_per_page_label";s:14:"Items per page";s:22:"items_per_page_options";s:13:"5, 10, 25, 50";s:26:"items_per_page_options_all";b:0;s:32:"items_per_page_options_all_label";s:7:"- All -";s:6:"offset";b:0;s:12:"offset_label";s:6:"Offset";}s:8:"quantity";i:9;}}s:12:"exposed_form";a:2:{s:4:"type";s:5:"basic";s:7:"options";a:7:{s:13:"submit_button";s:5:"Apply";s:12:"reset_button";b:0;s:18:"reset_button_label";s:5:"Reset";s:19:"exposed_sorts_label";s:7:"Sort by";s:17:"expose_sort_order";b:1;s:14:"sort_asc_label";s:3:"Asc";s:15:"sort_desc_label";s:4:"Desc";}}s:6:"access";a:2:{s:4:"type";s:4:"perm";s:7:"options";a:1:{s:4:"perm";s:17:"access news feeds";}}s:5:"cache";a:2:{s:4:"type";s:3:"tag";s:7:"options";a:0:{}}s:5:"empty";a:0:{}s:5:"sorts";a:1:{s:9:"timestamp";a:13:{s:2:"id";s:9:"timestamp";s:5:"table";s:15:"aggregator_item";s:5:"field";s:9:"timestamp";s:12:"relationship";s:4:"none";s:10:"group_type";s:5:"group";s:11:"admin_label";s:0:"";s:11:"entity_type";s:15:"aggregator_item";s:12:"entity_field";s:9:"timestamp";s:9:"plugin_id";s:4:"date";s:5:"order";s:4:"DESC";s:6:"expose";a:2:{s:5:"label";s:0:"";s:16:"field_identifier";s:0:"";}s:7:"exposed";b:0;s:11:"granularity";s:6:"second";}}s:9:"arguments";a:0:{}s:7:"filters";a:0:{}s:5:"style";a:1:{s:4:"type";s:7:"default";}s:3:"row";a:1:{s:4:"type";s:22:"entity:aggregator_item";}s:5:"query";a:2:{s:4:"type";s:11:"views_query";s:7:"options";a:5:{s:13:"query_comment";s:0:"";s:19:"disable_sql_rewrite";b:0;s:8:"distinct";b:0;s:7:"replica";b:0;s:10:"query_tags";a:0:{}}}s:13:"relationships";a:0:{}s:6:"header";a:0:{}s:6:"footer";a:0:{}s:17:"display_extenders";a:0:{}}s:14:"cache_metadata";a:4:{s:7:"max-age";i:-1;s:8:"contexts";a:4:{i:0;s:26:"languages:language_content";i:1;s:28:"languages:language_interface";i:2;s:14:"url.query_args";i:3;s:16:"user.permissions";}s:4:"tags";a:0:{}s:9:"cacheable";b:0;}}s:10:"feed_items";a:6:{s:2:"id";s:10:"feed_items";s:13:"display_title";s:4:"Feed";s:14:"display_plugin";s:4:"feed";s:8:"position";i:1;s:15:"display_options";a:1:{s:3:"row";a:2:{s:4:"type";s:14:"aggregator_rss";s:7:"options";a:2:{s:12:"relationship";s:4:"none";s:9:"view_mode";s:7:"summary";}}}s:14:"cache_metadata";a:4:{s:7:"max-age";i:-1;s:8:"contexts";a:3:{i:0;s:26:"languages:language_content";i:1;s:28:"languages:language_interface";i:2;s:16:"user.permissions";}s:4:"tags";a:0:{}s:9:"cacheable";b:0;}}}}',
])
->execute();
$connection->delete('key_value')
->condition('collection', 'entity.definitions.installed')
->condition('name', 'aggregator_feed.entity_type')
->execute();
$connection->delete('key_value')
->condition('collection', 'entity.definitions.installed')
->condition('name', 'aggregator_feed.field_storage_definitions')
->execute();
$connection->delete('key_value')
->condition('collection', 'entity.definitions.installed')
->condition('name', 'aggregator_item.entity_type')
->execute();
$connection->delete('key_value')
->condition('collection', 'entity.definitions.installed')
->condition('name', 'aggregator_item.field_storage_definitions')
->execute();
$connection->delete('key_value')
->condition('collection', 'entity.storage_schema.sql')
->condition('name', 'aggregator_feed.field_schema_data.hash')
->execute();
$connection->delete('key_value')
->condition('collection', 'system.schema')
->condition('name', 'aggregator')
->execute();
$connection->insert('key_value')
->fields([
'collection',
'name',
'value',
])
->values([
'collection' => 'entity.definitions.installed',
'name' => 'aggregator_feed.entity_type',
'value' => 'O:36:"Drupal\Core\Entity\ContentEntityType":40:{s:5:"