Passed
Push — main ( cab1bb...b51d0b )
by
unknown
01:18 queued 42s
created

Version20240528083322   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
eloc 14
c 1
b 0
f 0
dl 0
loc 22
ccs 0
cts 16
cp 0
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getDescription() 0 2 1
A up() 0 7 1
A down() 0 7 1
1
<?php
2
3
declare( strict_types = 1 );
4
5
namespace WMDE\Fundraising\AddressChangeContext\DataAccess\Migrations;
6
7
use Doctrine\DBAL\Schema\Schema;
8
use Doctrine\Migrations\AbstractMigration;
9
10
final class Version20240528083322 extends AbstractMigration {
11
12
	public function getDescription(): string {
13
		return 'Add indexes for full text search on the Address table';
14
	}
15
16
	public function up( Schema $schema ): void {
17
		$table = $schema->getTable( 'address' );
18
		$table->addIndex( [ 'first_name' ], 'idx_ac_first_name' );
19
		$table->addIndex( [ 'last_name' ], 'idx_ac_last_name' );
20
		$table->addIndex( [ 'street' ], 'idx_ac_street' );
21
		$table->addIndex( [ 'postcode' ], 'idx_ac_postcode' );
22
		$table->addIndex( [ 'city' ], 'idx_ac_city' );
23
	}
24
25
	public function down( Schema $schema ): void {
26
		$table = $schema->getTable( 'address' );
27
		$table->dropIndex( 'idx_ac_first_name' );
28
		$table->dropIndex( 'idx_ac_last_name' );
29
		$table->dropIndex( 'idx_ac_street' );
30
		$table->dropIndex( 'idx_ac_postcode' );
31
		$table->dropIndex( 'idx_ac_city' );
32
	}
33
}
34