Subject: | Versioned schema skipps ALTER TABLE .* ADD Statements in first line |
Date: | Mon, 14 Jan 2008 15:17:37 +0100 |
To: | bug-DBIx-Class [...] rt.cpan.org |
From: | Sven Eppler <sven [...] sveneppler.de> |
Hello!
I've played around with DBIx::Class::Schema::Versioned and figured out,
that an ALTER TABLE column ADD Statement is only run by the upgrade
process if it's not on top of all other Update-Statements to run.
I have this diff-file created by create_ddl_file
(wrapped the comment by hand):
-- Convert schema 'upgrades/My-Schema-0.2-MySQL.sql'
-- to 'upgrades/My-Schema-0.3-MySQL.sql':
ALTER TABLE users ADD sometest VARCHAR(100);
ALTER TABLE users CHANGE birthday birthday DATE NOT NULL;
When running upgrade, only the ALTER TABLE users CHANGE Statement is run
(watched at it with DBIC_TRACE=1). But the ALTER TABLE users ADD
Statment is silently ignored. Even when overloading upgrade and set a
RegExp that 100% matches the given statement, the statement is not
executed.
When changing the diff file by hand to:
-- Convert schema 'upgrades/My-Schema-0.2-MySQL.sql'
-- to 'upgrades/My-Schema-0.3-MySQL.sql':
ALTER TABLE users CHANGE birthday birthday DATE NOT NULL;
ALTER TABLE users ADD sometest VARCHAR(100);
Everything just works out right. All statements get executed as
expected, the databsase schema is updated and i can use the newly added
column without any problems.
I'm using the latest CPAN Release of DBIx::Class which is 0.08008.
Hope this helps out so far. :)
Greetings,
Sven Eppler