Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix broken migrations #1053

Open
wants to merge 31 commits into
base: 2.3.x
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
a7c48fa
Fix broken migrations on MariaDB
pierredup Apr 30, 2024
f1e40d3
Add GH actions to test migrations on different DB version
pierredup Apr 30, 2024
d8a28d8
Fix action name
pierredup Apr 30, 2024
b2383f2
Fix image format
pierredup Apr 30, 2024
69613d9
Fix matrix
pierredup Apr 30, 2024
1f0145f
Fix db version for MariaDB
pierredup Apr 30, 2024
bf1c295
Fix database version for MariaBD
pierredup Apr 30, 2024
288c636
Fix db version
pierredup Apr 30, 2024
6cdb50c
Fix version for MariaDB
pierredup Apr 30, 2024
947c9ea
Fail job when setup-php fails
pierredup Apr 30, 2024
92af7d2
Add SQLServer
pierredup Apr 30, 2024
393492c
Fix driver name
pierredup Apr 30, 2024
77f2379
Fix image version for SQLServer
pierredup Apr 30, 2024
bada60e
Skip migrations on other platform than MySQL
pierredup Apr 30, 2024
8d8ad15
Create schema during installation instead of running migrations
pierredup Apr 30, 2024
1053a50
Run updateSchema instead of createSchema
pierredup Apr 30, 2024
20f8e3c
Set saveMode when updating schema
pierredup May 1, 2024
528d6e7
Create database schema in GH actions before unit tests instead of eve…
pierredup May 1, 2024
1b77d8c
Fix installation test
pierredup May 1, 2024
e637f20
Only create database if it doesn't already exist
pierredup May 1, 2024
0474ffe
Fix tests
pierredup May 1, 2024
9bf5c0f
Disable web profiler in test env
pierredup May 2, 2024
1ee118b
Fix saving token history before company is set
pierredup May 2, 2024
147e783
Do not reboot kernel during api tests
pierredup May 2, 2024
12668d6
Do not set application installation if already set
pierredup May 2, 2024
608bfc3
Set values for test
pierredup May 2, 2024
78f7edd
Ensure tests are always run with a fresh cache
pierredup May 2, 2024
1319891
Improve installation test
pierredup May 2, 2024
10554b6
Replace invoice create with a LiveComponent
pierredup Apr 30, 2024
332f041
Enable db creation for tests again
pierredup Apr 30, 2024
513fe27
Fix tests
pierredup Jun 5, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
199 changes: 199 additions & 0 deletions .github/workflows/db-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,199 @@
name: DB Tests

on:
pull_request:

env:
SOLIDINVOICE_ENV: test
SOLIDINVOICE_DEBUG: 0

jobs:
migrations:
name: DB (${{ matrix.db.name }} ${{ matrix.db.driver }} ${{ matrix.db.version }})

runs-on: ubuntu-latest

strategy:
matrix:
include:
- db:
name: MySQL
driver: pdo_mysql
version: 5.7
image: mysql
port: 3306
user: root
- db:
name: MySQL
driver: pdo_mysql
version: "8.0"
image: mysql
port: 3306
user: root
- db:
name: MySQL
driver: pdo_mysql
version: 8.3
image: mysql
port: 3306
user: root
- db:
name: MariaDB
driver: pdo_mysql
version: 10.4
image: mariadb
port: 3306
user: root
- db:
name: MariaDB
driver: pdo_mysql
version: 10.5
image: mariadb
port: 3306
user: root
- db:
name: MariaDB
driver: pdo_mysql
version: 10.6
image: mariadb
port: 3306
user: root
- db:
name: MariaDB
driver: pdo_mysql
version: 10.11
image: mariadb
port: 3306
user: root
- db:
name: MariaDB
driver: pdo_mysql
version: "11.0"
image: mariadb
port: 3306
user: root
- db:
name: MariaDB
driver: pdo_mysql
version: 11.1
image: mariadb
port: 3306
user: root
- db:
name: MariaDB
driver: pdo_mysql
version: 11.2
image: mariadb
port: 3306
user: root
- db:
name: MariaDB
driver: pdo_mysql
version: 11.3
image: mariadb
port: 3306
user: root
- db:
name: PostgreSQL
driver: pdo_pgsql
version: 10
image: postgres
port: 5432
user: postgres
- db:
name: PostgreSQL
driver: pdo_pgsql
version: 15
image: postgres
port: 5432
user: postgres
- db:
name: PostgreSQL
driver: pdo_pgsql
version: 16
image: postgres
port: 5432
user: postgres
- db:
name: Oracle
driver: pdo_oci
version: 18
image: gvenzl/oracle-xe
port: 1521
user: system
- db:
name: Oracle
driver: pdo_oci
version: 21
image: gvenzl/oracle-xe
port: 1521
user: system
- db:
name: Oracle
driver: pdo_oci
version: 23
image: gvenzl/oracle-free
port: 1521
user: system
- db:
name: SQLServer
driver: pdo_sqlsrv
version: 2019-latest
image: mcr.microsoft.com/mssql/server
port: 1433
user: sa

fail-fast: false

services:
db:
image: ${{ matrix.db.image }}:${{ matrix.db.version }}
env:
ORACLE_PASSWORD: solidinvoice
MYSQL_ROOT_PASSWORD: solidinvoice
MYSQL_DATABASE: solidinvoice
POSTGRES_PASSWORD: solidinvoice
ACCEPT_EULA: "Y"
SA_PASSWORD: "solidinvoice"
MSSQL_COLLATION: "Latin1_General_100_CI_AS_SC_UTF8"
ports:
- "${{ matrix.db.port }}:${{ matrix.db.port }}"

env:
database_driver: ${{ matrix.db.driver }}
database_host: 127.0.0.1
database_port: ${{ matrix.db.port }}
database_name: solidinvoice
database_user: ${{ matrix.db.user }}
database_password: solidinvoice
database_version: ${{ matrix.db.name == 'MariaDB' && 'mariadb-' || '' }}${{ matrix.db.version }}${{ matrix.db.name == 'MariaDB' && '.0' || '' }}

steps:
- name: Harden Runner
uses: step-security/harden-runner@63c24ba6bd7ba022e95695ff85de572c04a18142
with:
egress-policy: block
allowed-endpoints: >
api.github.com:443
github.com:443
objects.githubusercontent.com:443

- name: Checkout
uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f

- name: Setup PHP
uses: shivammathur/setup-php@c665c7a15b5295c2488ac8a87af9cb806cd72198
with:
php-version: 8.1
ini-values: date.timezone=Africa/Johannesburg, opcache.enable=1, opcache.enable_cli=1, opcache.memory_consumption=256, opcache.max_accelerated_files=32531, opcache.interned_strings_buffer=8, opcache.validate_timestamps=0, opcache.save_comments=1, opcache.fast_shutdown=0, memory_limit=-1, zend.assertions=1
extensions: intl, gd, opcache, ${{ matrix.db.driver == 'pdo_sqlsrv' && 'pdo_sql_srv-5.10.0beta1' || '' }}, ${{ matrix.db.driver }}, zip, :xdebug
env:
fail-fast: true

- uses: ramsey/composer-install@v3

- name: Create Database
run: bin/console doctrine:database:create

- name: Run Migrations
run: bin/console doctrine:migrations:migrate --no-interaction
6 changes: 6 additions & 0 deletions .github/workflows/unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,12 @@ jobs:
if: matrix.coverage
run: echo "COVERAGE=1" >> $GITHUB_ENV

- name: Create Database
run: bin/console doctrine:database:create --env=test --if-not-exists

- name: Create database schema
run: bin/console doctrine:schema:create --env=test

- name: Run test suite
run: |
mkdir -p build/logs
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@
},
"require-dev": {
"captainhook/captainhook-phar": "^5.23",
"dama/doctrine-test-bundle": "^7.2",
"dama/doctrine-test-bundle": "^8.0",
"dbrekelmans/bdi": "^1.0",
"doctrine/doctrine-fixtures-bundle": "^3.3",
"ergebnis/composer-normalize": "^2.20",
Expand Down
38 changes: 19 additions & 19 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion config/bundles.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
Liip\TestFixturesBundle\LiipTestFixturesBundle::class => ['dev' => true, 'test' => true],
Symfony\Bundle\DebugBundle\DebugBundle::class => ['dev' => true, 'test' => true],
Symfony\Bundle\MakerBundle\MakerBundle::class => ['dev' => true],
Symfony\Bundle\WebProfilerBundle\WebProfilerBundle::class => ['dev' => true, 'test' => true],
Symfony\Bundle\WebProfilerBundle\WebProfilerBundle::class => ['dev' => true],
Twig\Extra\TwigExtraBundle\TwigExtraBundle::class => ['all' => true],
SolidWorx\Toggler\Symfony\TogglerBundle::class => ['all' => true],
Zenstruck\Foundry\ZenstruckFoundryBundle::class => ['dev' => true, 'test' => true],
Expand Down
4 changes: 3 additions & 1 deletion config/packages/doctrine.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@
->user(env('database_user'))
->password(env('database_password'))
->serverVersion(env('database_version'))
->charset('UTF8');
->charset('UTF8')
->useSavepoints(true)
;

$dbalConfig
->type(UuidType::NAME)
Expand Down
11 changes: 0 additions & 11 deletions config/packages/test/web_profiler.php

This file was deleted.

5 changes: 0 additions & 5 deletions config/services_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,7 @@

declare(strict_types=1);

use SolidInvoice\CoreBundle\ConfigWriter;
use SolidInvoice\InstallBundle\Installer\Database\Migration;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
use Twig\Environment;
use Twig\Loader\LoaderInterface;

return static function (ContainerConfigurator $containerConfigurator): void {
$parameters = $containerConfigurator->parameters();
Expand Down