Skip to content

Commit 55463f8

Browse files
authored
IBX-9941: Renamed core database schema (#541)
1 parent cad65d1 commit 55463f8

172 files changed

Lines changed: 2485 additions & 2210 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

data/mysql/cleandata.sql

Lines changed: 31 additions & 31 deletions
Large diffs are not rendered by default.

data/postgresql/cleandata.sql

Lines changed: 62 additions & 62 deletions
Large diffs are not rendered by default.

src/bundle/Core/Command/CleanupVersionsCommand.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
use Ibexa\Contracts\Core\Repository\Repository;
1414
use Ibexa\Contracts\Core\Repository\Values\Content\VersionInfo;
1515
use Ibexa\Core\Base\Exceptions\InvalidArgumentException;
16+
use Ibexa\Core\Persistence\Legacy\Content\Gateway;
17+
use Ibexa\Core\Persistence\Legacy\Content\Type\Gateway as ContentTypeGateway;
1618
use Symfony\Component\Console\Attribute\AsCommand;
1719
use Symfony\Component\Console\Command\Command;
1820
use Symfony\Component\Console\Helper\ProgressBar;
@@ -247,9 +249,9 @@ protected function getObjectsIds($keep, $status, $excludedContentTypes = [])
247249
{
248250
$query = $this->connection->createQueryBuilder()
249251
->select('c.id')
250-
->from('ezcontentobject', 'c')
251-
->join('c', 'ezcontentobject_version', 'v', 'v.contentobject_id = c.id')
252-
->join('c', 'ezcontentclass', 'cl', 'cl.id = c.contentclass_id')
252+
->from(Gateway::CONTENT_ITEM_TABLE, 'c')
253+
->join('c', Gateway::CONTENT_VERSION_TABLE, 'v', 'v.contentobject_id = c.id')
254+
->join('c', ContentTypeGateway::CONTENT_TYPE_TABLE, 'cl', 'cl.id = c.contentclass_id')
253255
->groupBy('c.id', 'v.status')
254256
->having('count(c.id) > :keep');
255257
$query->setParameter('keep', $keep);

src/bundle/Core/Command/UpdateTimestampsToUTCCommand.php

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
use DateTime;
1212
use DateTimeZone;
1313
use Doctrine\DBAL\Connection;
14+
use Ibexa\Core\Persistence\Legacy\Content\Gateway;
1415
use RuntimeException;
1516
use Symfony\Component\Console\Attribute\AsCommand;
1617
use Symfony\Component\Console\Command\Command;
@@ -295,8 +296,8 @@ protected function getTimestampBasedFields($offset, $limit)
295296
$query = $this->connection->createQueryBuilder();
296297
$query
297298
->select('a.id, a.version, a.data_int')
298-
->from('ezcontentobject_attribute', 'a')
299-
->join('a', 'ezcontentobject_version', 'v', 'a.contentobject_id = v.contentobject_id')
299+
->from(Gateway::CONTENT_FIELD_TABLE, 'a')
300+
->join('a', Gateway::CONTENT_VERSION_TABLE, 'v', 'a.contentobject_id = v.contentobject_id')
300301
->where(
301302
$query->expr()->in(
302303
'a.data_type_string',
@@ -335,8 +336,8 @@ protected function countTimestampBasedFields(): int
335336
$query = $this->connection->createQueryBuilder();
336337
$query
337338
->select('count(*) as count')
338-
->from('ezcontentobject_attribute', 'a')
339-
->join('a', 'ezcontentobject_version', 'v', 'a.contentobject_id = v.contentobject_id')
339+
->from(Gateway::CONTENT_FIELD_TABLE, 'a')
340+
->join('a', Gateway::CONTENT_VERSION_TABLE, 'v', 'a.contentobject_id = v.contentobject_id')
340341
->where(
341342
$query->expr()->in(
342343
'a.data_type_string',
@@ -462,7 +463,7 @@ protected function updateTimestampToUTC(
462463
) {
463464
$query = $this->connection->createQueryBuilder();
464465
$query
465-
->update('ezcontentobject_attribute', 'a')
466+
->update(Gateway::CONTENT_FIELD_TABLE, 'a')
466467
->set('a.data_int', $newTimestamp)
467468
->set('a.sort_key_int', $newTimestamp)
468469
->where('a.id = :id')

src/bundle/Core/Command/VirtualFieldDuplicateFixCommand.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
namespace Ibexa\Bundle\Core\Command;
1010

1111
use Doctrine\DBAL\Connection;
12+
use Ibexa\Core\Persistence\Legacy\Content\Gateway;
1213
use Symfony\Component\Console\Attribute\AsCommand;
1314
use Symfony\Component\Console\Command\Command;
1415
use Symfony\Component\Console\Input\InputInterface;
@@ -162,7 +163,7 @@ private function getDuplicatedAttributeTotalCount(
162163
$query = $this->connection->createQueryBuilder()
163164
->select('COUNT(a.id) as instances')
164165
->groupBy('version', 'contentclassattribute_id', 'contentobject_id', 'language_id')
165-
->from('ezcontentobject_attribute', 'a')
166+
->from(Gateway::CONTENT_FIELD_TABLE, 'a')
166167
->having('instances > 1');
167168

168169
$count = (int) $query->executeQuery()->rowCount();
@@ -195,7 +196,7 @@ private function getDuplicatedAttributesBatch(int $batchSize): array
195196
$query
196197
->select('version', 'contentclassattribute_id', 'contentobject_id', 'language_id')
197198
->groupBy('version', 'contentclassattribute_id', 'contentobject_id', 'language_id')
198-
->from('ezcontentobject_attribute')
199+
->from(Gateway::CONTENT_FIELD_TABLE)
199200
->having('COUNT(id) > 1')
200201
->setFirstResult(0)
201202
->setMaxResults($batchSize);
@@ -219,7 +220,7 @@ private function getDuplicatedAttributeIds(array $attribute): array
219220

220221
$query
221222
->select('id')
222-
->from('ezcontentobject_attribute')
223+
->from(Gateway::CONTENT_FIELD_TABLE)
223224
->andWhere('version = :version')
224225
->andWhere('contentclassattribute_id = :contentclassattribute_id')
225226
->andWhere('contentobject_id = :contentobject_id')
@@ -256,7 +257,7 @@ private function deleteAttributes(array $ids): int
256257
$query = $this->connection->createQueryBuilder();
257258

258259
$query
259-
->delete('ezcontentobject_attribute')
260+
->delete(Gateway::CONTENT_FIELD_TABLE)
260261
->andWhere($query->expr()->in('id', array_map('strval', $ids)));
261262

262263
return (int)$query->executeStatement();

src/bundle/Core/Imagine/VariationPurger/LegacyStorageImageFileList.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
use Ibexa\Core\IO\IOConfigProvider;
1212

1313
/**
14-
* Iterator for entries in legacy's ezimagefile table.
14+
* Iterator for entries in legacy's ibexa_image_file table.
1515
*
1616
* The returned items are id of Image BinaryFile (ibexa-mountains/mount-aconcagua/605-1-eng-GB/Mount-Aconcagua.jpg).
1717
*/

src/bundle/Core/Imagine/VariationPurger/LegacyStorageImageFileRowReader.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
use Doctrine\DBAL\Connection;
1111
use Doctrine\DBAL\Result;
12+
use Ibexa\Core\FieldType\Image\ImageStorage\Gateway\DoctrineStorage;
1213
use LogicException;
1314

1415
class LegacyStorageImageFileRowReader implements ImageFileRowReader
@@ -26,7 +27,7 @@ public function __construct(Connection $connection)
2627
public function init()
2728
{
2829
$selectQuery = $this->connection->createQueryBuilder();
29-
$selectQuery->select('filepath')->from('ezimagefile');
30+
$selectQuery->select('filepath')->from(DoctrineStorage::IMAGE_FILE_TABLE);
3031
$this->result = $selectQuery->executeQuery();
3132
}
3233

0 commit comments

Comments
 (0)