mirror of
https://github.com/shlinkio/shlink.git
synced 2025-01-05 05:34:58 -06:00
Merge pull request #1818 from acelaya-forks/feature/fix-sqlite-db-creation
Fix Shlink trying to create SQLite database tables even if they already exist
This commit is contained in:
commit
228bd83b75
2
.github/workflows/publish-swagger-spec.yml
vendored
2
.github/workflows/publish-swagger-spec.yml
vendored
@ -26,7 +26,7 @@ jobs:
|
|||||||
- run: mkdir ${{ steps.determine_version.outputs.version }}
|
- run: mkdir ${{ steps.determine_version.outputs.version }}
|
||||||
- run: mv docs/swagger/swagger-inlined.json ${{ steps.determine_version.outputs.version }}/open-api-spec.json
|
- run: mv docs/swagger/swagger-inlined.json ${{ steps.determine_version.outputs.version }}/open-api-spec.json
|
||||||
- name: Publish spec
|
- name: Publish spec
|
||||||
uses: JamesIves/github-pages-deploy-action@4
|
uses: JamesIves/github-pages-deploy-action@4.4.1
|
||||||
with:
|
with:
|
||||||
token: ${{ secrets.OAS_PUBLISH_TOKEN }}
|
token: ${{ secrets.OAS_PUBLISH_TOKEN }}
|
||||||
repository-name: 'shlinkio/shlink-open-api-specs'
|
repository-name: 'shlinkio/shlink-open-api-specs'
|
||||||
|
17
CHANGELOG.md
17
CHANGELOG.md
@ -4,6 +4,23 @@ All notable changes to this project will be documented in this file.
|
|||||||
|
|
||||||
The format is based on [Keep a Changelog](https://keepachangelog.com), and this project adheres to [Semantic Versioning](https://semver.org).
|
The format is based on [Keep a Changelog](https://keepachangelog.com), and this project adheres to [Semantic Versioning](https://semver.org).
|
||||||
|
|
||||||
|
## [3.6.3] - 2023-06-14
|
||||||
|
### Added
|
||||||
|
* *Nothing*
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
* *Nothing*
|
||||||
|
|
||||||
|
### Deprecated
|
||||||
|
* *Nothing*
|
||||||
|
|
||||||
|
### Removed
|
||||||
|
* *Nothing*
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
* [#1817](https://github.com/shlinkio/shlink/issues/1817) Fix Shlink trying to create SQLite database tables even if they already exist.
|
||||||
|
|
||||||
|
|
||||||
## [3.6.2] - 2023-06-08
|
## [3.6.2] - 2023-06-08
|
||||||
### Added
|
### Added
|
||||||
* *Nothing*
|
* *Nothing*
|
||||||
|
@ -75,7 +75,7 @@
|
|||||||
"phpunit/phpunit": "~10.1.0",
|
"phpunit/phpunit": "~10.1.0",
|
||||||
"roave/security-advisories": "dev-master",
|
"roave/security-advisories": "dev-master",
|
||||||
"shlinkio/php-coding-standard": "~2.3.0",
|
"shlinkio/php-coding-standard": "~2.3.0",
|
||||||
"shlinkio/shlink-test-utils": "^3.6",
|
"shlinkio/shlink-test-utils": "~3.6.0",
|
||||||
"symfony/var-dumper": "^6.2",
|
"symfony/var-dumper": "^6.2",
|
||||||
"veewee/composer-run-parallel": "^1.2"
|
"veewee/composer-run-parallel": "^1.2"
|
||||||
},
|
},
|
||||||
|
@ -5,7 +5,6 @@ declare(strict_types=1);
|
|||||||
namespace Shlinkio\Shlink\CLI\Command\Db;
|
namespace Shlinkio\Shlink\CLI\Command\Db;
|
||||||
|
|
||||||
use Doctrine\DBAL\Connection;
|
use Doctrine\DBAL\Connection;
|
||||||
use Doctrine\DBAL\Platforms\SqlitePlatform;
|
|
||||||
use Doctrine\ORM\EntityManagerInterface;
|
use Doctrine\ORM\EntityManagerInterface;
|
||||||
use Doctrine\ORM\Mapping\ClassMetadata;
|
use Doctrine\ORM\Mapping\ClassMetadata;
|
||||||
use Shlinkio\Shlink\CLI\Util\ExitCode;
|
use Shlinkio\Shlink\CLI\Util\ExitCode;
|
||||||
@ -80,10 +79,6 @@ class CreateDatabaseCommand extends AbstractDatabaseCommand
|
|||||||
|
|
||||||
private function ensureDatabaseExistsAndGetTables(): array
|
private function ensureDatabaseExistsAndGetTables(): array
|
||||||
{
|
{
|
||||||
if ($this->regularConn->getDriver()->getDatabasePlatform() instanceof SqlitePlatform) {
|
|
||||||
return [];
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// Trying to list tables requires opening a connection to configured database.
|
// Trying to list tables requires opening a connection to configured database.
|
||||||
// If it fails, it means it does not exist yet.
|
// If it fails, it means it does not exist yet.
|
||||||
|
@ -7,7 +7,6 @@ namespace ShlinkioTest\Shlink\CLI\Command\Db;
|
|||||||
use Doctrine\DBAL\Connection;
|
use Doctrine\DBAL\Connection;
|
||||||
use Doctrine\DBAL\Driver;
|
use Doctrine\DBAL\Driver;
|
||||||
use Doctrine\DBAL\Platforms\AbstractPlatform;
|
use Doctrine\DBAL\Platforms\AbstractPlatform;
|
||||||
use Doctrine\DBAL\Platforms\SqlitePlatform;
|
|
||||||
use Doctrine\DBAL\Schema\AbstractSchemaManager;
|
use Doctrine\DBAL\Schema\AbstractSchemaManager;
|
||||||
use Doctrine\ORM\EntityManagerInterface;
|
use Doctrine\ORM\EntityManagerInterface;
|
||||||
use Doctrine\ORM\Mapping\ClassMetadata;
|
use Doctrine\ORM\Mapping\ClassMetadata;
|
||||||
@ -129,18 +128,4 @@ class CreateDatabaseCommandTest extends TestCase
|
|||||||
yield 'no tables' => [[]];
|
yield 'no tables' => [[]];
|
||||||
yield 'migrations table' => [['non_shlink_table']];
|
yield 'migrations table' => [['non_shlink_table']];
|
||||||
}
|
}
|
||||||
|
|
||||||
#[Test]
|
|
||||||
public function databaseCheckIsSkippedForSqlite(): void
|
|
||||||
{
|
|
||||||
$this->driver->method('getDatabasePlatform')->willReturn($this->createMock(SqlitePlatform::class));
|
|
||||||
$this->regularConn->expects($this->never())->method('getParams');
|
|
||||||
$this->schemaManager->expects($this->never())->method('listDatabases');
|
|
||||||
$this->schemaManager->expects($this->never())->method('createDatabase');
|
|
||||||
$this->schemaManager->expects($this->never())->method('listTableNames');
|
|
||||||
|
|
||||||
$this->metadataFactory->expects($this->once())->method('getAllMetadata')->willReturn([]);
|
|
||||||
|
|
||||||
$this->commandTester->execute([]);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user