PHRAS-2161_coll-id-in-log-docs_MASTER

- explicit message when databox is failed to mount.
- reconnect db for long migration scripts
- mark (comment) doctrine "binary_strings" type so the upgrade is not done every time because the field was read-back as "varchar"
- proposal on long migration scripts (could be faster)
This commit is contained in:
Jean-Yves Gaulier
2018-08-16 10:07:40 +02:00
parent e94292a44c
commit f7b103af3d
4 changed files with 57 additions and 4 deletions

View File

@@ -12,6 +12,7 @@
namespace Alchemy\Phrasea\Model\Types;
use Doctrine\DBAL\Types\Type;
use Doctrine\DBAL\Platforms\MySqlPlatform;
use Doctrine\DBAL\Platforms\AbstractPlatform;
class BinaryString extends Type
@@ -23,10 +24,21 @@ class BinaryString extends Type
return static::BINARY_STRING;
}
/**
* {@inheritdoc}
*
* @see: https://blog.vandenbrand.org/2015/06/25/creating-a-custom-doctrine-dbal-type-the-right-way/
* about the reason of the COMMENT in the column
*/
public function getSQLDeclaration(array $fieldDeclaration, AbstractPlatform $platform)
{
if ($platform->getName() === 'mysql') {
return $platform->getVarcharTypeDeclarationSQL($fieldDeclaration)." ". $platform->getCollationFieldDeclaration('utf8_bin');
/** @var MySqlPlatform $platform */
return $platform->getVarcharTypeDeclarationSQL($fieldDeclaration)
// . " CHARACTER SET utf8"
. " " . $platform->getColumnCollationDeclarationSQL('utf8_bin')
. " COMMENT '(DC2Type:binary_string)'"
;
}
return $platform->getVarcharTypeDeclarationSQL($fieldDeclaration);
@@ -39,4 +51,12 @@ class BinaryString extends Type
{
return $platform->getVarcharDefaultLength();
}
/**
* @inheritdoc
*/
public function requiresSQLCommentHint(AbstractPlatform $platform)
{
return true;
}
}