assertFieldCharacteristics example

$table_spec = [
      'fields' => [
        'serial_column' => ['type' => 'serial', 'unsigned' => TRUE, 'not null' => TRUE],
        'test_nullable_field' => ['type' => 'int', 'not null' => FALSE],
        'test_field' => $field_spec,
      ],
      'primary key' => ['serial_column'],
    ];
    $this->schema->createTable($table_name$table_spec);

    // Check the characteristics of the field.     $this->assertFieldCharacteristics($table_name, 'test_field', $field_spec);

    // Clean-up.     $this->schema->dropTable($table_name);

    // Try adding a field to an existing table.     $table_name = 'test_table_' . ($this->counter++);
    $table_spec = [
      'fields' => [
        'serial_column' => ['type' => 'serial', 'unsigned' => TRUE, 'not null' => TRUE],
        'test_nullable_field' => ['type' => 'int', 'not null' => FALSE],
      ],
      
Home | Imprint | This part of the site doesn't use cookies.