Skip to content

Commit

Permalink
Merge pull request #153 from acelaya-forks/feature/fix-db-questions
Browse files Browse the repository at this point in the history
Feature/fix db questions
  • Loading branch information
acelaya authored Feb 9, 2022
2 parents ff600d3 + 14bdfd9 commit a1d30e1
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 1 deletion.
20 changes: 20 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,26 @@ 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).

## [7.0.1] - 2022-02-09
### Added
* *Nothing*

### Changed
* *Nothing*

### Changed
* *Nothing*

### Deprecated
* *Nothing*

### Removed
* *Nothing*

### Fixed
* Fixed non-sqlite questions being asked when importing a pre-7.0 config using SQLite.


## [7.0.0] - 2022-01-27
### Added
* [#143](https://github.com/shlinkio/shlink-installer/issues/143) Reworked how config options are "persisted", switching from regular config to an env var map.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,15 @@

namespace Shlinkio\Shlink\Installer\Config\Option\Database;

use function str_contains;

abstract class AbstractNonSqliteDependentConfigOption extends AbstractDriverDependentConfigOption
{
protected function shouldBeAskedForDbDriver(string $dbDriver): bool
{
return $dbDriver !== DatabaseDriverConfigOption::SQLITE_DRIVER;
// DEPRECATED.
// Should just compare with strict equality ($dbDriver === DatabaseDriverConfigOption::SQLITE_DRIVER)
// Using str_contains instead for backwards compatibility when importing the pdo_sqlite value
return ! str_contains($dbDriver, DatabaseDriverConfigOption::SQLITE_DRIVER);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ public function provideCurrentOptions(): iterable
};

yield 'sqlite' => [$buildCollection(DatabaseDriverConfigOption::SQLITE_DRIVER), false];
yield 'old sqlite' => [$buildCollection('pdo_sqlite'), false];
yield 'mysql' => [$buildCollection(DatabaseDriverConfigOption::MYSQL_DRIVER), true];
yield 'postgres' => [$buildCollection(DatabaseDriverConfigOption::POSTGRES_DRIVER), true];
yield 'mysql with value' => [$buildCollection(DatabaseDriverConfigOption::MYSQL_DRIVER, true), false];
Expand Down

0 comments on commit a1d30e1

Please sign in to comment.