| Conditions | 6 |
| Paths | 10 |
| Total Lines | 25 |
| Code Lines | 13 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 26 | public function up() |
||
| 27 | { |
||
| 28 | $this->info( 'Creating index schema', 'vv' ); |
||
| 29 | $db = $this->db( 'db-product' ); |
||
| 30 | |||
| 31 | foreach( $this->paths( 'default/schema/index.php' ) as $filepath ) |
||
| 32 | { |
||
| 33 | if( ( $list = include( $filepath ) ) === false ) { |
||
| 34 | throw new \RuntimeException( sprintf( 'Unable to get schema from file "%1$s"', $filepath ) ); |
||
| 35 | } |
||
| 36 | |||
| 37 | foreach( $list['table'] ?? [] as $name => $fcn ) { |
||
| 38 | $db->table( $name, $fcn ); |
||
| 39 | } |
||
| 40 | } |
||
| 41 | |||
| 42 | $db->up(); |
||
| 43 | |||
| 44 | if( !$db->hasIndex( 'mshop_index_text', 'idx_msindte_content' ) ) |
||
| 45 | { |
||
| 46 | $db->for( 'mysql', 'CREATE FULLTEXT INDEX `idx_msindte_content` ON `mshop_index_text` (`content`)' ); |
||
| 47 | |||
| 48 | try { |
||
| 49 | $db->for( 'postgresql', 'CREATE INDEX "idx_msindte_content" ON "mshop_index_text" USING GIN (to_tsvector(\'english\', "content"))' ); |
||
| 50 | } catch( \Exception $e ) { |
||
| 51 | // Doctrine DBAL bug: https://github.com/doctrine/dbal/issues/5351 |
||
| 56 |