Module: Peegee::SchemaStatement
- Defined in:
- lib/peegee/schema_statement.rb
Instance Method Summary collapse
Instance Method Details
#add_index(table_name, *args) ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/peegee/schema_statement.rb', line 3 def add_index(table_name, *args) = args.last.respond_to?(:key?) ? args.pop : {} column = args.first index = Peegee::Index.new(:table_name => table_name, :options => ) if block_given? yield index else index.column = column end if index.run_outside_transaction? commit_db_transaction execute(index.create_sql) begin_db_transaction else execute(index.create_sql) end end |