ruby on rails - Uniqueness with scope in migration -


I'm trying to find a way to get it but I'm not getting any effort, so I think I've been thinking that my attitude is completely wrong, he said, if I want to make the combination of two areas unique, then what should I do in my migration ? Please note that I do not want them to be indexed, just the database field.

For example, for the down migration, I unique: true on the field, combo?

  class CreateSomething & lt; ActiveRecord :: Migration Change Diff change_table: do something | T | T.date: datestamp, cord = & gt; Wrong t.integer: some_number ,: null = & gt; Wrong t.timestamps end end    

I'm not sure that you

Please note that I do not want them to be indexed, just the database field.

There are additional pieces on the index information that store the database about the column. More importantly, an index is exactly what you need!

  class CreateSomething & lt; ActiveRecord :: Migration Change Diff change_table: do something | T | T.date: datestamp, cord = & gt; Wrong t.integer: some_number ,: null = & gt; Incorrect t.timestamps end add_index: some, [: datestamp, some_number], unique: right end term    

Comments

Popular posts from this blog

php - PDO bindParam() fatal error -

logging - How can I log both the Request.InputStream and Response.OutputStream traffic in my ASP.NET MVC3 Application for specific Actions? -

java - Why my included JSP file won't get processed correctly? -