migrations/Version20140709161111.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 Version20140709161111 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 job (id INT AUTO_INCREMENT NOT NULL, customer INT DEFAULT NULL, truck_id INT DEFAULT NULL, engineer INT DEFAULT NULL, job_code VARCHAR(255) NOT NULL, brief VARCHAR(255) DEFAULT NULL, notes VARCHAR(255) DEFAULT NULL, repeated_task_interval INT NOT NULL, notice_date DATETIME NOT NULL, cancelled TINYINT(1) NOT NULL, signed_off TINYINT(1) NOT NULL, cancellation_reason VARCHAR(255) DEFAULT NULL, accepted TINYINT(1) NOT NULL, INDEX IDX_FBD8E0F881398E09 (customer), INDEX IDX_FBD8E0F8C6957CCE (truck_id), INDEX IDX_FBD8E0F894176AD9 (engineer), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB');
  15.         $this->addSql('ALTER TABLE job ADD CONSTRAINT FK_FBD8E0F881398E09 FOREIGN KEY (customer) REFERENCES customer (id)');
  16.         $this->addSql('ALTER TABLE job ADD CONSTRAINT FK_FBD8E0F8C6957CCE FOREIGN KEY (truck_id) REFERENCES truck (id)');
  17.         $this->addSql('ALTER TABLE job ADD CONSTRAINT FK_FBD8E0F894176AD9 FOREIGN KEY (engineer) REFERENCES user (id)');
  18.     }
  19.     public function down(Schema $schema): void
  20.     {
  21.         // this down() migration is auto-generated, please modify it to your needs
  22.         $this->abortIf($this->connection->getDatabasePlatform()->getName() != 'mysql'"Migration can only be executed safely on 'mysql'.");
  23.         $this->addSql('DROP TABLE job');
  24.     }
  25. }