Content
You are here:
How can I restrict values of a string column in a Rails migration?
Added by johny kopparapu about 7 years ago
I want to build a Rails database migration using ga Postgres 9.5 database in which I have a string column
def change
create_table :transactions do |t|
t.string transaction_type, null: false
but I would like to restrict the values of the column to only certain strings. Is there any way I can build that into my migration? If so, how would that look?
Thank you @ [Tekslate]https://tekslate.com/ruby-rails-training/