feature/create-working-docker-images #68

Merged
bence merged 14 commits from feature/create-working-docker-images into master 2023-09-28 13:33:02 +02:00
Showing only changes of commit 1718dfca9e - Show all commits

View File

@ -19,6 +19,8 @@ class MigrateDatabaseCommand extends Command
{
$db = \Container::$dbConnection;
$this->createBaseDb();
$db->startTransaction();
$success = [];
@ -62,10 +64,8 @@ class MigrateDatabaseCommand extends Command
return 0;
}
private function readDir(string $type): array
private function createBaseDb()
{
$done = [];
$migrationTableExists = \Container::$dbConnection->query('SELECT count(*)
FROM information_schema.tables
WHERE table_schema = \'' . $_ENV['DB_NAME'] . '\'
@ -73,6 +73,16 @@ class MigrateDatabaseCommand extends Command
->fetch(IResultSet::FETCH_NUM)[0];
if ($migrationTableExists != 0) {
return;
}
\Container::$dbConnection->multiQuery(file_get_contents(ROOT . '/database/rvr.sql'));
}
private function readDir(string $type): array
{
$done = [];
$select = new Select(\Container::$dbConnection, 'migrations');
$select->columns(['migration']);
$select->where('type', '=', $type);
@ -83,7 +93,6 @@ class MigrateDatabaseCommand extends Command
while ($migration = $result->fetch(IResultSet::FETCH_ASSOC)) {
$done[] = $migration['migration'];
}
}
$path = ROOT . '/database/migrations/' . $type;
$dir = opendir($path);