migrations.html.twig 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  1. {% extends '@WebProfiler/Profiler/layout.html.twig' %}
  2. {% import _self as helper %}
  3. {% block toolbar %}
  4. {% set unavailable_migrations = collector.data.unavailable_migrations|length %}
  5. {% set new_migrations = collector.data.new_migrations|length %}
  6. {% if unavailable_migrations > 0 or new_migrations > 0 %}
  7. {% set executed_migrations = collector.data.executed_migrations|length %}
  8. {% set available_migrations = collector.data.available_migrations|length %}
  9. {% set status_color = unavailable_migrations > 0 ? 'yellow' : '' %}
  10. {% set status_color = new_migrations > 0 ? 'red' : status_color %}
  11. {% set icon %}
  12. {{ include('@DoctrineMigrations/Collector/icon.svg') }}
  13. <span class="sf-toolbar-value">{{ new_migrations + unavailable_migrations }}</span>
  14. {% endset %}
  15. {% set text %}
  16. <div class="sf-toolbar-info-piece">
  17. <b>Current</b>
  18. <span>{{ executed_migrations > 0 ? collector.data.executed_migrations|last.version|split('\\')|last : 'n/a' }}</span>
  19. </div>
  20. <div class="sf-toolbar-info-piece">
  21. <b>Executed</b>
  22. <span class="sf-toolbar-status">{{ executed_migrations }}</span>
  23. </div>
  24. <div class="sf-toolbar-info-piece">
  25. <b>Executed Unavailable</b>
  26. <span class="sf-toolbar-status {{ unavailable_migrations > 0 ? 'sf-toolbar-status-yellow' }}">{{ unavailable_migrations }}</span>
  27. </div>
  28. <div class="sf-toolbar-info-piece">
  29. <b>Available</b>
  30. <span class="sf-toolbar-status">{{ available_migrations }}</span>
  31. </div>
  32. <div class="sf-toolbar-info-piece">
  33. <b>New</b>
  34. <span class="sf-toolbar-status {{ new_migrations > 0 ? 'sf-toolbar-status-red' }}">{{ new_migrations }}</span>
  35. </div>
  36. {% endset %}
  37. {{ include('@WebProfiler/Profiler/toolbar_item.html.twig', { link: profiler_url, status: status_color }) }}
  38. {% endif %}
  39. {% endblock %}
  40. {% block menu %}
  41. {% set unavailable_migrations = collector.data.unavailable_migrations|length %}
  42. {% set new_migrations = collector.data.new_migrations|length %}
  43. {% set label = unavailable_migrations > 0 ? 'label-status-warning' : '' %}
  44. {% set label = new_migrations > 0 ? 'label-status-error' : label %}
  45. <span class="label {{ label }}">
  46. <span class="icon">{{ include('@DoctrineMigrations/Collector/icon.svg') }}</span>
  47. <strong>Migrations</strong>
  48. {% if unavailable_migrations > 0 or new_migrations > 0 %}
  49. <span class="count">
  50. <span>{{ new_migrations + unavailable_migrations }}</span>
  51. </span>
  52. {% endif %}
  53. </span>
  54. {% endblock %}
  55. {% block panel %}
  56. <h2>Doctrine Migrations</h2>
  57. <div class="metrics">
  58. <div class="metric">
  59. <span class="value">{{ collector.data.executed_migrations|length }}</span>
  60. <span class="label">Executed</span>
  61. </div>
  62. <div class="metric">
  63. <span class="value">{{ collector.data.unavailable_migrations|length }}</span>
  64. <span class="label">Executed Unavailable</span>
  65. </div>
  66. <div class="metric">
  67. <span class="value">{{ collector.data.available_migrations|length }}</span>
  68. <span class="label">Available</span>
  69. </div>
  70. <div class="metric">
  71. <span class="value">{{ collector.data.new_migrations|length }}</span>
  72. <span class="label">New</span>
  73. </div>
  74. </div>
  75. <h3>Configuration</h3>
  76. <table>
  77. <thead>
  78. <tr>
  79. <th colspan="2" class="colored font-normal">Storage</th>
  80. </tr>
  81. </thead>
  82. <tr>
  83. <td class="font-normal">Type</td>
  84. <td class="font-normal">{{ collector.data.storage }}</td>
  85. </tr>
  86. {% if collector.data.table is defined %}
  87. <tr>
  88. <td class="font-normal">Table Name</td>
  89. <td class="font-normal">{{ collector.data.table }}</td>
  90. </tr>
  91. {% endif %}
  92. {% if collector.data.column is defined %}
  93. <tr>
  94. <td class="font-normal">Column Name</td>
  95. <td class="font-normal">{{ collector.data.column }}</td>
  96. </tr>
  97. {% endif %}
  98. </table>
  99. <table>
  100. <thead>
  101. <tr>
  102. <th colspan="2" class="colored font-normal">Database</th>
  103. </tr>
  104. </thead>
  105. <tr>
  106. <td class="font-normal">Driver</td>
  107. <td class="font-normal">{{ collector.data.driver }}</td>
  108. </tr>
  109. <tr>
  110. <td class="font-normal">Name</td>
  111. <td class="font-normal">{{ collector.data.name }}</td>
  112. </tr>
  113. </table>
  114. <table>
  115. <thead>
  116. <tr>
  117. <th colspan="2" class="colored font-normal">Migration Namespaces</th>
  118. </tr>
  119. </thead>
  120. {% for namespace, directory in collector.data.namespaces %}
  121. <tr>
  122. <td class="font-normal">{{ namespace }}</td>
  123. <td class="font-normal">{{ directory }}</td>
  124. </tr>
  125. {% endfor %}
  126. </table>
  127. <h3>Migrations</h3>
  128. <table>
  129. <thead>
  130. <tr>
  131. <th class="colored font-normal">Version</th>
  132. <th class="colored font-normal">Description</th>
  133. <th class="colored font-normal">Status</th>
  134. <th class="colored font-normal">Executed at</th>
  135. <th class="colored font-normal">Execution time</th>
  136. </tr>
  137. </thead>
  138. {% for migration in collector.data.new_migrations %}
  139. {{ helper.render_migration(migration) }}
  140. {% endfor %}
  141. {% for migration in collector.data.executed_migrations|reverse %}
  142. {{ helper.render_migration(migration) }}
  143. {% endfor %}
  144. </table>
  145. {% endblock %}
  146. {% macro render_migration(migration) %}
  147. <tr>
  148. <td class="font-normal">
  149. {% if migration.file %}
  150. <a href="{{ migration.file|file_link(1) }}" title="{{ migration.file }}">{{ migration.version }}</a>
  151. {% else %}
  152. {{ migration.version }}
  153. {% endif %}
  154. </td>
  155. <td class="font-normal">{{ migration.description }}</td>
  156. <td class="font-normal">
  157. {% if migration.is_new %}
  158. <span class="label status-error">NOT EXECUTED</span>
  159. {% elseif migration.is_unavailable %}
  160. <span class="label status-warning">UNAVAILABLE</span>
  161. {% else %}
  162. <span class="label status-success">EXECUTED</span>
  163. {% endif %}
  164. </td>
  165. <td class="font-normal">{{ migration.executed_at ? migration.executed_at|date : 'n/a' }}</td>
  166. <td class="font-normal">{{ migration.execution_time|default('n/a') }}</td>
  167. </tr>
  168. {% endmacro %}