Skip to content

Instantly share code, notes, and snippets.

@awesome
Created October 17, 2023 17:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save awesome/f3711611e6fa0a18bdf1e5d0fc714cbd to your computer and use it in GitHub Desktop.
Save awesome/f3711611e6fa0a18bdf1e5d0fc714cbd to your computer and use it in GitHub Desktop.
`citext` pg column format is case insensitive: https://www.postgresql.org/docs/current/citext.html for ruby on rails migration
# citext pg column format is case insensitive: https://www.postgresql.org/docs/current/citext.html
class EnablePostgresExtensions < ActiveRecord::Migration[6.1]
def change
enable_extension 'citext'
end
end
class CreateFoo < ActiveRecord::Migration[6.1]
def change
create_table :foos, id: :uuid do |t|
t.citext :bar, null: false, index: {unique: true}
t.citext :bar_id, null: false, index: {unique: true}
t.timestamps
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment