{% extends "massmigration/base.html" %}

{% block content %}

<h1>Migrations</h1>
<table class="massmigrations">
	<thead>
		<tr>
			<th>App</th>
			<th>Migration</th>
			<th>Status</th>
			<th>Actions</th>
		</tr>
	</thead>
	<tbody>
	{% for migration in migrations %}
		<tr>
			<td>{{migration.app_label}}</td>
			<td>{{migration.name}}</td>
			<td>{% if migration.record.is_applied %}APPLIED{% elif migration.record.has_error %}ERRORED{% elif migration.record %}INITIATED{% else %}NOT RUN{% endif %}</td>
			<td>
				{% if not migration.record %}<a href="{% url 'massmigration_run' key=migration.key %}">Run...</a>
				{% elif migration.record.has_error %}<a href="{% url 'massmigration_delete' key=migration.key %}">Delete...</a>
				{% else %}-
				{% endif %}
			</td>
		</tr>
	{% endfor %}
	</tbody>
</table>

{% endblock %}
