<?php

namespace Application\Migrations;

use Doctrine\DBAL\Migrations\AbstractMigration;
use Doctrine\DBAL\Schema\Schema;

/**
 * Update some fields related to constant class
 * Add the rep field for users
 */
class Version20160316143625 extends AbstractMigration
{
    /**
     * @param Schema $schema
     */
    public function up(Schema $schema)
    {
        $this->addSql("UPDATE fos_user SET type = 'teacher' WHERE type = 'Professeur'");
        $this->addSql("UPDATE fos_user SET type = 'engineer' WHERE type = 'Ingénieur/Technicien'");
        $this->addSql("UPDATE fos_user SET rep = 'level0' WHERE rep IS NULL");

        $this->addSql("UPDATE operationpee SET state = 'fenced' WHERE state = 'Clôturée'");
        $this->addSql("UPDATE operationpee SET state = 'closed' WHERE state = 'Fermée'");
        $this->addSql("UPDATE operationpee SET state = 'cancelled' WHERE state = 'Annulée'");
        $this->addSql("UPDATE operationpee SET state = 'open' WHERE state = 'Ouverte'");

        $this->addSql("UPDATE operationitdlc SET state = 'new' WHERE state = 'Nouvelle'");
        $this->addSql("UPDATE operationitdlc SET state = 'closed' WHERE state = 'Fermée'");
        $this->addSql("UPDATE operationitdlc SET state = 'cancelled' WHERE state = 'Annulée'");
    }

    /**
     * @param Schema $schema
     */
    public function down(Schema $schema)
    {
        
    }
}
