/**
  * {@inheritdoc}
  */
 public function up(Schema $schema, QueryBag $queries)
 {
     // fill createdAt and updatedAt
     $queries->addPreQuery(new ParametrizedSqlMigrationQuery('UPDATE oro_calendar_event SET created_at = :date, updated_at = :date', ['date' => new \DateTime('now', new \DateTimeZone('UTC'))], ['date' => Type::DATETIME]));
     // copy title to description if needed
     $queries->addPreQuery(new ParametrizedSqlMigrationQuery(sprintf('UPDATE oro_calendar_event SET description = title WHERE %s > 255 OR title LIKE :new_line', $this->platform->getLengthExpression('title')), ['new_line' => '%\\n%'], ['new_line' => Type::STRING]));
     // trim title
     $locateExpr = $this->platform->getLocateExpression('title', ':lf');
     $queries->addPreQuery(new ParametrizedSqlMigrationQuery(sprintf('UPDATE oro_calendar_event SET title = %s WHERE %s > 0', $this->platform->getSubstringExpression(sprintf('REPLACE(%s, :cr, :empty)', $this->platform->getSubstringExpression('title', 1, $locateExpr)), 1, 255), $locateExpr), ['lf' => '\\n', 'cr' => '\\r', 'empty' => ''], ['lf' => Type::STRING, 'cr' => Type::STRING, 'empty' => Type::STRING]));
     $queries->addPreQuery(sprintf('UPDATE oro_calendar_event SET title = %s WHERE %s > 255', $this->platform->getSubstringExpression('title', 1, 255), $this->platform->getLengthExpression('title')));
     $table = $schema->getTable('oro_calendar_event');
     $table->getColumn('title')->setType(Type::getType(Type::STRING))->setOptions(['length' => 255]);
     $table->getColumn('created_at')->setOptions(['notnull' => true]);
     $table->getColumn('updated_at')->setOptions(['notnull' => true]);
     $this->enableDataAudit($table);
 }
 /**
  * Returns the length of text field $column.
  *
  * @param string $column
  *
  * @return string
  */
 public function length($column)
 {
     return $this->platform->getLengthExpression($column);
 }