mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-17 23:13:15 +00:00
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:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user