mirror of
https://github.com/shlinkio/shlink.git
synced 2024-12-27 17:31:20 -06:00
Implemented how the CreateDatabaseCommand checks if the database tables exist
This commit is contained in:
parent
f78fa58cf1
commit
b68e262eac
@ -66,15 +66,19 @@ class CreateDatabaseCommand extends AbstractDatabaseCommand
|
|||||||
{
|
{
|
||||||
$schemaManager = $this->conn->getSchemaManager();
|
$schemaManager = $this->conn->getSchemaManager();
|
||||||
$databases = $schemaManager->listDatabases();
|
$databases = $schemaManager->listDatabases();
|
||||||
if (! contains($databases, '')) {
|
$shlinkDatabase = $this->conn->getDatabase();
|
||||||
$schemaManager->createDatabase($this->conn->getDatabase());
|
|
||||||
|
if (! contains($databases, $shlinkDatabase)) {
|
||||||
|
$schemaManager->createDatabase($shlinkDatabase);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private function schemaExists(): bool
|
private function schemaExists(): bool
|
||||||
{
|
{
|
||||||
// TODO Implement
|
// If at least one of the shlink tables exist, we will consider the database exists somehow.
|
||||||
return false;
|
// Any inconsistency will be taken care by the migrations
|
||||||
|
$schemaManager = $this->conn->getSchemaManager();
|
||||||
|
return ! empty($schemaManager->listTableNames());
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function getLockConfig(): LockedCommandConfig
|
protected function getLockConfig(): LockedCommandConfig
|
||||||
|
Loading…
Reference in New Issue
Block a user