- Merged latest commit and pushed modifications

This commit is contained in:
mcndave committed 2022-05-15 02:45:41 +00:00
commit e78492d398
6 files changed
+80 -12

No files matched your search

+28
View File
@@ -0,0 +1,28 @@
<?php
namespace Lean\Console\Controller;
use Psr\Http\Message\{ ResponseInterface, ServerRequestInterface };
use Notes\Route\Annotation\Object\Route as RouteParam,
Notes\Route\Annotation\Method\Route,
Notes\Security\Annotation\Security,
Notes\Tell\Annotation\Language;
use \Lean\Console\Lib;
/**
* @Language("lean.dev")
*/
class Dev {
use Lib\ConsoleControllerTrait;
/**
* @Route("/phpinfo", "name" => "lean.dev:phpinfo")
*/
public function home(ServerRequestInterface $request, array $arguments) : ResponseInterface
{
phpinfo();
die();
}
}
+35 -6
View File
@@ -8,6 +8,7 @@ use \Lean\Console\Lib;
use Picea\Compiler\Context;
use Psr\Http\Message\ServerRequestInterface;
use Ulmus\Common\EntityResolver;
use \Ulmus\Entity\InformationSchema\Table;
class Database implements FormInterface
@@ -33,6 +34,7 @@ class Database implements FormInterface
continue;
}
#<<<<<<< HEAD
$tableEntity = $adapter->schemaTable($databaseName, $tableName);
if ( $tableEntity ) {
@@ -40,13 +42,37 @@ class Database implements FormInterface
foreach($tableEntity->columns as $col) {
//dump( $entity::field($col->name) );
#=======
# $table = Table::repository()
# ->where(Table::field('name'), $table->tableName())
# ->where(Table::field('schema'), $table->databaseName())
# ->loadOne();
# if ( $table ) {
# $fields = $entity::resolveEntity()->fieldList(EntityResolver::KEY_COLUMN_NAME, true);
# $alter = [];
# foreach($fields as $field => $definition) {
# if ( $table->columns->filtersCollection(fn($e) => $e->name === $field)->count() === 0 ) {
# $alter[$field] = $definition;
# }
#>>>>>>> 7194a33bec884d745e838c8ac2693b353e95a3ce
}
# if columns are different
$context->status[$entity] = [
'msg' => "up-to-date",
'query' => "",
];
if ( $alter ) {
$context->status[$entity] = [
'msg' => "alter",
"query" => $entity::repository()->alterSqlQuery($alter)->getSqlQuery(true),
];
}
else {
# if columns are different
$context->status[$entity] = [
'msg' => "up-to-date",
'query' => "",
];
}
}
else {
$context->status[$entity] = [
@@ -77,6 +103,9 @@ class Database implements FormInterface
$entity::repository()->createTable();
}
}
elseif ( $context->alter ?? false ) {
}
$this->initialize($context);
}
@@ -90,4 +119,4 @@ class Database implements FormInterface
public array $actions = [];
};
}
}
}
+2 -2
View File
@@ -11,7 +11,8 @@ use Picea;
/**
* @Language("lean.route")
* @RouteParam("methods" => [ 'GET', 'POST', 'DELETE' ], "base" => "/~")
* @Security('locked' => false)
* @Security('locked' => true)
* @Taxus("admin")
*/
trait ConsoleControllerTrait
{
@@ -23,6 +24,5 @@ trait ConsoleControllerTrait
$this->picea = $picea;
$this->session = $session;
$this->container = $container;
// $this->mailer = $mailer;
}
}
+2
View File
@@ -30,6 +30,8 @@ class DatabaseMigrations
$this->entities[$entity] = $entity::resolveEntity();
}
}
ksort($this->entities);
}
protected static function files(string $path, string $fileExtension = "") : \Generator