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

Version20240528083322::down()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 6
c 1
b 0
f 0
dl 0
loc 7
ccs 0
cts 7
cp 0
rs 10
cc 1
nc 1
nop 1
crap 2
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