Yeah, soory I forget to iclude the schema: CREATE TABLE `customer` ( `id` varchar(36) COLLATE utf8_unicode_ci NOT NULL, `email` varchar(255) COLLATE utf8_unicode_ci NOT NULL, `brand_id` smallint(6) NOT NULL, `type` smallint(6) NOT NULL, `password` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, `version_status` smallint(6) NOT NULL, `legal_id` varchar(24) COLLATE utf8_unicode_ci DEFAULT NULL, `gender` varchar(1) COLLATE utf8_unicode_ci DEFAULT NULL, `birthdate` date DEFAULT NULL, `telephone` varchar(24) COLLATE utf8_unicode_ci DEFAULT NULL, `creation_channel` varchar(2) COLLATE utf8_unicode_ci NOT NULL, `marketing_lead` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, `first_name` varchar(96) COLLATE utf8_unicode_ci DEFAULT NULL, `last_name` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, `created_at` datetime NOT NULL, `updated_at` datetime NOT NULL, `salt` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, `facebook_id` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, PRIMARY KEY (`id`), UNIQUE KEY `UNIQ_81398E09E7927C741C52F958B6D4D47` (`email`,`brand_id`,`version_status`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci
On Tuesday, 12 July 2016 10:24:35 UTC+2, Marco Pivetta wrote: > > Not sure what is being asked: we don't know what your schema looks like > before generating the migration... > > Marco Pivetta > > http://twitter.com/Ocramius > > http://ocramius.github.com/ > > On 12 July 2016 at 10:21, <[email protected] <javascript:>> wrote: > >> I'm getting this error when executing doctrine:migrations:diff >> >> [Doctrine\DBAL\Schema\SchemaException] There is no column with name >> 'brand' on table 'customer'. >> >> This is the previous migration I've made. I did it manually because >> doctrine:migrations:diff was creating no migration >> >> <?php >> >> namespace Application\Migrations; >> >> use Doctrine\DBAL\Migrations\AbstractMigration; >> use Doctrine\DBAL\Schema\Schema; >> >> class Version20160711123625 extends AbstractMigration >> { >> /** >> * @param Schema $schema >> */ >> public function up(Schema $schema) >> { >> $this->abortIf($this->connection->getDatabasePlatform()->getName() >> != 'mysql', 'Migration can only be executed safely on \'mysql\'.'); >> >> $this->addSql('ALTER TABLE customer CHANGE brand brand_id SMALLINT >> NOT NULL'); >> } >> >> /** >> * @param Schema $schema >> */ >> public function down(Schema $schema) >> { >> $this->abortIf($this->connection->getDatabasePlatform()->getName() >> != 'mysql', 'Migration can only be executed safely on \'mysql\'.'); >> >> $this->addSql('ALTER TABLE customer CHANGE brand_id brand SMALLINT >> NOT NULL'); >> } >> } >> >> >> The migration was done because of brand attribute need to be hydrated as >> BranIdVO. >> >> Customer.orm.xml >> >> <?xml version="1.0" encoding="utf-8"?> >> <doctrine-mapping >> xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping" >> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" >> xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping >> http://doctrine-project.org/schemas/orm/doctrine-mapping.xsd"> >> <entity name="Component\Customer\Domain\Model\Customer" table="customer" >> >> repository-class="GAT\CustomerBundle\Infrastructure\DoctrineCustomerRepository"> >> >> <unique-constraints> >> <unique-constraint columns="email,brand,version_status"/> >> </unique-constraints> >> >> <id name="id" type="string" column="id" length="36"> >> <generator strategy="NONE"/> >> </id> >> >> <field name="email" type="string" column="email" length="255" >> nullable="false"/> >> <field name="type" type="smallint" column="type" length="1" >> nullable="false"/> >> <field name="password" type="string" column="password" length="255" >> nullable="true"/> >> <field name="versionStatus" type="smallint" column="version_status" >> length="1" nullable="false"/> >> <field name="firstName" type="string" column="first_name" >> length="96" nullable="true"/> >> <field name="lastName" type="string" column="last_name" length="255" >> nullable="true"/> >> <field name="legalId" type="string" column="legal_id" length="24" >> nullable="true"/> >> <field name="gender" type="string" column="gender" length="1" >> nullable="true"/> >> <field name="birthdate" type="date" column="birthdate" >> nullable="true"/> >> <field name="phoneNumber" type="string" column="telephone" >> length="24" nullable="true"/> >> <field name="creationChannel" type="string" >> column="creation_channel" length="2" nullable="false"/> >> <field name="marketingLead" type="string" column="marketing_lead" >> length="255" nullable="true"/> >> <field name="createdAt" type="datetime" column="created_at" >> nullable="false"/> >> <field name="updatedAt" type="datetime" column="updated_at" >> nullable="false"/> >> <field name="salt" type="string" column="salt" nullable="true"/> >> <field name="facebookId" type="string" column="facebook_id" >> nullable="true"/> >> >> <embedded name="brand" class="Component\Core\Domain\Model\BrandIdVO" >> use-column-prefix="false"/> >> </entity> >> </doctrine-mapping> >> >> >> BrandIdVO.orm.xml >> >> <?xml version="1.0" encoding="utf-8"?> >> <doctrine-mapping >> xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping" >> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" >> >> xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping >> >> http://doctrine-project.org/schemas/orm/doctrine-mapping.xsd"> >> <embeddable name="Component\Core\Domain\Model\BrandIdVO"> >> <field name="id" column="brand_id" type="smallint" length="2"/> >> </embeddable> >> </doctrine-mapping> >> >> >> Customer.php >> >> class Customer implements UserInterface, AdvancedUserInterface, >> \Serializable, EquatableInterface >> { >> use TimestampableTrait; >> >> /** @var CustomerIdVO */ >> protected $id; >> >> /** @var EmailVO */ >> protected $email; >> >> /** @var BrandIdVO */ >> protected $brand; >> >> /** @var CustomerTypeVO */ >> protected $type; >> >> /** @var EncryptedPasswordVO */ >> protected $password; >> >> /** @var integer */ >> protected $versionStatus; >> >> /** @var string */ >> protected $firstName; >> >> /** @var string */ >> protected $lastName; >> >> /** @var string */ >> protected $legalId; >> >> /** @var GenderVO */ >> protected $gender; >> >> /** @var \DateTime */ >> protected $birthdate; >> >> /** @var PhoneNumberVO */ >> protected $phoneNumber; >> >> /** @var integer */ >> protected $feature; >> >> /** @var ChannelIdVO */ >> protected $creationChannel; >> >> /** @var string */ >> protected $marketingLead; >> >> /** @var string */ >> protected $salt; >> >> /** @var bool */ >> protected $isActive; >> >> /** @var string */ >> protected $facebookId; >> >> >> Everything looks fine to me, so I must be shortsighted. Any help would be >> greatly appreciated. >> >> >> >> >> >> >> -- >> You received this message because you are subscribed to the Google Groups >> "doctrine-user" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected] <javascript:>. >> To post to this group, send email to [email protected] >> <javascript:>. >> Visit this group at https://groups.google.com/group/doctrine-user. >> For more options, visit https://groups.google.com/d/optout. >> > > -- You received this message because you are subscribed to the Google Groups "doctrine-user" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/doctrine-user. For more options, visit https://groups.google.com/d/optout.
