Patryk Karczmarczyk
Patryk Karczmarczyk

Reputation: 55

Doctrine Symfony2 column already exists

I am working on project using Symfony2 with Doctrine and PostgreSQL as DB Engine and I have a problem. When I'm trying to do app/console doctrine:schema:update --force after changing entities I get this error:

enter image description here

This is my entity class code:

use Doctrine\ORM\Mapping as ORM;

/**
 * LostConversation
 *
 * @ORM\Table(name="lost_conversation")
 * @ORM\Entity(repositoryClass="AppBundle\Repository\LostConversationRepository")
 */
class LostConversation
{

    const MAXSREENSHOTS = 50;
    const SCREENSHOT_TIMEOUT = 10;
    const MESSAGE_TIMEOUT = 30;
    /**
     * @var int
     *
     * @ORM\Column(name="id", type="integer")
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="AUTO")
     */
    private $id;

    /**
     * @var int
     * @ORM\ManyToOne(targetEntity="AppBundle\Entity\Room", cascade={"all"})
     * @ORM\JoinColumn(name="room_id", referencedColumnName="id", nullable=false)
     */

    private $room;

    /**
      * @var string
      * @ORM\Column(name="file_name ", type="string",length=40, nullable=true)
      */

    private $fileName;


    /**
      * @var string
      * @ORM\Column(name="message ", type="string",length=140, nullable=true)
      */
    private $message;

    /**
     * @var int
     * @ORM\ManyToOne(targetEntity="UserBundle\Entity\User", cascade={"all"})
     * @ORM\JoinColumn(name="user_id", referencedColumnName="id", nullable=false)
     */

    private $user;

    /**
     * @var int
     * @ORM\Column(name="insd", type="integer")
     */

    private $insd;

Thanks for every answer! :)

Upvotes: 1

Views: 554

Answers (1)

Shira
Shira

Reputation: 6560

You've got an extra space in the column name of the $fileName field:

/**
 * @ORM\Column(name="file_name ", type="string",length=40, nullable=true)
                              ^extra space here

Remove it and it should work.

The annotation of $message has the same problem.

Upvotes: 2

Related Questions