- 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 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);
|
||||
|
||||
@@ -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(); %}
|
||||
|
||||
<section class="connection">
|
||||
<header>
|
||||
<div class="icon-database icon-purple">
|
||||
{% include "lean-console/svg/icon-database.svg" %}
|
||||
</div>
|
||||
<section class="connection">
|
||||
<header>
|
||||
<div class="icon-database icon-purple">
|
||||
{% include "lean-console/svg/icon-database.svg" %}
|
||||
</div>
|
||||
|
||||
<h2>{% _.raw 'database.connection', [ 'name' => $connection->name ] %}</h2>
|
||||
</header>
|
||||
<h2>{% _.raw 'database.connection', [ 'name' => $connection->name ] %}</h2>
|
||||
</header>
|
||||
|
||||
<article>
|
||||
{% ui:form.post "database.migrate", current_url() %}
|
||||
<article>
|
||||
{% 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="col-5 col-xxl flex align-items-center">
|
||||
<div class="icon-yellow">
|
||||
@@ -45,6 +49,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-5 col-lg flex align-items-center">
|
||||
{% if $context->definition[$entity]['table']->modifier->query ?? false %}
|
||||
<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="btn-wrapper">
|
||||
{% switch $context->definition[$entity]['table']->modifier->type ?? false %}
|
||||
{% case ModifierTypeEnum::Create %}
|
||||
{% php $createAll[] = $entity %}
|
||||
<button name="create" value="{{$entity}}" class="btn-red btn-sm">✓ {% _ 'database.table.create' %}</button>
|
||||
</div>
|
||||
{% break %}
|
||||
{% switch $context->definition[$entity]['table']->modifier->type ?? false %}
|
||||
{% case ModifierTypeEnum::Create %}
|
||||
{% php $createAll[] = $entity %}
|
||||
<button name="create" value="{{$entity}}" class="btn-red btn-sm">✓ {% _ 'database.table.create' %}</button>
|
||||
{% 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>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endforeach %}
|
||||
{% ui:endform %}
|
||||
</article>
|
||||
</section>
|
||||
{% endforeach %}
|
||||
</article>
|
||||
</section>
|
||||
{% endforeach %}
|
||||
{% ui:endform %}
|
||||
{% endif %}
|
||||
|
||||
<style>
|
||||
.connection .single-table {padding: 10px 5px 10px 5px;}
|
||||
.connection .single-table:nth-child(2n + 1) {background: #fafafa;}
|
||||
|
||||
Reference in new issue
Block a user