{% extends '@WebProfiler/Profiler/layout.html.twig' %}
{% block toolbar %}
    {% if collector.data.unavailable_migrations_count is defined %}
        {% set unavailable_migrations = collector.data.unavailable_migrations_count %}
        {% set new_migrations = collector.data.new_migrations|length %}
        {% if unavailable_migrations > 0 or new_migrations > 0 %}
            {% set executed_migrations = collector.data.executed_migrations|length %}
            {% set available_migrations = collector.data.available_migrations_count %}
            {% set status_color = unavailable_migrations > 0 ? 'yellow' : '' %}
            {% set status_color = new_migrations > 0 ? 'red' : status_color %}
            {% set icon %}
                {% if profiler_markup_version < 3 %}
                    {{ include('@DoctrineMigrations/Collector/icon.svg') }}
                {% else %}
                    {{ include('@DoctrineMigrations/Collector/icon-v3.svg') }}
                {% endif %}
                {{ new_migrations + unavailable_migrations }}
            {% endset %}
            {% set text %}
                
        
            {{ num_executed_migrations }}
            Executed
        
        {% if profiler_markup_version >= 3 %}
            
        {% endif %}
        
            {{ num_unavailable_migrations }}
            Unavailable
        
        
            {{ num_available_migrations }}
            Available
        
        
            {{ num_new_migrations }}
            New
        
        {% if profiler_markup_version >= 3 %}
            
 {# closes the 
 #}
        {% endif %}
    
    
        
            
                Migrations
                
                    {{ num_new_migrations > 0 ? num_new_migrations : num_unavailable_migrations > 0 ? num_unavailable_migrations : num_executed_migrations }}
                
            
            
                {{ _self.render_migration_details(collector, profiler_markup_version) }}
            
         
        
            Configuration
            
                {{ _self.render_configuration_details(collector, profiler_markup_version) }}
            
         
     
{% endblock %}
{% macro render_migration_details(collector) %}
    
        
        
            | Version | Description | Status | Executed at | Execution time | 
        
        {% for migration in collector.data.new_migrations %}
            {{ _self.render_migration(migration) }}
        {% endfor %}
        {% for migration in collector.data.executed_migrations|reverse %}
            {{ _self.render_migration(migration) }}
        {% endfor %}
    
{% endmacro %}
{% macro render_configuration_details(collector) %}
    
        
        
            | Storage | 
        
        
            | Type | {{ collector.data.storage }} | 
        {% if collector.data.table is defined %}
            
                | Table Name | {{ collector.data.table }} | 
        {% endif %}
        {% if collector.data.column is defined %}
            
                | Column Name | {{ collector.data.column }} | 
        {% endif %}
    
    
        
        
            | Database | 
        
        
            | Driver | {{ collector.data.driver }} | 
        
            | Name | {{ collector.data.name }} | 
    
    
        
        
            | Migration Namespaces | 
        
        {% for namespace, directory in collector.data.namespaces %}
            
                | {{ namespace }} | {{ directory }} | 
        {% endfor %}
    
{% endmacro %}
{% macro render_migration(migration, profiler_markup_version) %}
    
        | {% if migration.file %}
                {{ migration.version }}
            {% else %}
                {{ migration.version }}
            {% endif %} | {{ migration.description }} | {% if migration.is_new %}
                NOT EXECUTED
            {% elseif migration.is_unavailable %}
                UNAVAILABLE
            {% else %}
                EXECUTED
            {% endif %} | {{ migration.executed_at ? migration.executed_at|date('M j, Y H:i') : 'n/a' }} | {% if migration.execution_time is null %}
                n/a
            {% elseif migration.execution_time < 1 %}
                {{ (migration.execution_time * 1000)|number_format(0) }} ms
            {% else %}
                {{ migration.execution_time|number_format(2) }} seconds
            {% endif %} | 
{% endmacro %}