% 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) %>
-
<%= fa_icon 'download' %> Export
-
<%= fa_icon 'th-large' %> Functions
- <%= link_to raw("#{fa_icon('file-text-o')} Export table to CSV"), table_csv_path(@table) %>
<% if defined? Axlsx %>
- <%= link_to raw("#{fa_icon('file-excel-o')} Export table to Excel"), table_xlsx_path(@table, format: 'xls') %>
<% end %>
- <%= 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 |
Where |
Type |
Using |
<% @table.indexes.each do |index| %>
<%= index.name %> |
<%= index.unique %> |
<%= index.columns %> |
<%= index.lengths %> |
<%= index.orders %> |
<%= index.where %> |
<%= index.type %> |
<%= index.using %> |
<% end %>
<% if @table.indexes.none? %>
No Indexes |
<% end %>