这适用于MySQL,SQLite3和Postgres:
ActiveRecord::base.connection.tables.each do |table| puts ActiveRecord::base.connection.indexes(table).inspectend
但是我认为它只能为您专门创建的索引。
另外,要找出正在使用的适配器:
ActiveRecord::base.connection.class

这适用于MySQL,SQLite3和Postgres:
ActiveRecord::base.connection.tables.each do |table| puts ActiveRecord::base.connection.indexes(table).inspectend
但是我认为它只能为您专门创建的索引。
另外,要找出正在使用的适配器:
ActiveRecord::base.connection.class