I submitted a PR for Rails.  The bug I'm trying to fix occurs when there is 
a unique field index on a table.

In the test I wrote, I added the index, ran test code and removed the index 
all inside the test.
This fails against mysql and mysql2 because they do not allow DDL 
statements in transactions.

So now I'm trying to figure out my next steps.

What is the preferred steps to take in regards to the Rails testing suite 
schema/models?
Here are some options:

   - Add unique index to existing table field (assuming it doesn't break 
   existing tests)
   - Create a new field on an existing table and add an index for that
   - Create new model/table and wire up the associations
   - Something else?


Related, I've been playing around with a few of these and am having trouble 
adding a column to a table.
I changed the schema for 'Parrot' table to add a 'nick' column:

...
t.column :nick, :string
...
add_index :parrots, :nick, :unique => true

But then when I run my test:
ARCONN=mysql2 bundle exec ruby -I test 
test/cases/autosave_association_test.rb -n 
test_should_save_new_record_that_has_same_value_as_existing_record_marked_for_destruction_on_field_that_has_unique_index

I get ActiveRecord::UnknownAttributeError: unknown attribute: nick

What do I have to do to have these changes reflected in the db?

I tried:
bundle exec rake mysql:drop_databases
bundle exec rake mysql:build_databases

but got the same error.

Thanks!

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Core" 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 http://groups.google.com/group/rubyonrails-core?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to