Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch description for custom object to longer type #320

Open
wants to merge 1 commit into
base: staging
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Config/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
$coParams = [
'name' => 'Custom Objects',
'description' => 'Adds custom objects and fields features to Mautic',
'version' => '0.0.27',
'version' => '0.0.28',
'author' => 'Mautic, Inc.',

'routes' => [
Expand Down
3 changes: 2 additions & 1 deletion Entity/CustomObject.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\DBAL\Types\Type;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
use Doctrine\ORM\Mapping\JoinColumn;
use Doctrine\ORM\Mapping\OneToOne;
Expand Down Expand Up @@ -168,7 +169,7 @@ public static function loadMetadata(ORM\ClassMetadata $metadata): void
$builder->addField('alias', Type::STRING);
$builder->addNamedField('nameSingular', Type::STRING, 'name_singular');
$builder->addNamedField('namePlural', Type::STRING, 'name_plural');
$builder->addNullableField('description', Type::STRING, 'description');
$builder->addNullableField('description', Types::TEXT, 'description');
$builder->addNullableField('language', Type::STRING, 'lang');
$builder->addNullableField('type', Type::INTEGER);

Expand Down
38 changes: 38 additions & 0 deletions Migrations/Version_0_0_28.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<?php

declare(strict_types=1);

namespace MauticPlugin\CustomObjectsBundle\Migrations;

use Doctrine\DBAL\Schema\Schema;
use Mautic\IntegrationsBundle\Migration\AbstractMigration;

final class Version_0_0_28 extends AbstractMigration
{
private Schema $schema;

private string $table = 'custom_object';

protected function up(): void
{
$this->addSql("
ALTER TABLE `{$this->concatPrefix($this->table)}`
CHANGE `description` `description` TEXT
");
}

protected function isApplicable(Schema $schema): bool
{
$this->schema = $schema;

return true;
}

public function down(Schema $schema): void
{
$this->addSql("
ALTER TABLE `{$this->concatPrefix($this->table)}`
CHANGE `description` `description` VARCHAR(191)
");
}
}