- Merged latest commit and pushed modifications
This commit is contained in:
commit
e78492d398
6 files changed
+80
-12
No files matched your search
+35
-6
@@ -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 = [];
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user