Skip to content

Commit 748a373

Browse files
committed
Fixed database migrations
1 parent b1ff3cc commit 748a373

4 files changed

Lines changed: 37 additions & 4 deletions

File tree

.env

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ DEFAULT_URI='https://itksites.local.itkdev.dk/'
3030
# IMPORTANT: You MUST configure your server version, either here or in config/packages/doctrine.yaml
3131
#
3232
# DATABASE_URL="sqlite:///%kernel.project_dir%/var/data.db"
33-
DATABASE_URL="mysql://root:password@mariadb:3306/db?serverVersion=10.5.13-MariaDB"
33+
DATABASE_URL="mysql://root:password@mariadb:3306/db?serverVersion=10.11.9-MariaDB"
3434
###< doctrine/doctrine-bundle ###
3535

3636
###> nelmio/cors-bundle ###

.github/workflows/pr.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,15 +52,15 @@ jobs:
5252
validate-doctrine-schema:
5353
runs-on: ubuntu-latest
5454
env:
55-
DATABASE_URL: mysql://db:db@127.0.0.1:3306/db?serverVersion=mariadb-10.5.0
55+
DATABASE_URL: mysql://db:db@127.0.0.1:3306/db?serverVersion=10.11.0-mariadb
5656
strategy:
5757
fail-fast: false
5858
matrix:
5959
php: ["8.3"]
6060
name: Validate Doctrine Schema (PHP ${{ matrix.php}})
6161
services:
6262
mariadb:
63-
image: mariadb:10.5
63+
image: mariadb:10.11
6464
env:
6565
MYSQL_USER: db
6666
MYSQL_PASSWORD: db
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
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 Version20241011114819 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 sources sources JSON NOT NULL COMMENT \'(DC2Type:json)\'');
24+
$this->addSql('ALTER TABLE user CHANGE roles roles JSON NOT NULL COMMENT \'(DC2Type:json)\'');
25+
}
26+
27+
public function down(Schema $schema): void
28+
{
29+
// this down() migration is auto-generated, please modify it to your needs
30+
$this->addSql('ALTER TABLE user CHANGE roles roles JSON NOT NULL COMMENT \'(DC2Type:json)\'');
31+
$this->addSql('ALTER TABLE advisory CHANGE sources sources JSON NOT NULL COMMENT \'(DC2Type:json)\'');
32+
}
33+
}

src/Entity/Advisory.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class Advisory extends AbstractBaseEntity
3333
#[ORM\Column]
3434
private ?\DateTimeImmutable $reportedAt = null;
3535

36-
#[ORM\Column]
36+
#[ORM\Column(type: "json")]
3737
private array $sources = [];
3838

3939
#[ORM\ManyToMany(targetEntity: PackageVersion::class, mappedBy: 'advisories')]

0 commit comments

Comments
 (0)