Skip to content

Commit b92edff

Browse files
CarlSchwanmejo-
authored andcommitted
refactor: Use getDatabaseProvider to detect if DB is oracle
Signed-off-by: Carl Schwan <carl@carlschwan.eu>
1 parent 403201f commit b92edff

2 files changed

Lines changed: 8 additions & 12 deletions

File tree

lib/Migration/Version030201Date20201116110353.php

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,15 @@
1111

1212
use Closure;
1313
use OCP\DB\ISchemaWrapper;
14-
use OCP\IConfig;
14+
use OCP\IDBConnection;
1515
use OCP\Migration\IOutput;
1616
use OCP\Migration\SimpleMigrationStep;
1717

1818
class Version030201Date20201116110353 extends SimpleMigrationStep {
19+
private readonly bool $isOracle;
1920

20-
/** @var bool */
21-
private $isOracle;
22-
23-
public function __construct(IConfig $config) {
24-
$this->isOracle = $config->getSystemValue('dbtype', 'sqlite') === 'oci';
21+
public function __construct(IDBConnection $connection) {
22+
$this->isOracle = $connection->getDatabaseProvider() === IDBConnection::PLATFORM_ORACLE;
2523
}
2624

2725
public function changeSchema(IOutput $output, Closure $schemaClosure, array $options) {

lib/Migration/Version030201Date20201116123153.php

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,15 @@
1212
use Closure;
1313
use OCP\DB\ISchemaWrapper;
1414
use OCP\DB\Types;
15-
use OCP\IConfig;
15+
use OCP\IDBConnection;
1616
use OCP\Migration\IOutput;
1717
use OCP\Migration\SimpleMigrationStep;
1818

1919
class Version030201Date20201116123153 extends SimpleMigrationStep {
20+
private readonly bool $isOracle;
2021

21-
/** @var bool */
22-
private $isOracle;
23-
24-
public function __construct(IConfig $config) {
25-
$this->isOracle = $config->getSystemValue('dbtype', 'sqlite') === 'oci';
22+
public function __construct(IDBConnection $connection) {
23+
$this->isOracle = $connection->getDatabaseProvider() === IDBConnection::PLATFORM_ORACLE;
2624
}
2725

2826
public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper {

0 commit comments

Comments
 (0)