-
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
/
structure_snapshot_columns.twig
56 lines (56 loc) · 2.25 KB
/
structure_snapshot_columns.twig
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
<h3>{{ t('Structure') }}</h3>
<table id="tablestructure" class="table table-striped table-hover w-auto">
<thead>
<tr>
<th>{{ t('#', context = 'Number') }}</th>
<th>{{ t('Column') }}</th>
<th>{{ t('Type') }}</th>
<th>{{ t('Collation') }}</th>
<th>{{ t('Null') }}</th>
<th>{{ t('Default') }}</th>
<th>{{ t('Extra') }}</th>
<th>{{ t('Comment') }}</th>
</tr>
</thead>
<tbody>
{% set index = 1 %}
{% for field in columns %}
<tr class="noclick">
<td>{{ index }}</td>
{% set index = index + 1 %}
<td>
<strong>
{{ field['Field'] }}
{% if field['Key'] == 'PRI' %}
{{ get_image('b_primary', t('Primary')) }}
{% elseif field['Key'] is not empty %}
{{ get_image('bd_primary', t('Index')) }}
{% endif %}
</strong>
</td>
<td>{{ field['Type'] }}</td>
<td>{{ field['Collation'] }}</td>
<td>{{ field['Null'] == 'YES' ? t('Yes') : t('No') }}</td>
<td>
{% if field['Default'] is defined %}
{% set extracted_columnspec = extract_column_spec(field['Type']) %}
{% if extracted_columnspec['type'] == 'bit' %}
{# here, $field['Default'] contains something like b'010' #}
{{ field['Default']|convert_bit_default_value }}
{% else %}
{{ field['Default'] }}
{% endif %}
{% else %}
{% if field['Null'] == 'YES' %}
<em>NULL</em>
{% else %}
<em>{{ t('None', context = 'None for default') }}</em>
{% endif %}
{% endif %}
</td>
<td>{{ field['Extra'] }}</td>
<td>{{ field['Comment'] }}</td>
</tr>
{% endfor %}
</tbody>
</table>