Version 1
[yaffs-website] / web / core / modules / system / tests / modules / module_test / module_test.install
1 <?php
2
3 /**
4  * @file
5  * Install, update and uninstall functions for the module_test module.
6  */
7
8 /**
9  * Implements hook_schema().
10  */
11 function module_test_schema() {
12   $schema['module_test'] = [
13     'description' => 'Dummy table to test the behavior of hook_schema() during module installation.',
14     'fields' => [
15       'data' => [
16         'type' => 'varchar',
17         'length' => 255,
18         'not null' => TRUE,
19         'default' => '',
20         'description' => 'An example data column for the module.',
21       ],
22     ],
23   ];
24   return $schema;
25 }
26
27 /**
28  * Implements hook_install().
29  */
30 function module_test_install() {
31   $schema = drupal_get_module_schema('module_test', 'module_test');
32   db_insert('module_test')
33     ->fields([
34       'data' => $schema['fields']['data']['type'],
35     ])
36     ->execute();
37 }