Skip to content

Commit 405c437

Browse files
committed
3571: Update doctrine to ORM/3, DBAL/4
1 parent 9c08a88 commit 405c437

23 files changed

Lines changed: 224 additions & 274 deletions

composer.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@
88
"ext-ctype": "*",
99
"ext-iconv": "*",
1010
"api-platform/core": "^4.0",
11-
"doctrine/dbal": "^3",
11+
"doctrine/dbal": "^4.0",
1212
"doctrine/doctrine-bundle": "^2.13",
13-
"doctrine/doctrine-migrations-bundle": "^3.3",
14-
"doctrine/orm": "^2.20",
13+
"doctrine/doctrine-migrations-bundle": "^3.4",
14+
"doctrine/orm": "^3.0",
1515
"easycorp/easyadmin-bundle": "^4.0",
1616
"itk-dev/openid-connect-bundle": "^4.0",
1717
"itk-dev/vault-bundle": "^0.1.0",
1818
"nelmio/cors-bundle": "^2.2",
19-
"ocramius/doctrine-batch-utils": "^2.3",
19+
"ocramius/doctrine-batch-utils": "^2.8",
2020
"phpdocumentor/reflection-docblock": "^5.3",
2121
"phpstan/phpdoc-parser": "^2.0",
2222
"symfony/amqp-messenger": "^7.2",
@@ -46,7 +46,7 @@
4646
"require-dev": {
4747
"ergebnis/composer-normalize": "^2.23",
4848
"friendsofphp/php-cs-fixer": "^3.6",
49-
"hautelook/alice-bundle": "^2.10",
49+
"hautelook/alice-bundle": "^2.14",
5050
"justinrainbow/json-schema": "^6.0",
5151
"phpstan/extension-installer": "^1.4",
5252
"phpstan/phpstan": "^2.1",

composer.lock

Lines changed: 106 additions & 223 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

config/bundles.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
Symfony\Bundle\TwigBundle\TwigBundle::class => ['all' => true],
88
Symfony\Bundle\SecurityBundle\SecurityBundle::class => ['all' => true],
99
Doctrine\Bundle\DoctrineBundle\DoctrineBundle::class => ['all' => true],
10-
Doctrine\Bundle\MigrationsBundle\DoctrineMigrationsBundle::class => ['all' => true],
1110
Nelmio\CorsBundle\NelmioCorsBundle::class => ['all' => true],
1211
ApiPlatform\Symfony\Bundle\ApiPlatformBundle::class => ['all' => true],
1312
Symfony\Bundle\MakerBundle\MakerBundle::class => ['dev' => true],
@@ -23,4 +22,5 @@
2322
ItkDev\VaultBundle\ItkDevVaultBundle::class => ['all' => true],
2423
Twig\Extra\TwigExtraBundle\TwigExtraBundle::class => ['all' => true],
2524
Symfony\UX\TwigComponent\TwigComponentBundle::class => ['all' => true],
25+
Doctrine\Bundle\MigrationsBundle\DoctrineMigrationsBundle::class => ['all' => true],
2626
];

docker-compose.override.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,5 @@ services:
1414
node:
1515
image: node:20
1616
volumes:
17-
- .:/app:delegated
17+
- .:/app
1818
working_dir: /app
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace DoctrineMigrations;
6+
7+
use Doctrine\DBAL\Schema\Schema;
8+
use Doctrine\Migrations\AbstractMigration;
9+
10+
/**
11+
* Auto-generated Migration: Please modify to your needs!
12+
*/
13+
final class Version20250116213800 extends AbstractMigration
14+
{
15+
public function getDescription(): string
16+
{
17+
return '';
18+
}
19+
20+
public function up(Schema $schema): void
21+
{
22+
// this up() migration is auto-generated, please modify it to your needs
23+
$this->addSql('ALTER TABLE advisory CHANGE id id BINARY(16) NOT NULL, CHANGE package_id package_id BINARY(16) NOT NULL, CHANGE reported_at reported_at DATETIME NOT NULL, CHANGE sources sources JSON NOT NULL, CHANGE created_at created_at DATETIME NOT NULL, CHANGE modified_at modified_at DATETIME NOT NULL');
24+
$this->addSql('ALTER TABLE detection_result CHANGE id id BINARY(16) NOT NULL, CHANGE server_id server_id BINARY(16) NOT NULL, CHANGE created_at created_at DATETIME NOT NULL, CHANGE modified_at modified_at DATETIME NOT NULL, CHANGE last_contact last_contact DATETIME NOT NULL');
25+
$this->addSql('ALTER TABLE docker_image CHANGE id id BINARY(16) NOT NULL, CHANGE created_at created_at DATETIME NOT NULL, CHANGE modified_at modified_at DATETIME NOT NULL');
26+
$this->addSql('ALTER TABLE docker_image_tag CHANGE id id BINARY(16) NOT NULL, CHANGE docker_image_id docker_image_id BINARY(16) NOT NULL, CHANGE created_at created_at DATETIME NOT NULL, CHANGE modified_at modified_at DATETIME NOT NULL');
27+
$this->addSql('ALTER TABLE domain CHANGE id id BINARY(16) NOT NULL, CHANGE server_id server_id BINARY(16) NOT NULL, CHANGE detection_result_id detection_result_id BINARY(16) NOT NULL, CHANGE site_id site_id BINARY(16) NOT NULL, CHANGE created_at created_at DATETIME NOT NULL, CHANGE modified_at modified_at DATETIME NOT NULL');
28+
$this->addSql('ALTER TABLE git_repo CHANGE id id BINARY(16) NOT NULL, CHANGE created_at created_at DATETIME NOT NULL, CHANGE modified_at modified_at DATETIME NOT NULL');
29+
$this->addSql('ALTER TABLE git_tag CHANGE id id BINARY(16) NOT NULL, CHANGE repo_id repo_id BINARY(16) NOT NULL, CHANGE created_at created_at DATETIME NOT NULL, CHANGE modified_at modified_at DATETIME NOT NULL');
30+
$this->addSql('ALTER TABLE installation CHANGE id id BINARY(16) NOT NULL, CHANGE server_id server_id BINARY(16) NOT NULL, CHANGE detection_result_id detection_result_id BINARY(16) NOT NULL, CHANGE created_at created_at DATETIME NOT NULL, CHANGE modified_at modified_at DATETIME NOT NULL, CHANGE git_tag_id git_tag_id BINARY(16) DEFAULT NULL');
31+
$this->addSql('ALTER TABLE installation_package_version CHANGE installation_id installation_id BINARY(16) NOT NULL, CHANGE package_version_id package_version_id BINARY(16) NOT NULL');
32+
$this->addSql('ALTER TABLE installation_module_version CHANGE installation_id installation_id BINARY(16) NOT NULL, CHANGE module_version_id module_version_id BINARY(16) NOT NULL');
33+
$this->addSql('ALTER TABLE installation_docker_image_tag CHANGE installation_id installation_id BINARY(16) NOT NULL, CHANGE docker_image_tag_id docker_image_tag_id BINARY(16) NOT NULL');
34+
$this->addSql('ALTER TABLE module CHANGE id id BINARY(16) NOT NULL, CHANGE created_at created_at DATETIME NOT NULL, CHANGE modified_at modified_at DATETIME NOT NULL');
35+
$this->addSql('ALTER TABLE module_version CHANGE id id BINARY(16) NOT NULL, CHANGE module_id module_id BINARY(16) NOT NULL, CHANGE created_at created_at DATETIME NOT NULL, CHANGE modified_at modified_at DATETIME NOT NULL');
36+
$this->addSql('ALTER TABLE oidc CHANGE id id BINARY(16) NOT NULL, CHANGE created_at created_at DATETIME NOT NULL, CHANGE modified_at modified_at DATETIME NOT NULL');
37+
$this->addSql('ALTER TABLE package CHANGE id id BINARY(16) NOT NULL, CHANGE created_at created_at DATETIME NOT NULL, CHANGE modified_at modified_at DATETIME NOT NULL');
38+
$this->addSql('ALTER TABLE package_version CHANGE id id BINARY(16) NOT NULL, CHANGE package_id package_id BINARY(16) NOT NULL, CHANGE created_at created_at DATETIME NOT NULL, CHANGE modified_at modified_at DATETIME NOT NULL');
39+
$this->addSql('ALTER TABLE package_version_advisory CHANGE package_version_id package_version_id BINARY(16) NOT NULL, CHANGE advisory_id advisory_id BINARY(16) NOT NULL');
40+
$this->addSql('ALTER TABLE server CHANGE id id BINARY(16) NOT NULL, CHANGE created_at created_at DATETIME NOT NULL, CHANGE modified_at modified_at DATETIME NOT NULL');
41+
$this->addSql('ALTER TABLE service_certificate CHANGE id id BINARY(16) NOT NULL, CHANGE created_at created_at DATETIME NOT NULL, CHANGE modified_at modified_at DATETIME NOT NULL');
42+
$this->addSql('ALTER TABLE service_certificate_service CHANGE id id BINARY(16) NOT NULL, CHANGE certificate_id certificate_id BINARY(16) NOT NULL, CHANGE created_at created_at DATETIME NOT NULL, CHANGE modified_at modified_at DATETIME NOT NULL');
43+
$this->addSql('ALTER TABLE site CHANGE id id BINARY(16) NOT NULL, CHANGE server_id server_id BINARY(16) NOT NULL, CHANGE detection_result_id detection_result_id BINARY(16) NOT NULL, CHANGE created_at created_at DATETIME NOT NULL, CHANGE modified_at modified_at DATETIME NOT NULL, CHANGE installation_id installation_id BINARY(16) NOT NULL');
44+
$this->addSql('ALTER TABLE user CHANGE id id BINARY(16) NOT NULL, CHANGE created_at created_at DATETIME NOT NULL, CHANGE modified_at modified_at DATETIME NOT NULL, CHANGE roles roles JSON NOT NULL');
45+
}
46+
47+
public function down(Schema $schema): void
48+
{
49+
// this down() migration is auto-generated, please modify it to your needs
50+
$this->addSql('ALTER TABLE site CHANGE id id BINARY(16) NOT NULL COMMENT \'(DC2Type:ulid)\', CHANGE created_at created_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', CHANGE modified_at modified_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', CHANGE server_id server_id BINARY(16) NOT NULL COMMENT \'(DC2Type:ulid)\', CHANGE detection_result_id detection_result_id BINARY(16) NOT NULL COMMENT \'(DC2Type:ulid)\', CHANGE installation_id installation_id BINARY(16) NOT NULL COMMENT \'(DC2Type:ulid)\'');
51+
$this->addSql('ALTER TABLE module_version CHANGE id id BINARY(16) NOT NULL COMMENT \'(DC2Type:ulid)\', CHANGE created_at created_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', CHANGE modified_at modified_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', CHANGE module_id module_id BINARY(16) NOT NULL COMMENT \'(DC2Type:ulid)\'');
52+
$this->addSql('ALTER TABLE service_certificate CHANGE id id BINARY(16) NOT NULL COMMENT \'(DC2Type:ulid)\', CHANGE created_at created_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', CHANGE modified_at modified_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\'');
53+
$this->addSql('ALTER TABLE user CHANGE id id BINARY(16) NOT NULL COMMENT \'(DC2Type:ulid)\', CHANGE created_at created_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', CHANGE modified_at modified_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', CHANGE roles roles JSON NOT NULL COMMENT \'(DC2Type:json)\'');
54+
$this->addSql('ALTER TABLE package_version CHANGE id id BINARY(16) NOT NULL COMMENT \'(DC2Type:ulid)\', CHANGE created_at created_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', CHANGE modified_at modified_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', CHANGE package_id package_id BINARY(16) NOT NULL COMMENT \'(DC2Type:ulid)\'');
55+
$this->addSql('ALTER TABLE package CHANGE id id BINARY(16) NOT NULL COMMENT \'(DC2Type:ulid)\', CHANGE created_at created_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', CHANGE modified_at modified_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\'');
56+
$this->addSql('ALTER TABLE docker_image_tag CHANGE id id BINARY(16) NOT NULL COMMENT \'(DC2Type:ulid)\', CHANGE created_at created_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', CHANGE modified_at modified_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', CHANGE docker_image_id docker_image_id BINARY(16) NOT NULL COMMENT \'(DC2Type:ulid)\'');
57+
$this->addSql('ALTER TABLE installation_module_version CHANGE installation_id installation_id BINARY(16) NOT NULL COMMENT \'(DC2Type:ulid)\', CHANGE module_version_id module_version_id BINARY(16) NOT NULL COMMENT \'(DC2Type:ulid)\'');
58+
$this->addSql('ALTER TABLE server CHANGE id id BINARY(16) NOT NULL COMMENT \'(DC2Type:ulid)\', CHANGE created_at created_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', CHANGE modified_at modified_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\'');
59+
$this->addSql('ALTER TABLE domain CHANGE id id BINARY(16) NOT NULL COMMENT \'(DC2Type:ulid)\', CHANGE created_at created_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', CHANGE modified_at modified_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', CHANGE server_id server_id BINARY(16) NOT NULL COMMENT \'(DC2Type:ulid)\', CHANGE detection_result_id detection_result_id BINARY(16) NOT NULL COMMENT \'(DC2Type:ulid)\', CHANGE site_id site_id BINARY(16) NOT NULL COMMENT \'(DC2Type:ulid)\'');
60+
$this->addSql('ALTER TABLE docker_image CHANGE id id BINARY(16) NOT NULL COMMENT \'(DC2Type:ulid)\', CHANGE created_at created_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', CHANGE modified_at modified_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\'');
61+
$this->addSql('ALTER TABLE service_certificate_service CHANGE id id BINARY(16) NOT NULL COMMENT \'(DC2Type:ulid)\', CHANGE created_at created_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', CHANGE modified_at modified_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', CHANGE certificate_id certificate_id BINARY(16) NOT NULL COMMENT \'(DC2Type:ulid)\'');
62+
$this->addSql('ALTER TABLE package_version_advisory CHANGE package_version_id package_version_id BINARY(16) NOT NULL COMMENT \'(DC2Type:ulid)\', CHANGE advisory_id advisory_id BINARY(16) NOT NULL COMMENT \'(DC2Type:ulid)\'');
63+
$this->addSql('ALTER TABLE installation_docker_image_tag CHANGE installation_id installation_id BINARY(16) NOT NULL COMMENT \'(DC2Type:ulid)\', CHANGE docker_image_tag_id docker_image_tag_id BINARY(16) NOT NULL COMMENT \'(DC2Type:ulid)\'');
64+
$this->addSql('ALTER TABLE installation_package_version CHANGE installation_id installation_id BINARY(16) NOT NULL COMMENT \'(DC2Type:ulid)\', CHANGE package_version_id package_version_id BINARY(16) NOT NULL COMMENT \'(DC2Type:ulid)\'');
65+
$this->addSql('ALTER TABLE git_repo CHANGE id id BINARY(16) NOT NULL COMMENT \'(DC2Type:ulid)\', CHANGE created_at created_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', CHANGE modified_at modified_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\'');
66+
$this->addSql('ALTER TABLE advisory CHANGE id id BINARY(16) NOT NULL COMMENT \'(DC2Type:ulid)\', CHANGE created_at created_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', CHANGE modified_at modified_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', CHANGE reported_at reported_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', CHANGE sources sources JSON NOT NULL COMMENT \'(DC2Type:json)\', CHANGE package_id package_id BINARY(16) NOT NULL COMMENT \'(DC2Type:ulid)\'');
67+
$this->addSql('ALTER TABLE module CHANGE id id BINARY(16) NOT NULL COMMENT \'(DC2Type:ulid)\', CHANGE created_at created_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', CHANGE modified_at modified_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\'');
68+
$this->addSql('ALTER TABLE oidc CHANGE id id BINARY(16) NOT NULL COMMENT \'(DC2Type:ulid)\', CHANGE created_at created_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', CHANGE modified_at modified_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\'');
69+
$this->addSql('ALTER TABLE installation CHANGE id id BINARY(16) NOT NULL COMMENT \'(DC2Type:ulid)\', CHANGE created_at created_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', CHANGE modified_at modified_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', CHANGE server_id server_id BINARY(16) NOT NULL COMMENT \'(DC2Type:ulid)\', CHANGE detection_result_id detection_result_id BINARY(16) NOT NULL COMMENT \'(DC2Type:ulid)\', CHANGE git_tag_id git_tag_id BINARY(16) DEFAULT NULL COMMENT \'(DC2Type:ulid)\'');
70+
$this->addSql('ALTER TABLE detection_result CHANGE id id BINARY(16) NOT NULL COMMENT \'(DC2Type:ulid)\', CHANGE created_at created_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', CHANGE modified_at modified_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', CHANGE last_contact last_contact DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', CHANGE server_id server_id BINARY(16) NOT NULL COMMENT \'(DC2Type:ulid)\'');
71+
$this->addSql('ALTER TABLE git_tag CHANGE id id BINARY(16) NOT NULL COMMENT \'(DC2Type:ulid)\', CHANGE created_at created_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', CHANGE modified_at modified_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', CHANGE repo_id repo_id BINARY(16) NOT NULL COMMENT \'(DC2Type:ulid)\'');
72+
}
73+
}

src/Entity/DetectionResult.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
)]
1919
#[ORM\Entity(repositoryClass: DetectionResultRepository::class)]
2020
#[ORM\UniqueConstraint(name: 'server_hash_idx', fields: ['server', 'hash'])]
21-
#[ORM\Index(columns: ['type'], name: 'type_idx')]
21+
#[ORM\Index(name: 'type_idx', columns: ['type'])]
2222
class DetectionResult extends AbstractBaseEntity implements \Stringable
2323
{
2424
#[ORM\Column(type: 'string', length: 255)]

src/Entity/DockerImage.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class DockerImage extends AbstractBaseEntity implements \Stringable
2222
#[ORM\Column(type: 'text')]
2323
private string $description = '';
2424

25-
#[ORM\OneToMany(mappedBy: 'dockerImage', targetEntity: DockerImageTag::class, orphanRemoval: true)]
25+
#[ORM\OneToMany(targetEntity: DockerImageTag::class, mappedBy: 'dockerImage', orphanRemoval: true)]
2626
private Collection $dockerImageTags;
2727

2828
public function __construct()

src/Entity/GitRepo.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class GitRepo extends AbstractBaseEntity implements \Stringable
2222
#[ORM\Column(length: 255)]
2323
private string $repo = '';
2424

25-
#[ORM\OneToMany(mappedBy: 'repo', targetEntity: GitTag::class, cascade: ['persist'])]
25+
#[ORM\OneToMany(targetEntity: GitTag::class, mappedBy: 'repo', cascade: ['persist'])]
2626
private Collection $gitTags;
2727

2828
public function __construct()

src/Entity/GitTag.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class GitTag extends AbstractBaseEntity implements \Stringable
1919
#[ORM\JoinColumn(nullable: false, onDelete: 'CASCADE')]
2020
private GitRepo $repo;
2121

22-
#[ORM\OneToMany(mappedBy: 'gitTag', targetEntity: Installation::class)]
22+
#[ORM\OneToMany(targetEntity: Installation::class, mappedBy: 'gitTag')]
2323
private Collection $installations;
2424

2525
public function __toString(): string

src/Entity/Installation.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
#[ORM\UniqueConstraint(name: 'server_rootdir_idx', fields: ['server', 'rootDir'])]
2323
class Installation extends AbstractHandlerResult implements \Stringable
2424
{
25-
#[ORM\OneToMany(mappedBy: 'installation', targetEntity: Site::class)]
25+
#[ORM\OneToMany(targetEntity: Site::class, mappedBy: 'installation')]
2626
private Collection $sites;
2727

2828
#[ORM\Column(type: 'string', length: 10, nullable: true)]

0 commit comments

Comments
 (0)