% title "'#{@table.name}' Schema" %>
Table: <%= @table.name %>
- <%= render '/rails_db/shared/exp_col' %>
- <%= link_to raw("#{fa_icon('table')} Records"), table_data_path(@table), remote: true %>
- <%= link_to raw("#{fa_icon('tasks')} Schema"), table_path(@table), remote: true %>
- <%= select_top_from_table(@table.name) %>
- <%= link_to raw("#{fa_icon('file-excel-o')} Export"), table_csv_path(@table) %>
-
<%= fa_icon 'th-large' %> Functions
- <%= link_to raw("#{fa_icon('trash-o')} Truncate Table"), table_truncate_path(@table), remote: true, confirm: 'Are you sure?', data: {confirm: 'Are you sure?'} %>
Schema
<% if @table.primary_key.present? %>
PK |
<% end %>
<% @table.column_properties.each do |key| %>
<%= key.titleize.upcase %> |
<% end %>
<% @table.columns.each do |col| %>
<% if @table.primary_key %>
<% if @table.primary_key == col.name %>
<%= fa_icon 'key' %>
|
<% else %>
|
<% end %>
<% end %>
<% @table.column_properties.each do |key| %>
<% value = col.send(key) %>
<%= value %>
|
<% end %>
<% end %>
Indexes
Name |
Unique |
Columns |
Length |
Orders |
<% if Rails::VERSION::MAJOR >= 4 %>
Where |
Type |
Using |
<% end %>
<% @table.indexes.each do |index| %>
<%= index.name %> |
<%= index.unique %> |
<%= index.columns %> |
<%= index.lengths %> |
<%= index.orders %> |
<% if Rails::VERSION::MAJOR >= 4 %>
<%= index.where %> |
<%= index.type %> |
<%= index.using %> |
<% end %>
<% end %>
<% if @table.indexes.none? %>
No Indexes |
<% end %>