Skip to content

Commit

Permalink
Test on MariaDB 11.4, updated actions, minor fix in exception handling.
Browse files Browse the repository at this point in the history
  • Loading branch information
parpalak committed Apr 29, 2024
1 parent b4ce01a commit 36af6d9
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 16 deletions.
6 changes: 5 additions & 1 deletion .github/workflows/test_mysql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ jobs:
operating_system: 'ubuntu-22.04'
php_versions: 8.2
mysql_versions: '8.1'
-
operating_system: 'ubuntu-22.04'
php_versions: 8.2
mysql_versions: 'mariadb-11.4'
-
operating_system: 'ubuntu-22.04'
php_versions: 8.3
Expand All @@ -51,7 +55,7 @@ jobs:
runs-on: '${{ matrix.operating_system }}'

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: shogo82148/actions-setup-mysql@v1
with:
mysql-version: ${{ matrix.mysql_versions }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test_postgres.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
runs-on: '${{ matrix.operating_system }}'

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: ikalnytskyi/action-setup-postgres@v4
with:
username: postgres
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/test_sqlite.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,16 @@ jobs:
runs-on: '${{ matrix.operating_system }}'

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: 'Setup PHP'
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php_versions }}

- name: Show SQLite version
run: php --ri sqlite3

- name: Install dependencies
run: COMPOSER_MEMORY_LIMIT=-1 composer install --prefer-dist --no-interaction

Expand Down
22 changes: 11 additions & 11 deletions src/S2/Rose/Storage/Database/MysqlRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public function erase(): void
throw new RuntimeException('Cannot drop and create tables. Possible deadlock? Database reported: ' . $e->getMessage(), 0, $e);
}
if ($e->getCode() === '42000') {
throw new InvalidEnvironmentException($e->getMessage(), $e->getCode(), $e);
throw new InvalidEnvironmentException($e->getMessage(), (int)$e->getCode(), $e);
}
throw new UnknownException(sprintf(
'Unknown exception "%s" occurred while creating tables: "%s".',
Expand Down Expand Up @@ -114,16 +114,16 @@ public function addToToc(TocEntry $entry, ExternalId $externalId): void
try {
$statement = $this->pdo->prepare($sql);
$statement->execute([
'external_id' => $externalId->getId(),
'instance_id' => (int)$externalId->getInstanceId(),

'title' => $entry->getTitle(),
'description' => $entry->getDescription(),
'added_at' => $entry->getFormattedDate(),
'timezone' => $entry->getTimeZone(),
'url' => $entry->getUrl(),
'relevance_ratio' => $entry->getRelevanceRatio(),
'hash' => $entry->getHash(),
'external_id' => $externalId->getId(),
'instance_id' => (int)$externalId->getInstanceId(),

'title' => $entry->getTitle(),
'description' => $entry->getDescription(),
'added_at' => $entry->getFormattedDate(),
'timezone' => $entry->getTimeZone(),
'url' => $entry->getUrl(),
'relevance_ratio' => $entry->getRelevanceRatio(),
'hash' => $entry->getHash(),

'title2' => $entry->getTitle(),
'description2' => $entry->getDescription(),
Expand Down
2 changes: 1 addition & 1 deletion src/S2/Rose/Storage/Database/PostgresRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public function erase(): void
throw new RuntimeException('Cannot drop and create tables. Possible deadlock? Database reported: ' . $e->getMessage(), 0, $e);
}
if ($e->getCode() === '42000') {
throw new InvalidEnvironmentException($e->getMessage(), $e->getCode(), $e);
throw new InvalidEnvironmentException($e->getMessage(), (int)$e->getCode(), $e);
}
throw new UnknownException(sprintf(
'Unknown exception "%s" occurred while creating tables: "%s".',
Expand Down
2 changes: 1 addition & 1 deletion src/S2/Rose/Storage/Database/SqliteRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public function erase(): void
throw new RuntimeException('Cannot drop and create tables. Possible deadlock? Database reported: ' . $e->getMessage(), 0, $e);
}
if ($e->getCode() === '42000') {
throw new InvalidEnvironmentException($e->getMessage(), $e->getCode(), $e);
throw new InvalidEnvironmentException($e->getMessage(), (int)$e->getCode(), $e);
}
throw new UnknownException(sprintf(
'Unknown exception "%s" occurred while creating tables: "%s".',
Expand Down

0 comments on commit 36af6d9

Please sign in to comment.