function SchemaTest::testRenameTableWithNameContainingDrupalUnderscoreAndMultipleIndexes

Tests renaming a table which name contains drupal_ with multiple indexes.

File

core/modules/pgsql/tests/src/Kernel/pgsql/SchemaTest.php, line 371

Class

SchemaTest
Tests schema API for the PostgreSQL driver.

Namespace

Drupal\Tests\pgsql\Kernel\pgsql

Code

public function testRenameTableWithNameContainingDrupalUnderscoreAndMultipleIndexes() : void {
  $table_name_old = 'field_drupal_foo';
  $table_name_new = 'field_drupal_bar';
  $table_specification = [
    'fields' => [
      'one' => [
        'type' => 'int',
        'default' => NULL,
      ],
      'two' => [
        'type' => 'int',
        'default' => NULL,
      ],
    ],
    'indexes' => [
      'one' => [
        'one',
      ],
      'two' => [
        'two',
      ],
    ],
  ];
  $this->schema
    ->createTable($table_name_old, $table_specification);
  $this->schema
    ->renameTable($table_name_old, $table_name_new);
  $this->assertTrue($this->schema
    ->tableExists($table_name_new));
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.