$this->testingFakeConnection->
schema()->
dropIndex('faking_table', 'test_field'
);
$this->
assertFalse($this->testingFakeConnection->
schema()->
indexExists('faking_table', 'test_field'
));
} /**
* @covers ::addUniqueKey
* @covers ::indexExists
* @covers ::dropUniqueKey
*/
public function testUniqueKey(): void
{ $this->testingFakeConnection->
schema()->
addUniqueKey('faking_table', 'test_field',
['test_field'
]);
// This should work, but currently indexExist() only searches for keys that end with idx.
// @todo remove comments when: https://www.drupal.org/project/drupal/issues/3325358 is committed.
// $this->assertTrue($this->testingFakeConnection->schema()->indexExists('faking_table', 'test_field'));
$results =
$this->testingFakeConnection->
query("SELECT * FROM pg_indexes WHERE indexname = :indexname",
[':indexname' =>
$this->testingFakeConnection->
getPrefix() . 'faking_table__test_field__key'
])->
fetchAll();
// Check the unique key columns.
$this->
assertCount(1,
$results);
$this->
assertSame('testing_fake',
$results[0
]->schemaname
);
$this->
assertSame($this->testingFakeConnection->
getPrefix() . 'faking_table',
$results[0
]->tablename
);