Module: DynamicMigrations::ActiveRecord::Migrators::Index

Included in:
DynamicMigrations::ActiveRecord::Migrators
Defined in:
lib/dynamic_migrations/active_record/migrators/index.rb

Instance Method Summary collapse

Instance Method Details

#remove_index_comment(table_name, index_name) ⇒ Object

remove a index comment table name is not needed, but is included here for consistency with the other rils migrations methods, and to make it easier to understand what table this index is relate to



19
20
21
22
23
# File 'lib/dynamic_migrations/active_record/migrators/index.rb', line 19

def remove_index_comment table_name, index_name
  execute <<~SQL
    COMMENT ON INDEX #{index_name} IS NULL;
  SQL
end

#set_index_comment(table_name, index_name, comment) ⇒ Object

add a comment to the index table name is not needed, but is included here for consistency with the other rils migrations methods, and to make it easier to understand what table this index is relate to



9
10
11
12
13
# File 'lib/dynamic_migrations/active_record/migrators/index.rb', line 9

def set_index_comment table_name, index_name, comment
  execute <<~SQL
    COMMENT ON INDEX #{index_name} IS #{quote comment};
  SQL
end