From a9d7fd7f4ca116cca491e66b1fe34a25d20ccfc4 Mon Sep 17 00:00:00 2001 From: Dave Mc Nicoll Date: Thu, 26 Nov 2026 18:54:40 +0000 Subject: [PATCH] - Fixed an HTML bug within database - Added a new Migration attribute --- src/Form/Storage/Database/Migrate.php | 6 ++ view/lean-console/page/storage/database.phtml | 59 ++++++++++--------- 2 files changed, 38 insertions(+), 27 deletions(-) diff --git a/src/Form/Storage/Database/Migrate.php b/src/Form/Storage/Database/Migrate.php index 5235531..e43afd9 100644 --- a/src/Form/Storage/Database/Migrate.php +++ b/src/Form/Storage/Database/Migrate.php @@ -8,6 +8,7 @@ use \Lean\Console\Lib; use Picea\Compiler\Context; use Psr\Http\Message\ServerRequestInterface; +use Ulmus\Attribute\Property\Field\Migration; use Ulmus\Common\EntityResolver; use \Ulmus\Entity\InformationSchema\Table; use Ulmus\Ulmus; @@ -48,6 +49,11 @@ class Migrate implements FormInterface $this->definition[$entity]['columns'] = new Lib\Database\DefinitionCollection(); foreach($table->fieldList(EntityResolver::KEY_COLUMN_NAME, true) as $field => $definition) { + if ($migration = $definition->getAttribute(Migration::class)) { + if ($migration->object->skipField) { + continue; + } + } if ( isset($definition->value) ) { $definition->value = $entity::repository()->adapter->adapter()->writableValue($definition->value); diff --git a/view/lean-console/page/storage/database.phtml b/view/lean-console/page/storage/database.phtml index 068222d..440807d 100644 --- a/view/lean-console/page/storage/database.phtml +++ b/view/lean-console/page/storage/database.phtml @@ -12,21 +12,25 @@ {% section "content" %} {% if $connections %} - {% foreach $connections as $connection %} - {% php $conf = $connection->getConfiguration(); %} + {% ui:form.post "database.migrate", current_url() %} + {% foreach $connections as $connection %} + {% php $conf = $connection->getConfiguration(); %} -
-
-
- {% include "lean-console/svg/icon-database.svg" %} -
+
+
+
+ {% include "lean-console/svg/icon-database.svg" %} +
-

{% _.raw 'database.connection', [ 'name' => $connection->name ] %}

-
+

{% _.raw 'database.connection', [ 'name' => $connection->name ] %}

+
-
- {% ui:form.post "database.migrate", current_url() %} +
{% foreach array_filter($migrations->entities, fn($e) => $e->databaseAdapter() === $connection) as $entity => $item %} + {% if empty($context->definition[$entity]) %} + {% continue %} + {% endif %} +
@@ -45,6 +49,7 @@
+
{% if $context->definition[$entity]['table']->modifier->query ?? false %} {{= implode('

',(array) $context->definition[$entity]['table']->modifier->query) }}
@@ -55,29 +60,29 @@
- {% switch $context->definition[$entity]['table']->modifier->type ?? false %} - {% case ModifierTypeEnum::Create %} - {% php $createAll[] = $entity %} - -
- {% break %} + {% switch $context->definition[$entity]['table']->modifier->type ?? false %} + {% case ModifierTypeEnum::Create %} + {% php $createAll[] = $entity %} + + {% break %} + + {% case ModifierTypeEnum::Alter %} + {% php $alterAll[] = $entity %} + + {% break %} + + {% endswitch %} - {% case ModifierTypeEnum::Alter %} - {% php $alterAll[] = $entity %} - - {% break %} - {% endswitch %} {% _ 'database.table.add-column' %}
{% endforeach %} - {% ui:endform %} -
-
- {% endforeach %} + + + {% endforeach %} + {% ui:endform %} {% endif %} -