concatPrefix(Task::TABLE_NAME); $table = $this->entityManager->getConnection()->createSchemaManager()->introspectTable($tasks); if (!$table->hasColumn('start_date')) { $this->addSql("ALTER TABLE {$tasks} ADD start_date DATETIME DEFAULT NULL"); } if (!$table->hasColumn('end_date')) { $this->addSql("ALTER TABLE {$tasks} ADD end_date DATETIME DEFAULT NULL"); } if (!$table->hasColumn('status')) { $this->addSql(sprintf( "ALTER TABLE %s ADD status VARCHAR(20) DEFAULT '%s' NOT NULL", $tasks, TaskStatus::New->value )); } if (!$table->hasIndex(self::STATUS_INDEX)) { // Same name as in the Task mapping (index names aren't prefixed). $this->addSql('CREATE INDEX '.self::STATUS_INDEX." ON {$tasks} (status)"); } } }