{% extends "page.html" %}

{% block main %}
<div id="main" class="container">
    <div class="row">
        <div class="col-lg-10 col-lg-offset-1">
        
            <h2>Database Upgrade Required</h2>

            <p>A recent upgrade to ContainDS Dashboards requires your database to be upgraded.</p>

            {% if is_admin %}

                {% if error %}

                    <p class="error">There was a problem upgrading the database:</p>

                    <pre>{{ error | escape }}</pre>

                {% endif %}

                
                {% if success %}

                    <p>Database upgrade successful!</p>

                {% else %}

                    <form method="post" class="dashboard-edit-form">

                    <p>You may see server errors elsewhere on this site ('500' errors) until the database is upgraded - this is expected behavior.</p>

                    {% if is_sqlite %}

                    <p>Please click the button below. Your sqlite database will be backed up automatically into the same folder as the original.</p>

                    {% else %}

                    <p>For peace of mind please back up your database, and then click the button below.</p>

                    {% endif %}

                    <input type="submit" value="Upgrade Database" />

                    </form>

                {% endif %}

            {% else %}

            <p>Please ask an admin user to visit this page where they will be able to perform the upgrade.</p>

            <p>You may see server errors elsewhere on this site ('500' errors) until the database is upgraded - this is expected behavior.</p>        

            {% endif %}

        </div>
    </div>
</div>
{% endblock main %}
