2024-11-29 21:50:31 -05: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 !
*/
2024-11-30 19:53:26 -05:00
final class Version20241130210724 extends AbstractMigration
2024-11-29 21:50:31 -05:00
{
public function getDescription () : string
{
return '' ;
}
public function up ( Schema $schema ) : void
{
// this up() migration is auto-generated, please modify it to your needs
2024-11-30 19:53:26 -05:00
$this -> addSql ( 'CREATE TABLE supervision (id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\', supervisor_id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\', worker_id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\', INDEX IDX_30C258C019E9AC5F (supervisor_id), UNIQUE INDEX UNIQ_30C258C06B20BA36 (worker_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB' );
$this -> addSql ( 'ALTER TABLE supervision ADD CONSTRAINT FK_30C258C019E9AC5F FOREIGN KEY (supervisor_id) REFERENCES user (id)' );
2024-11-29 21:50:31 -05:00
$this -> addSql ( 'ALTER TABLE supervision ADD CONSTRAINT FK_30C258C06B20BA36 FOREIGN KEY (worker_id) REFERENCES user (id)' );
2024-11-30 19:53:26 -05:00
$this -> addSql ( 'ALTER TABLE user DROP supervisor_id' );
2024-11-29 21:50:31 -05:00
}
public function down ( Schema $schema ) : void
{
// this down() migration is auto-generated, please modify it to your needs
2024-11-30 19:53:26 -05:00
$this -> addSql ( 'ALTER TABLE supervision DROP FOREIGN KEY FK_30C258C019E9AC5F' );
2024-11-29 21:50:31 -05:00
$this -> addSql ( 'ALTER TABLE supervision DROP FOREIGN KEY FK_30C258C06B20BA36' );
$this -> addSql ( 'DROP TABLE supervision' );
2024-11-30 19:53:26 -05:00
$this -> addSql ( 'ALTER TABLE user ADD supervisor_id BINARY(16) DEFAULT NULL COMMENT \'(DC2Type:uuid)\'' );
2024-11-29 21:50:31 -05:00
}
}