Alex Kira
2007-Jun-21 13:46 UTC
[Cruisecontrolrb-users] CruiseControl with foreign key migrations
Hi Everyone, I am trying to get CruiseControl running using migrations with foreign keys, and I''m having some difficulties. I have a project that builds and passes CC.rb . I can add some manual foreign key creation to the migration scrips, and everything works fine outside of cruisecontrol. (everything works fine running rake from command line, even in the cruisecontrol work directory). However, once I run the build from inside CruiseControl, it fails with this error: [CruiseControl] Invoking Rake task "test" /usr/bin/ruby1.8 -Ilib:test "/usr/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake/rake_test_loader.rb" Mysql::Error: Table ''apples'' already exists: CREATE TABLE apples (`id` int(11) DEFAULT NULL auto_increment PRIMARY KEY, `color` varchar(255) DEFAULT NULL, `size` varchar(255) DEFAULT NULL) ENGINE=InnoDB /usr/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/connection_adapters/abstract_adapter.rb:128:in `log'' /usr/lib/ruby/gems/1.8/gems Here is a simple example that this happens with: create_table :apples do |t| t.column :color, :string t.column :size, :string end create_table :oranges do |t| t.column :name, :string t.column :apple_id, :integer end execute "alter table oranges add constraint fk_oranges_apples foreign key (apple_id) references apples(id)" And it results with the error above. This happens even if I add a "drop foreign" key in my down script before dropping the table. Thanks! -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/cruisecontrolrb-users/attachments/20070621/5aa9e123/attachment.html