$this->testingFakeConnection->
schema()->
addIndex('faking_table', 'test_field',
['test_field'
],
[]);
$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__idx'
])->
fetchAll();
$this->
assertCount(1,
$results);
$this->
assertSame('testing_fake',
$results[0
]->schemaname
);
$this->
assertSame($this->testingFakeConnection->
getPrefix() . 'faking_table',
$results[0
]->tablename
);
$this->
assertStringContainsString('USING btree (test_field)',
$results[0
]->indexdef
);
$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'
]);