module Uuidable::Migration
Module adds method to alter table migration
Public Instance Methods
add_uuid_column(table_name, opts = {})
click to toggle source
# File lib/uuidable/migration.rb, line 22 def add_uuid_column(table_name, opts = {}) index_opts = opts.delete(:index) index_opts = {} if index_opts == true column_name = opts.delete(:column_name) || COLUMN_NAME add_column table_name, column_name, COLUMN_TYPE, COLUMN_OPTIONS.merge(opts) add_uuid_index(table_name, index_opts.merge(column_name: column_name)) if index_opts end
add_uuid_index(table_name, opts = {})
click to toggle source
# File lib/uuidable/migration.rb, line 33 def add_uuid_index(table_name, opts = {}) column_name = opts.delete(:column_name) || COLUMN_NAME add_index table_name, column_name, INDEX_OPTIONS.merge(opts) end