- Fixed an HTML bug within database
- Added a new Migration attribute
This commit is contained in:
1 parent
58c61a8f01
commit
a9d7fd7f4c
2 files changed
+38
-27
No files matched your search
@@ -8,6 +8,7 @@ use \Lean\Console\Lib;
|
|||||||
|
|
||||||
use Picea\Compiler\Context;
|
use Picea\Compiler\Context;
|
||||||
use Psr\Http\Message\ServerRequestInterface;
|
use Psr\Http\Message\ServerRequestInterface;
|
||||||
|
use Ulmus\Attribute\Property\Field\Migration;
|
||||||
use Ulmus\Common\EntityResolver;
|
use Ulmus\Common\EntityResolver;
|
||||||
use \Ulmus\Entity\InformationSchema\Table;
|
use \Ulmus\Entity\InformationSchema\Table;
|
||||||
use Ulmus\Ulmus;
|
use Ulmus\Ulmus;
|
||||||
@@ -48,6 +49,11 @@ class Migrate implements FormInterface
|
|||||||
$this->definition[$entity]['columns'] = new Lib\Database\DefinitionCollection();
|
$this->definition[$entity]['columns'] = new Lib\Database\DefinitionCollection();
|
||||||
|
|
||||||
foreach($table->fieldList(EntityResolver::KEY_COLUMN_NAME, true) as $field => $definition) {
|
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) ) {
|
if ( isset($definition->value) ) {
|
||||||
$definition->value = $entity::repository()->adapter->adapter()->writableValue($definition->value);
|
$definition->value = $entity::repository()->adapter->adapter()->writableValue($definition->value);
|
||||||
|
|||||||
@@ -12,21 +12,25 @@
|
|||||||
|
|
||||||
{% section "content" %}
|
{% section "content" %}
|
||||||
{% if $connections %}
|
{% if $connections %}
|
||||||
{% foreach $connections as $connection %}
|
{% ui:form.post "database.migrate", current_url() %}
|
||||||
{% php $conf = $connection->getConfiguration(); %}
|
{% foreach $connections as $connection %}
|
||||||
|
{% php $conf = $connection->getConfiguration(); %}
|
||||||
|
|
||||||
<section class="connection">
|
<section class="connection">
|
||||||
<header>
|
<header>
|
||||||
<div class="icon-database icon-purple">
|
<div class="icon-database icon-purple">
|
||||||
{% include "lean-console/svg/icon-database.svg" %}
|
{% include "lean-console/svg/icon-database.svg" %}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<h2>{% _.raw 'database.connection', [ 'name' => $connection->name ] %}</h2>
|
<h2>{% _.raw 'database.connection', [ 'name' => $connection->name ] %}</h2>
|
||||||
</header>
|
</header>
|
||||||
|
|
||||||
<article>
|
<article>
|
||||||
{% ui:form.post "database.migrate", current_url() %}
|
|
||||||
{% foreach array_filter($migrations->entities, fn($e) => $e->databaseAdapter() === $connection) as $entity => $item %}
|
{% foreach array_filter($migrations->entities, fn($e) => $e->databaseAdapter() === $connection) as $entity => $item %}
|
||||||
|
{% if empty($context->definition[$entity]) %}
|
||||||
|
{% continue %}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
<div class="single-table grid">
|
<div class="single-table grid">
|
||||||
<div class="col-5 col-xxl flex align-items-center">
|
<div class="col-5 col-xxl flex align-items-center">
|
||||||
<div class="icon-yellow">
|
<div class="icon-yellow">
|
||||||
@@ -45,6 +49,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="col-5 col-lg flex align-items-center">
|
<div class="col-5 col-lg flex align-items-center">
|
||||||
{% if $context->definition[$entity]['table']->modifier->query ?? false %}
|
{% if $context->definition[$entity]['table']->modifier->query ?? false %}
|
||||||
<code class="query">{{= implode('<br><br>',(array) $context->definition[$entity]['table']->modifier->query) }}</code>
|
<code class="query">{{= implode('<br><br>',(array) $context->definition[$entity]['table']->modifier->query) }}</code>
|
||||||
@@ -55,29 +60,29 @@
|
|||||||
|
|
||||||
<div class="col-2 col-lg flex align-items-center">
|
<div class="col-2 col-lg flex align-items-center">
|
||||||
<div class="btn-wrapper">
|
<div class="btn-wrapper">
|
||||||
{% switch $context->definition[$entity]['table']->modifier->type ?? false %}
|
{% switch $context->definition[$entity]['table']->modifier->type ?? false %}
|
||||||
{% case ModifierTypeEnum::Create %}
|
{% case ModifierTypeEnum::Create %}
|
||||||
{% php $createAll[] = $entity %}
|
{% php $createAll[] = $entity %}
|
||||||
<button name="create" value="{{$entity}}" class="btn-red btn-sm">✓ {% _ 'database.table.create' %}</button>
|
<button name="create" value="{{$entity}}" class="btn-red btn-sm">✓ {% _ 'database.table.create' %}</button>
|
||||||
</div>
|
{% break %}
|
||||||
{% break %}
|
|
||||||
|
{% case ModifierTypeEnum::Alter %}
|
||||||
|
{% php $alterAll[] = $entity %}
|
||||||
|
<button name="alter" value="{{$entity}}" class="btn-blue btn-sm">✓ {% _ 'database.table.alter' %}</button>
|
||||||
|
{% break %}
|
||||||
|
|
||||||
|
{% endswitch %}
|
||||||
|
|
||||||
{% case ModifierTypeEnum::Alter %}
|
|
||||||
{% php $alterAll[] = $entity %}
|
|
||||||
<button name="alter" value="{{$entity}}" class="btn-blue btn-sm">✓ {% _ 'database.table.alter' %}</button>
|
|
||||||
{% break %}
|
|
||||||
{% endswitch %}
|
|
||||||
<a href="{% route 'lean.console:storage.database_insert', [ 'source' => $entity ] %}" class="btn-purple btn-sm">{% _ 'database.table.add-column' %}</a>
|
<a href="{% route 'lean.console:storage.database_insert', [ 'source' => $entity ] %}" class="btn-purple btn-sm">{% _ 'database.table.add-column' %}</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% endforeach %}
|
{% endforeach %}
|
||||||
{% ui:endform %}
|
</article>
|
||||||
</article>
|
</section>
|
||||||
</section>
|
{% endforeach %}
|
||||||
{% endforeach %}
|
{% ui:endform %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
.connection .single-table {padding: 10px 5px 10px 5px;}
|
.connection .single-table {padding: 10px 5px 10px 5px;}
|
||||||
.connection .single-table:nth-child(2n + 1) {background: #fafafa;}
|
.connection .single-table:nth-child(2n + 1) {background: #fafafa;}
|
||||||
|
|||||||
Reference in new issue
Block a user