You are here

public static function ViewTestData::schemaDefinition in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/views/src/Tests/ViewTestData.php \Drupal\views\Tests\ViewTestData::schemaDefinition()

Returns the schema definition.

2 calls to ViewTestData::schemaDefinition()
ViewKernelTestBase::schemaDefinition in core/modules/views/src/Tests/ViewKernelTestBase.php
Returns the schema definition.
ViewTestBase::schemaDefinition in core/modules/views/src/Tests/ViewTestBase.php
Returns the schema definition.

File

core/modules/views/src/Tests/ViewTestData.php, line 67
Contains \Drupal\views\Tests\ViewTestData.

Class

ViewTestData
Provides tests view data and the base test schema with sample data records.

Namespace

Drupal\views\Tests

Code

public static function schemaDefinition() {
  $schema['views_test_data'] = array(
    'description' => 'Basic test table for Views tests.',
    'fields' => array(
      'id' => array(
        'type' => 'serial',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
      'name' => array(
        'description' => "A person's name",
        'type' => 'varchar_ascii',
        'length' => 255,
        'not null' => TRUE,
        'default' => '',
      ),
      'age' => array(
        'description' => "The person's age",
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ),
      'job' => array(
        'description' => "The person's job",
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'default' => 'Undefined',
      ),
      'created' => array(
        'description' => "The creation date of this record",
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ),
      'status' => array(
        'description' => "The status of this record",
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ),
    ),
    'primary key' => array(
      'id',
    ),
    'unique keys' => array(
      'name' => array(
        'name',
      ),
    ),
    'indexes' => array(
      'ages' => array(
        'age',
      ),
    ),
  );
  return $schema;
}