Skip to content

Commit b994469

Browse files
committed
TASK: Add a core migration to update the field names
1 parent d7299b5 commit b994469

1 file changed

Lines changed: 55 additions & 0 deletions

File tree

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
<?php
2+
declare(strict_types=1);
3+
4+
namespace Neos\Flow\Core\Migrations;
5+
6+
/*
7+
* This file is part of the Flowpack.ElasticSearch.ContentRepositoryAdaptor package.
8+
*
9+
* (c) Contributors of the Neos Project - www.neos.io
10+
*
11+
* This package is Open Source Software. For the full copyright and license
12+
* information, please view the LICENSE file which was distributed with this
13+
* source code.
14+
*/
15+
16+
/**
17+
* Rename elasticsearch fields to beats convention
18+
*/
19+
class Version20200513223401 extends AbstractMigration
20+
{
21+
/**
22+
* @return string
23+
*/
24+
public function getIdentifier()
25+
{
26+
return 'Flowpack.ElasticSearch.ContentRepositoryAdaptor-20200513223401';
27+
}
28+
29+
/**
30+
* @return void
31+
*/
32+
public function up()
33+
{
34+
$fieldMapping = [
35+
'__identifier' => 'neos_node_identifier',
36+
'__parentPath' => 'neos_parent_path ',
37+
'__path' => 'neos_path',
38+
'__typeAndSupertypes' => 'neos_type_and_supertypes',
39+
'__workspace' => 'neos_workspace',
40+
'_creationDateTime' => 'neos_creation_date_time',
41+
'_hidden' => 'neos_hidden',
42+
'_hiddenBeforeDateTime' => 'neos_hidden_before_datetime',
43+
'_hiddenAfterDateTime' => 'neos_hidden_after_datetime',
44+
'_hiddenInIndex' => 'neos_hidden_in_index',
45+
'_lastModificationDateTime' => 'neos_last_modification_date_time',
46+
'_lastPublicationDateTime' => 'neos_last_publication_date_time',
47+
'__fulltextParts' => 'neos_fulltext_parts',
48+
'__fulltext' => 'neos_fulltext',
49+
];
50+
51+
foreach ($fieldMapping as $search => $replace) {
52+
$this->searchAndReplace($search, $replace, ['php', 'yaml', 'fusion']);
53+
}
54+
}
55+
}

0 commit comments

Comments
 (0)