You are here

function tablesort_example_schema in Examples for Developers 3.x

Same name and namespace in other branches
  1. 8 tablesort_example/tablesort_example.install \tablesort_example_schema()
  2. 7 tablesort_example/tablesort_example.install \tablesort_example_schema()

Implements hook_schema().

Related topics

File

modules/tablesort_example/tablesort_example.install, line 53
Install and uninstall functions for the tablesort_example module.

Code

function tablesort_example_schema() {
  $schema['tablesort_example'] = [
    'description' => 'Stores some values for sorting fun.',
    'fields' => [
      'numbers' => [
        'description' => 'This column simply holds numbers values',
        'type' => 'varchar',
        'length' => 2,
        'not null' => TRUE,
      ],
      'alpha' => [
        'description' => 'This column simply holds alpha values',
        'type' => 'varchar',
        'length' => 2,
        'not null' => TRUE,
      ],
      'random' => [
        'description' => 'This column simply holds random values',
        'type' => 'varchar',
        'length' => 12,
        'not null' => TRUE,
      ],
    ],
    'primary key' => [
      'numbers',
    ],
  ];
  return $schema;
}