DDC-3735: Problem with Collate #4584

Open
opened 2026-01-22 14:45:28 +01:00 by admin · 0 comments
Owner

Originally created by @doctrinebot on GitHub (May 13, 2015).

Originally assigned to: @Ocramius on GitHub.

Jira issue originally created by user hugohenrique:

I'm using Migrations and always when a new version changes in my schema in action up SQL removes the definition of the table COLLATE for example:

public function up(Schema $schema)
{
    $this->addSql('ALTER TABLE customer CHANGE user*id user*id CHAR(36) DEFAULT NULL COMMENT \'(DC2Type: guid)\'');
}

public function down(Schema $schema)
{
    $this->addSql('ALTER TABLE customer CHANGE user*id user_id CHAR(36) NULL DEFAULT COLLATE utf8_unicode*ci COMMENT \'(DC2Type: guid)\'');
}
/****
 * @ORM\Table(name="user")
 * @ORM\HasLifecycleCallbacks
 */
class User
{
    /****
     * @ORM\Id
     * @ORM\Column(type="guid", options={"unsigned"=true})
     * @ORM\GeneratedValue(strategy="UUID")
     */
    protected $id;

/****
 * @ORM\Entity
 * @ORM\Table(name="customer")
 */
class Customer
{
    /****
     * @ORM\Id
     * @ORM\Column(type="bigint", options={"unsigned"=true})
     * @ORM\GeneratedValue(strategy="AUTO")
     */
    protected $id;

    /****
     * @ORM\OneToOne(targetEntity="User")
     * @ORM\JoinColumn(name="user_id", referencedColumnName="id")
     */
    protected $user;

CREATE TABLE `user` (
  `id` varchar(255) COLLATE utf8*unicode*ci NOT NULL COMMENT '(DC2Type:guid)',
  `name` varchar(60) COLLATE utf8*unicode*ci NOT NULL,
  `username` varchar(40) COLLATE utf8*unicode*ci DEFAULT NULL,
  `username*canonical` varchar(255) COLLATE utf8_unicode*ci DEFAULT NULL,
  `email` varchar(255) COLLATE utf8*unicode*ci NOT NULL,
  `email*canonical` varchar(255) COLLATE utf8_unicode*ci NOT NULL,
  `password` varchar(255) COLLATE utf8*unicode*ci NOT NULL,
  `salt` varchar(255) COLLATE utf8*unicode*ci NOT NULL,
PRIMARY KEY (`id`),
  UNIQUE KEY `UNIQ_8D93D649E7927C74` (`email`),
  UNIQUE KEY `UNIQ_8D93D649F85E0677` (`username`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8*unicode*ci;

CREATE TABLE `customer` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `user*id` varchar(255) COLLATE utf8_unicode*ci DEFAULT NULL COMMENT '(DC2Type:guid)',
  `gender` varchar(1) COLLATE utf8*unicode*ci DEFAULT NULL,
  `zipcode` varchar(10) COLLATE utf8*unicode*ci DEFAULT NULL,
  `birthday` date DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `UNIQ*705B3727A76ED395` (`user*id`),
  CONSTRAINT `FK*705B3727A76ED395` FOREIGN KEY (`user*id`) REFERENCES `user` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8*unicode*ci;
Originally created by @doctrinebot on GitHub (May 13, 2015). Originally assigned to: @Ocramius on GitHub. Jira issue originally created by user hugohenrique: I'm using Migrations and always when a new version changes in my schema in action `up` SQL removes the definition of the table COLLATE for example: ``` public function up(Schema $schema) { $this->addSql('ALTER TABLE customer CHANGE user*id user*id CHAR(36) DEFAULT NULL COMMENT \'(DC2Type: guid)\''); } public function down(Schema $schema) { $this->addSql('ALTER TABLE customer CHANGE user*id user_id CHAR(36) NULL DEFAULT COLLATE utf8_unicode*ci COMMENT \'(DC2Type: guid)\''); } ``` ``` /**** * @ORM\Table(name="user") * @ORM\HasLifecycleCallbacks */ class User { /**** * @ORM\Id * @ORM\Column(type="guid", options={"unsigned"=true}) * @ORM\GeneratedValue(strategy="UUID") */ protected $id; ``` ``` /**** * @ORM\Entity * @ORM\Table(name="customer") */ class Customer { /**** * @ORM\Id * @ORM\Column(type="bigint", options={"unsigned"=true}) * @ORM\GeneratedValue(strategy="AUTO") */ protected $id; /**** * @ORM\OneToOne(targetEntity="User") * @ORM\JoinColumn(name="user_id", referencedColumnName="id") */ protected $user; ``` ``` CREATE TABLE `user` ( `id` varchar(255) COLLATE utf8*unicode*ci NOT NULL COMMENT '(DC2Type:guid)', `name` varchar(60) COLLATE utf8*unicode*ci NOT NULL, `username` varchar(40) COLLATE utf8*unicode*ci DEFAULT NULL, `username*canonical` varchar(255) COLLATE utf8_unicode*ci DEFAULT NULL, `email` varchar(255) COLLATE utf8*unicode*ci NOT NULL, `email*canonical` varchar(255) COLLATE utf8_unicode*ci NOT NULL, `password` varchar(255) COLLATE utf8*unicode*ci NOT NULL, `salt` varchar(255) COLLATE utf8*unicode*ci NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `UNIQ_8D93D649E7927C74` (`email`), UNIQUE KEY `UNIQ_8D93D649F85E0677` (`username`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8*unicode*ci; CREATE TABLE `customer` ( `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, `user*id` varchar(255) COLLATE utf8_unicode*ci DEFAULT NULL COMMENT '(DC2Type:guid)', `gender` varchar(1) COLLATE utf8*unicode*ci DEFAULT NULL, `zipcode` varchar(10) COLLATE utf8*unicode*ci DEFAULT NULL, `birthday` date DEFAULT NULL, PRIMARY KEY (`id`), UNIQUE KEY `UNIQ*705B3727A76ED395` (`user*id`), CONSTRAINT `FK*705B3727A76ED395` FOREIGN KEY (`user*id`) REFERENCES `user` (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8*unicode*ci; ```
admin added the Bug label 2026-01-22 14:45:28 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#4584