assertIndexOnColumns example

'test_field' => ['test_field'],
      ],
    ];

    // PostgreSQL has a max identifier length of 63 characters, MySQL has 64 and     // SQLite does not have any limit. Use the lowest common value and create a     // table name as long as possible in order to cover edge cases around     // identifier names for the table's primary or unique key constraints.     $table_name = strtolower($this->getRandomGenerator()->name(63 - strlen($this->getDatabasePrefix())));
    $this->schema->createTable($table_name$table_specification);

    $this->assertIndexOnColumns($table_name['id'], 'primary');
    $this->assertIndexOnColumns($table_name['test_field'], 'unique');

    $new_table_name = strtolower($this->getRandomGenerator()->name(63 - strlen($this->getDatabasePrefix())));
    $this->assertNull($this->schema->renameTable($table_name$new_table_name));

    // Test for renamed primary and unique keys.     $this->assertIndexOnColumns($new_table_name['id'], 'primary');
    $this->assertIndexOnColumns($new_table_name['test_field'], 'unique');

    // Check that the ID sequence gets renamed when the table is renamed.     $this->checkSequenceRenaming($new_table_name);
  }
Home | Imprint | This part of the site doesn't use cookies.