<% def fk_action_color action case action when 'CASCADE' 'negative' when 'SET NULL' 'warning' end end %>

Table - <%= params["schema"] %>.<%= params["name"] %>

<% if object[:comment] %>

Database Comment

<%= object[:comment] %>

<% end %> <%= render_markdown "schema/#{params["schema"]}/#{params["name"]}.md" %>

Columns

<% object[:columns].each do |row| %> <% end %>
Column Name Data Type Required Field? Default Value
<% if fk = object[:foreign_keys].fetch(row["column_name"], nil) %> " title="<%= fk["references_schema"] %>.<%= fk["references_table"] %>"><%= row["column_name"] %> <% else %> <%= row["column_name"] %> <% end %> <%= row["data_type"] %> "><%= row["is_nullable"] == 'NO' ? '' : ''%> <%= row["column_default"] %>
<% unless object[:foreign_keys].empty? %>

Foreign Keys

<% object[:foreign_keys].each do |column_name, row| %> <% end %>
Column Name References On Delete Constraint Name
<%= row["column_name"] %> " title="<%= row["references_schema"] %>.<%= row["references_table"] %>"><%= "#{row["references_schema"]}.#{row["references_table"]}" %> "><%= row["on_delete"] %> <%= row["constraint_name"] %>
<% end %>

Indexes

<% object[:indexes].each do |index_name, row| %> <% end %>
Index Name Primary? Unique? Type Columns
<%= row["index_name"] %> <% if row["is_primary"] == "t" %><% end %> <% if row["is_unique"] == "t" %><% end %> <%= row["index_type"] %> <%= row["index_keys"][1..-2].split(",").join ", " %>