Skip to content

Commit a12dbc4

Browse files
authored
Merge pull request #500 from os2display/release/2.8.0
Release 2.8.0
2 parents b4596b0 + fee9179 commit a12dbc4

23 files changed

Lines changed: 1103 additions & 35 deletions

.github/workflows/pr.yaml

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,70 @@ jobs:
104104
- name: Validate Doctrine schema
105105
run: APP_ENV=prod php bin/console doctrine:schema:validate
106106

107+
validate-doctrine-schema-postgres:
108+
runs-on: ubuntu-latest
109+
env:
110+
DATABASE_URL: postgresql://db:db@127.0.0.1:5432/db?serverVersion=16&charset=utf8
111+
strategy:
112+
fail-fast: false
113+
matrix:
114+
php: ["8.3"]
115+
name: Validate Doctrine Schema on Postgres (PHP ${{ matrix.php }})
116+
services:
117+
postgres:
118+
image: postgres:16-alpine
119+
env:
120+
POSTGRES_USER: db
121+
POSTGRES_PASSWORD: db
122+
POSTGRES_DB: db
123+
ports:
124+
- 5432:5432
125+
options: >-
126+
--health-cmd "pg_isready -U db -d db"
127+
--health-interval=5s
128+
--health-timeout=3s
129+
--health-retries=10
130+
steps:
131+
- name: Checkout
132+
uses: actions/checkout@v4
133+
134+
- name: Setup PHP, with composer and extensions
135+
uses: shivammathur/setup-php@v2
136+
with:
137+
php-version: ${{ matrix.php}}
138+
# pgsql/pdo_pgsql added on top of the standard extension list so
139+
# Doctrine can connect to Postgres for the portability gate.
140+
extensions: apcu, ctype, iconv, imagick, json, pdo_pgsql, pgsql, redis, soap, xmlreader, zip
141+
coverage: none
142+
143+
- name: Get composer cache directory
144+
id: composer-cache
145+
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
146+
147+
- name: Cache composer dependencies
148+
uses: actions/cache@v4
149+
with:
150+
path: ${{ steps.composer-cache.outputs.dir }}
151+
key: ${{ matrix.php }}-composer-${{ hashFiles('**/composer.lock') }}
152+
restore-keys: ${{ matrix.php }}-composer-
153+
154+
- name: 'Composer install with exported .env variables'
155+
run: |
156+
set -a && source .env && set +a
157+
APP_ENV=prod composer install --no-dev -o
158+
159+
# The 2.x historical migrations use raw MariaDB SQL and can't run on
160+
# Postgres — that's the whole reason this PR exists. We instead apply
161+
# the entity layer directly via schema:update, which tests the
162+
# load-bearing claim that the *metadata* (after the rename) is
163+
# platform-portable. doctrine:schema:validate then catches any drift
164+
# between Postgres' generated DDL and what Doctrine expects.
165+
- name: Apply entity metadata to Postgres (schema:update)
166+
run: APP_ENV=prod php bin/console doctrine:schema:update --force --complete --no-interaction
167+
168+
- name: Validate Doctrine schema (Postgres)
169+
run: APP_ENV=prod php bin/console doctrine:schema:validate
170+
107171
php-cs-fixer:
108172
runs-on: ubuntu-latest
109173
strategy:

CHANGELOG.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,23 @@ All notable changes to this project will be documented in this file.
44

55
## [Unreleased]
66

7+
## [2.8.0] - 2026-06-23
8+
9+
- [#495](https://github.com/os2display/display-api-service/pull/495)
10+
- Added `app:utils:convert-env-to-3x` command that converts the loaded configuration of a running 2.x
11+
installation (env vars + admin/client config.json) to 3.x environment configuration, with screen,
12+
dotenv and docker compose output formats.
13+
- [#486](https://github.com/os2display/display-api-service/pull/486)
14+
- Changed BRND feed area and facility filters to match on `områdeId` and `facilitetsId` instead of area/facility names.
15+
- Mapped area and facility IDs centrally in `parseBrndBooking()`.
16+
- ID filtering is only supported for BRND API v2.0; area/facility fields are hidden in admin for v1.0 feed sources.
17+
- [#444](https://github.com/os2display/display-api-service/pull/444)
18+
- Renamed 15 `changed_idx` indexes to `<table>_changed_idx` for cross-platform portability
19+
(Postgres scopes index names schema-wide).
20+
- Quoted `user` table identifier in entity metadata so Doctrine emits the platform-native quote on every reference.
21+
- Added Postgres CI gate that runs `doctrine:schema:update --force --complete` +
22+
`doctrine:schema:validate` against a Postgres 16 service container.
23+
724
## [2.7.1] - 2026-05-26
825

926
- [#460](https://github.com/os2display/display-api-service/pull/460)

README.md

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -308,6 +308,48 @@ variable](https://symfony.com/doc/current/components/phpunit_bridge.html#configu
308308
docker compose exec --env SYMFONY_DEPRECATIONS_HELPER=disabled phpfpm composer tests
309309
```
310310

311+
## Preparing an upgrade to 3.x
312+
313+
The `app:utils:convert-env-to-3x` command converts the configuration of this
314+
(2.x) installation to 3.x environment configuration. The values _loaded_ in
315+
the running application are treated as canonical — whether they come from
316+
real environment variables, a docker compose `environment` block or
317+
`.env`/`.env.local` files — and every variable the application reads is
318+
written out under its 3.x name.
319+
320+
Unless `--skip-config-json` is given, the command also fetches the canonical
321+
admin and client configuration from `<app-url>/admin/config.json` and
322+
`<app-url>/client/config.json` and converts them to the 3.x `ADMIN_*` and
323+
`CLIENT_*` variables. The base URL is inferred from the loaded OIDC redirect
324+
URIs (or `COMPOSE_DOMAIN`) and can be overridden with `--app-url`.
325+
326+
```shell
327+
# Review on screen (default):
328+
docker compose exec phpfpm bin/console app:utils:convert-env-to-3x
329+
330+
# Write a dotenv file ON THE HOST, the starting point for the 3.x .env.local.
331+
# With --output=env (and --output=compose) the document goes to stdout and all
332+
# notes/warnings go to stderr, so the result can be redirected from outside
333+
# the container (-T: no TTY, keeps stdout byte-clean):
334+
docker compose exec -T phpfpm bin/console app:utils:convert-env-to-3x \
335+
--output=env --app-url=https://display.example.com > env.3x
336+
337+
# Or a docker compose environment block:
338+
docker compose exec -T phpfpm bin/console app:utils:convert-env-to-3x --output=compose > env.3x.yml
339+
```
340+
341+
Note that `--file` writes inside the container, so it only makes sense for
342+
paths on a mounted volume; prefer the host-side redirect above in dockerised
343+
setups.
344+
345+
Loaded variables the Symfony application cannot read (`COMPOSE_*`, `PHP_*`,
346+
`NGINX_*`, `MARIADB_*`/`MYSQL_*`) are listed in a trailing advisory with a
347+
note on where each belongs in a 3.x deployment: compose orchestration values
348+
go in the docker host `.env`, and the container-tuning values go on the
349+
respective containers (`.env.php`, `.env.nginx`, `.env.mariadb` in the
350+
`os2display-docker-server` file layout). They are never part of the
351+
application env output.
352+
311353
## CI
312354

313355
Github Actions are used to run the test suite and code style checks on all PRs.
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
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+
* Portability prep: give the 15 `changed_idx` indexes table-scoped names so
12+
* they don't collide on platforms (such as Postgres) that scope index names
13+
* schema-wide rather than per-table.
14+
*
15+
* No-op for MariaDB at runtime. Landing on 2.8 means the consolidated 3.0
16+
* migration can emit the portable shape from the start, keeping
17+
* `migrations:rollup` honest for 2.x → 3.0 upgraders. The reserved-keyword
18+
* problem with the `user` table is handled separately by backtick-quoting
19+
* the identifier in the entity attribute (no rename needed).
20+
*/
21+
final class Version20260507120000 extends AbstractMigration
22+
{
23+
private const CHANGED_IDX_TABLES = [
24+
'feed',
25+
'feed_source',
26+
'media',
27+
'playlist',
28+
'playlist_screen_region',
29+
'playlist_slide',
30+
'screen',
31+
'screen_campaign',
32+
'screen_group',
33+
'screen_group_campaign',
34+
'screen_layout',
35+
'screen_layout_regions',
36+
'slide',
37+
'template',
38+
'theme',
39+
];
40+
41+
public function getDescription(): string
42+
{
43+
return 'Uniquify the 15 `changed_idx` indexes (table-scoped names) for cross-platform portability.';
44+
}
45+
46+
public function up(Schema $schema): void
47+
{
48+
foreach (self::CHANGED_IDX_TABLES as $table) {
49+
$this->addSql(sprintf('ALTER TABLE `%s` RENAME INDEX `changed_idx` TO `%s_changed_idx`', $table, $table));
50+
}
51+
}
52+
53+
public function down(Schema $schema): void
54+
{
55+
foreach (self::CHANGED_IDX_TABLES as $table) {
56+
$this->addSql(sprintf('ALTER TABLE `%s` RENAME INDEX `%s_changed_idx` TO `changed_idx`', $table, $table));
57+
}
58+
}
59+
}

0 commit comments

Comments
 (0)