Hi friends! I am building an application using Postgre and I need to insert a lot of data from a spreadsheet into the database. I just built a big sql script but I found problems with duplicate values for some columns. It would be great if I could define some columns as “UNIQUE” in the migration model, so the Postgre would build those columns with this constraint. The book Agile Web 3rd Edition isn’t clear how to do this. Could someone help me? Thank you very much!
Hmmmm, OK. It’s a newbie question. It’s for my last job for the university. Will anyone give me a help? Thanks!
The following adds a unique constraint to the @number@ column in the @orders@ table:
add_index :orders, :number, :unique => false