{% extends 'table/page_with_secondary_tabs.twig' %} {% block content %}

{{table}}

{{ get_hidden_inputs(db, table) }}
{# Table header #} {% if show_column_comments -%} {%- endif %} {# @see table/structure.js, function moreOptsMenuResize() #} {% if not db_is_system_schema and not tbl_is_view %} {% endif %} {# Table body #} {% set rownum = 0 %} {% for row in fields %} {% set rownum = rownum + 1 %} {% set extracted_columnspec = extracted_columnspecs[rownum] %} {% set field_name = row['Field']|e %} {# For column comments #} {% set comments = row_comments[rownum] %} {# Underline commented fields and display a hover-title (CSS only) #} {{ extracted_columnspec['displayed_type']|raw }} {% if relation_parameters.columnCommentsFeature is not null and relation_parameters.browserTransformationFeature is not null and browse_mime and mime_map[row['Field']]['mimetype'] is defined %}
{% trans 'Media type:' %} {{ mime_map[row['Field']]['mimetype']|replace({'_': '/'})|lower }} {% endif %}
{% if show_column_comments %} {% endif %} {% if not tbl_is_view and not db_is_system_schema %} {% endif %} {% if not tbl_is_view and not db_is_system_schema %} {% set type = extracted_columnspec['print_type'] is not empty ? extracted_columnspec['print_type'] %} {% endif %} {% endfor %}
# {% trans 'Name' %} {% trans 'Type' %} {% trans 'Collation' %} {% trans 'Attributes' %} {% trans 'Null' %} {% trans 'Default' %}{% trans 'Comments' %}{% trans 'Extra' %}{% trans 'Action' %}
{{ rownum }} {% if row['Collation'] is not empty %} {{ collations[row['Collation']].name }} {% endif %} {{ attributes[rownum] }} {{ row['Null'] == 'YES' ? 'Yes'|trans : 'No'|trans }} {%- if row['Default'] is not null -%} {%- if extracted_columnspec['type'] == 'bit' -%} {{- row['Default']|convert_bit_default_value -}} {%- else -%} {{- row['Default'] -}} {%- endif -%} {%- elseif row['Null'] == 'YES' -%} NULL {%- else -%} {% trans %}None{% context %}None for default{% endtrans %} {%- endif -%} {{ comments }} {{ row['Extra']|upper }} {{ get_icon('b_edit', 'Change'|trans) }} {{ get_icon('b_drop', 'Drop'|trans) }} {% if hide_structure_actions %} {% endif %}
{% include 'select_all.twig' with { 'text_dir': text_dir, 'form_name': 'fieldsForm' } only %} {% if not tbl_is_view and not db_is_system_schema %} {% if tbl_storage_engine != 'ARCHIVE' %} {% if relation_parameters.centralColumnsFeature is not null %} {% endif %} {% endif %} {% endif %}

{# Work on the table #} {% if not tbl_is_view and not db_is_system_schema %}
{{ get_hidden_inputs(db, table) }} {% if show_icons('ActionLinksMode') %} {{ get_image('b_insrow', 'Add column'|trans) }}  {% endif %} {% set num_fields -%} {%- endset %} {{ 'Add %s column(s)'|trans|format(num_fields)|raw }}   {# I tried displaying the drop-down inside the label but with Firefox the drop-down was blinking #}
{% endif %} {% if not tbl_is_view and not db_is_system_schema and tbl_storage_engine != 'ARCHIVE' %}
{% trans 'Indexes' %} {{ show_mysql_docu('optimizing-database-structure') }} {% if indexes is not empty %} {{ indexes_duplicates|raw }} {{ include('modals/preview_sql_confirmation.twig') }}
{% for index in indexes %} {% set columns_count = index.getColumnCount() %} {% for column in index.getColumns() %} {% if column.getSeqInIndex() > 1 %} {% endif %} {% if column.getSeqInIndex() == 1 %} {% endif %} {% endfor %} {% endfor %}
{% trans 'Action' %} {% trans 'Keyname' %} {% trans 'Type' %} {% trans 'Unique' %} {% trans 'Packed' %} {% trans 'Column' %} {% trans 'Cardinality' %} {% trans 'Collation' %} {% trans 'Null' %} {% trans 'Comment' %}
{{ get_icon('b_edit', 'Edit'|trans) }} {{ get_icon('b_rename', 'Rename'|trans) }} {% if index.getName() == 'PRIMARY' %} {% set index_params = { 'sql_query': 'ALTER TABLE ' ~ backquote(table) ~ ' DROP PRIMARY KEY;', 'message_to_show': 'The primary key has been dropped.'|trans } %} {% else %} {% set index_params = { 'sql_query': 'ALTER TABLE ' ~ backquote(table) ~ ' DROP INDEX ' ~ backquote(index.getName()) ~ ';', 'message_to_show': 'Index %s has been dropped.'|trans|format(index.getName()) } %} {% endif %} {{ link_or_button( url('/sql'), index_params|merge({'db': db, 'table': table}), get_icon('b_drop', 'Drop'|trans), {'class': 'drop_primary_key_index_anchor ajax'} ) }} {{ index.getName() }} {{ index.getType()|default(index.getChoice()) }} {{ index.isUnique() ? 'Yes'|trans : 'No'|trans }} {{ index.isPacked()|raw }}
{% if column.hasExpression() %}{{ column.getExpression() }}{% else %}{{ column.getName() }}{% endif %} {% if column.getSubPart() is not empty %} ({{ column.getSubPart() }}) {% endif %} {{ column.getCardinality() }} {{ column.getCollation() }} {{ column.getNull(true) }}{{ index.getComments() }}
{% else %}
{{ 'No index defined!'|trans|notice }}
{% endif %}
{{ get_hidden_inputs(db, table) }} {% apply format('')|raw %} {% trans %}Create an index on %s columns{% endtrans %} {% endapply %}
{{ include('modals/index_dialog_modal.twig') }} {% endif %} {# Display partition details #} {% if have_partitioning %} {# Detect partitioning #} {% if partition_names is not empty and partition_names[0] is not null %} {% set first_partition = partitions[0] %} {% set range_or_list = first_partition.getMethod() == 'RANGE' or first_partition.getMethod() == 'RANGE COLUMNS' or first_partition.getMethod() == 'LIST' or first_partition.getMethod() == 'LIST COLUMNS' %} {% set sub_partitions = first_partition.getSubPartitions() %} {% set has_sub_partitions = first_partition.hasSubPartitions() %} {% if has_sub_partitions %} {% set first_sub_partition = sub_partitions[0] %} {% endif %} {% if default_sliders_state != 'disabled' %}
{% endif %} {% include 'table/structure/display_partitions.twig' with { 'db': db, 'table': table, 'partitions': partitions, 'partition_method': first_partition.getMethod(), 'partition_expression': first_partition.getExpression(), 'has_description': first_partition.getDescription() is not empty, 'has_sub_partitions': has_sub_partitions, 'sub_partition_method': has_sub_partitions ? first_sub_partition.getMethod(), 'sub_partition_expression': has_sub_partitions ? first_sub_partition.getExpression(), 'range_or_list': range_or_list } only %} {% else %} {% include 'table/structure/display_partitions.twig' with { 'db': db, 'table': table } only %} {% endif %} {% if default_sliders_state != 'disabled' %}
{% endif %} {% endif %} {# Displays Space usage and row statistics #} {% if show_stats %} {{ table_stats|raw }} {% endif %}
{% endblock %}