comparison core/modules/system/tests/fixtures/update/drupal-8.update-test-schema-enabled.php @ 0:c75dbcec494b

Initial commit from drush-created site
author Chris Cannam
date Thu, 05 Jul 2018 14:24:15 +0000
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:c75dbcec494b
1 <?php
2
3 /**
4 * @file
5 * Partial database to mimic the installation of the update_test_schema module.
6 */
7
8 use Drupal\Core\Database\Database;
9
10 $connection = Database::getConnection();
11
12 // Create the table.
13 $connection->schema()->createTable('update_test_schema_table', [
14 'fields' => [
15 'a' => [
16 'type' => 'int',
17 'not null' => TRUE,
18 'size' => 'normal',
19 ],
20 'b' => [
21 'type' => 'blob',
22 'not null' => FALSE,
23 'size' => 'normal',
24 ],
25 ],
26 ]);
27
28 // Set the schema version.
29 $connection->merge('key_value')
30 ->condition('collection', 'system.schema')
31 ->condition('name', 'update_test_schema')
32 ->fields([
33 'collection' => 'system.schema',
34 'name' => 'update_test_schema',
35 'value' => 'i:8000;',
36 ])
37 ->execute();
38
39 // Update core.extension.
40 $extensions = $connection->select('config')
41 ->fields('config', ['data'])
42 ->condition('collection', '')
43 ->condition('name', 'core.extension')
44 ->execute()
45 ->fetchField();
46 $extensions = unserialize($extensions);
47 $extensions['module']['update_test_schema'] = 8000;
48 $connection->update('config')
49 ->fields([
50 'data' => serialize($extensions),
51 ])
52 ->condition('collection', '')
53 ->condition('name', 'core.extension')
54 ->execute();