{% extends 'table/page_with_secondary_tabs.twig' %} {% block content %}
{{ get_hidden_inputs(db, table) }} {# InnoDB #} {% if is_foreign_key_supported(tbl_storage_engine) %}
{% trans 'Foreign key constraints' %}
{% if tbl_storage_engine|upper == 'INNODB' %} {% else %} {% endif %} {% set i = 0 %} {% if existrel_foreign is not empty %} {% for key, one_key in existrel_foreign %} {# Foreign database dropdown #} {% set foreign_db = one_key['ref_db_name'] is defined and one_key['ref_db_name'] is not null ? one_key['ref_db_name'] : db %} {% set foreign_table = false %} {% if foreign_db %} {% set foreign_table = one_key['ref_table_name'] is defined and one_key['ref_table_name'] is not null ? one_key['ref_table_name'] : false %} {% endif %} {% set unique_columns = [] %} {% if foreign_db and foreign_table %} {% set table_obj = table_get(foreign_table, foreign_db) %} {% set unique_columns = table_obj.getUniqueColumns(false, false) %} {% endif %} {% include 'table/relation/foreign_key_row.twig' with { 'i': i, 'one_key': one_key, 'column_array': column_array, 'options_array': options_array, 'tbl_storage_engine': tbl_storage_engine, 'db': db, 'table': table, 'url_params': url_params, 'databases': databases, 'foreign_db': foreign_db, 'foreign_table': foreign_table, 'unique_columns': unique_columns } only %} {% set i = i + 1 %} {% endfor %} {% endif %} {% include 'table/relation/foreign_key_row.twig' with { 'i': i, 'one_key': [], 'column_array': column_array, 'options_array': options_array, 'tbl_storage_engine': tbl_storage_engine, 'db': db, 'table': table, 'url_params': url_params, 'databases': databases, 'foreign_db': foreign_db, 'foreign_table': foreign_table, 'unique_columns': unique_columns } only %} {% set i = i + 1 %}
{% trans 'Actions' %} {% trans 'Constraint properties' %} {% trans 'Column' %} {{ show_hint('Creating a foreign key over a non-indexed column would automatically create an index on it. Alternatively, you can define an index below, before creating the foreign key.'|trans) }} {% trans 'Column' %} {{ show_hint('Only columns with index will be displayed. You can define an index below.'|trans) }} {% trans 'Foreign key constraint' %} ({{ tbl_storage_engine }})
{% trans 'Database' %} {% trans 'Table' %} {% trans 'Column' %}
{% trans '+ Add constraint' %}
{% endif %} {% if cfg_relation['relwork'] %} {% if is_foreign_key_supported(tbl_storage_engine) %} {% endif %} {% endif %} {% if cfg_relation['displaywork'] %} {% set disp = get_display_field(db, table) %}
{% endif %}
{% endblock %}