migrations/Version20150828082547.php line 1

Open in your IDE?
  1. <?php
  2. namespace DoctrineMigrations;
  3. use Doctrine\DBAL\Schema\Schema;
  4. use Doctrine\Migrations\AbstractMigration;
  5. /**
  6.  * Auto-generated Migration: Please modify to your needs!
  7.  */
  8. class Version20150828082547 extends AbstractMigration
  9. {
  10.     public function up(Schema $schema): void
  11.     {
  12.         // this up() migration is auto-generated, please modify it to your needs
  13.         $this->abortIf($this->connection->getDatabasePlatform()->getName() != 'mysql''Migration can only be executed safely on \'mysql\'.');
  14.         $this->addSql('CREATE TABLE attached_files (id INT AUTO_INCREMENT NOT NULL, invoice_id INT DEFAULT NULL, path VARCHAR(255) NOT NULL, name VARCHAR(255) NOT NULL, created_at DATETIME NOT NULL, updated DATETIME NOT NULL, deletedAt DATETIME DEFAULT NULL, description VARCHAR(255) DEFAULT NULL, UNIQUE INDEX UNIQ_B64A5792989F1FD (invoice_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB');
  15.         $this->addSql('ALTER TABLE attached_files ADD CONSTRAINT FK_B64A5792989F1FD FOREIGN KEY (invoice_id) REFERENCES invoice (id) ON DELETE SET NULL');
  16.         $this->addSql('ALTER TABLE customer ADD uuid LONGTEXT DEFAULT NULL');
  17.         $this->addSql('ALTER TABLE invoice ADD attachedFile_id INT DEFAULT NULL');
  18.         $this->addSql('ALTER TABLE invoice ADD CONSTRAINT FK_906517449E26D65E FOREIGN KEY (attachedFile_id) REFERENCES attached_files (id) ON DELETE SET NULL');
  19.         $this->addSql('CREATE UNIQUE INDEX UNIQ_906517449E26D65E ON invoice (attachedFile_id)');
  20.         $this->addSql('ALTER TABLE attached_files ADD uuid VARCHAR(255) NOT NULL');
  21.     }
  22.     public function down(Schema $schema): void
  23.     {
  24.         // this down() migration is auto-generated, please modify it to your needs
  25.         $this->abortIf($this->connection->getDatabasePlatform()->getName() != 'mysql''Migration can only be executed safely on \'mysql\'.');
  26.         $this->addSql('ALTER TABLE invoice DROP FOREIGN KEY FK_906517449E26D65E');
  27.         $this->addSql('DROP TABLE attached_files');
  28.         $this->addSql('ALTER TABLE customer DROP uuid');
  29.         $this->addSql('DROP INDEX UNIQ_906517449E26D65E ON invoice');
  30.         $this->addSql('ALTER TABLE invoice DROP attachedFile_id');
  31.         $this->addSql('ALTER TABLE attached_files DROP uuid');
  32.     }
  33. }