PostgreSQL + Rails citext
I am trying to go to heroku which uses PostgreSQL 8.4 which has a citext column type which is good since the application was written for MySQL.
Can I use: citext with rails (so if migrations are done to MySQL, citext will just use the string / text?
I found this ticket, but it looks like it won't be part of the rails for a while: https://rails.lighthouseapp.com/projects/8994/tickets/3174-add-support-for-postgresql-citext-column-type
+2
source to share
3 answers
Rails 4.2+
Rails 4.2 has built-in support for column type citext
.
Rails <4.2
If you are using Rails <4.2 you can try using the activerecord-postgresql-citext gem.
This allows you to write migrations like this:
def up
enable_extension("citext")
create_table :models, :force => true do |t|
t.citext :name
t.timestamps
end
end
+3
source to share