HegreEtConfort/migrations/Version20241205162005.php

51 lines
2.1 KiB
PHP
Raw Permalink Normal View History

2024-12-12 16:28:23 +01:00
<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20241205162005 extends AbstractMigration
{
public function getDescription(): string
{
return '';
}
public function up(Schema $schema): void
{
// this up() migration is auto-generated, please modify it to your needs
$this->addSql('CREATE SEQUENCE fault_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
$this->addSql('CREATE SEQUENCE intervention_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
$this->addSql('CREATE SEQUENCE skill_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
$this->addSql('CREATE SEQUENCE stock_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
$this->addSql('CREATE SEQUENCE user_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
$this->addSql('CREATE SEQUENCE vehicle_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
$this->addSql('ALTER TABLE "user" ADD roles JSON NOT NULL');
$this->addSql('ALTER TABLE "user" ALTER email TYPE VARCHAR(180)');
$this->addSql('ALTER TABLE "user" RENAME COLUMN type TO password');
$this->addSql('CREATE UNIQUE INDEX UNIQ_IDENTIFIER_EMAIL ON "user" (email)');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('CREATE SCHEMA public');
$this->addSql('DROP SEQUENCE fault_id_seq CASCADE');
$this->addSql('DROP SEQUENCE intervention_id_seq CASCADE');
$this->addSql('DROP SEQUENCE skill_id_seq CASCADE');
$this->addSql('DROP SEQUENCE stock_id_seq CASCADE');
$this->addSql('DROP SEQUENCE user_id_seq CASCADE');
$this->addSql('DROP SEQUENCE vehicle_id_seq CASCADE');
$this->addSql('DROP INDEX UNIQ_IDENTIFIER_EMAIL');
$this->addSql('ALTER TABLE "user" DROP roles');
$this->addSql('ALTER TABLE "user" ALTER email TYPE VARCHAR(255)');
$this->addSql('ALTER TABLE "user" RENAME COLUMN password TO type');
}
}