schema update or migrations doesn't work: doctrine2 LONGTEXT problem #57

Closed
liuggio opened this Issue Jul 10, 2012 · 12 comments

Comments

Projects
None yet
4 participants

liuggio commented Jul 10, 2012

Seems that the custom field longtext
has some problem with doctrine2 and extended_payment_data
The query update that field as LONGTEXT but again if you run the schema update Doctrine doesn't recognize that longtext field.

ALTER TABLE payment_instructions CHANGE extended_data extended_data LONGTEXT NOT NULL;

This is not so good because with the migration 'down' is broken :(

Do you have a workaround for this?

thanks

iamdto commented Jul 18, 2012

I have the same problem. It would be great if anyone finds a workaround !

Owner

schmittjoh commented Jul 26, 2012

Fixed.

If you are using a non-default connection for the payment bundle, you need to mark the type as "commented" yourself by copying the code from the above commit and changing the connection.

liuggio commented Jul 26, 2012

👍 thanks

iamdto commented Jul 26, 2012

I still have the same problem, excepts now queries are ALTER TABLE financial_transactions CHANGE extended_data extended_data LONGTEXT DEFAULT NULL COMMENT '(DC2Type:extended_payment_data)' and ALTER TABLE payment_instructions CHANGE extended_data extended_data LONGTEXT NOT NULL COMMENT '(DC2Type:extended_payment_data)'.

I use Symfony 2.0.15 and Doctrine 2.1.7.

@liuggio is it OK on your side ?

liuggio commented Jul 26, 2012

I did not test it yet. I'll let you know.

Owner

schmittjoh commented Jul 26, 2012

@epiiic, this is expected. However, if you run this migration, you should not receive another modification after that.

iamdto commented Jul 27, 2012

Yes, I've run it. I even rebuild my database on my local environment and I still got this behaviour.

$ ./app/console doctrine:schema:update --dump-sql
ALTER TABLE financial_transactions CHANGE extended_data extended_data LONGTEXT DEFAULT NULL COMMENT '(DC2Type:extended_payment_data)';
ALTER TABLE payment_instructions CHANGE extended_data extended_data LONGTEXT NOT NULL COMMENT '(DC2Type:extended_payment_data)'

$ ./app/console doctrine:migrations:execute 20120726131623
WARNING! You are about to execute a database migration that could result in schema changes and data lost. Are you sure you wish to continue? (y/n)y

  ++ migrating 20120726131623

     -> ALTER TABLE financial_transactions CHANGE extended_data extended_data LONGTEXT DEFAULT NULL COMMENT '(DC2Type:extended_payment_data)'
     -> ALTER TABLE payment_instructions CHANGE extended_data extended_data LONGTEXT NOT NULL COMMENT '(DC2Type:extended_payment_data)'

  ++ migrated (0.16s)

$ ./app/console doctrine:schema:update --dump-sql
ALTER TABLE financial_transactions CHANGE extended_data extended_data LONGTEXT DEFAULT NULL COMMENT '(DC2Type:extended_payment_data)';
ALTER TABLE payment_instructions CHANGE extended_data extended_data LONGTEXT NOT NULL COMMENT '(DC2Type:extended_payment_data)'
Owner

schmittjoh commented Jul 27, 2012

Could you try updating to latest Doctrine versions, it might be a bug there.

On Fri, Jul 27, 2012 at 11:27 AM, epiiic <
reply@reply.github.com

wrote:

Yes, I've run it. I even rebuild on my database on my local environment
and I still got this behaviour.

$ ./app/console doctrine:schema:update --dump-sql
ALTER TABLE financial_transactions CHANGE extended_data extended_data
LONGTEXT DEFAULT NULL COMMENT '(DC2Type:extended_payment_data)';
ALTER TABLE payment_instructions CHANGE extended_data extended_data
LONGTEXT NOT NULL COMMENT '(DC2Type:extended_payment_data)'
$ ./app/console doctrine:migrations:execute 20120726131623
WARNING! You are about to execute a database migration that could result
in schema changes and data lost. Are you sure you wish to continue? (y/n)y

  ++ migrating 20120726131623

     -> ALTER TABLE financial_transactions CHANGE extended_data
extended_data LONGTEXT DEFAULT NULL COMMENT
'(DC2Type:extended_payment_data)'
     -> ALTER TABLE payment_instructions CHANGE extended_data
extended_data LONGTEXT NOT NULL COMMENT '(DC2Type:extended_payment_data)'

  ++ migrated (0.16s)
$ ./app/console doctrine:schema:update --dump-sql
ALTER TABLE financial_transactions CHANGE extended_data extended_data
LONGTEXT DEFAULT NULL COMMENT '(DC2Type:extended_payment_data)';
ALTER TABLE payment_instructions CHANGE extended_data extended_data
LONGTEXT NOT NULL COMMENT '(DC2Type:extended_payment_data)'

Reply to this email directly or view it on GitHub:

#57 (comment)

iamdto commented Aug 29, 2012

I've updated doctrine-common to 2.2.3, doctrine-dbal to 2.2.2, doctrine to 2.2.3 and still have the issue. May I ask you what's your configuration ?

Same issue here, same doctrine versions. Though i am using symfony 2.1 (dev/master).

I might add that i am using MySQL 5.5.27 and when i try to run the ALTER TABLE statements manually against the table i am prompted an error

Error: 1101 - BLOB/TEXT column 'extended_data' can't have a default value

According to the Documentation BLOB/TEXT indeed cannot have default values. I am not sure why Doctrine thinks it has to set this default value.

Owner

schmittjoh commented Sep 18, 2012

It works for me. Please report this problem on doctrine-project.org with
your exact versions.

On Tue, Sep 18, 2012 at 8:53 PM, thenetexperts notifications@github.comwrote:

Same issue here, same doctrine versions. Though i am using symfony 2.1
(dev/master).

I might add that i am using MySQL 5.5.27 and when i try to run the ALTER
TABLE statements manually against the table i am prompted an error

Error: 1101 - BLOB/TEXT column 'extended_data' can't have a default value


Reply to this email directly or view it on GitHubhttps://github.com/schmittjoh/JMSPaymentCoreBundle/issues/57#issuecomment-8665841.

(fixed in doctrine 2.3)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment