erd 0.6.3 → 0.6.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (37) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -0
  3. data/.travis.yml +3 -4
  4. data/README.rdoc +1 -1
  5. data/app/controllers/erd/erd_controller.rb +46 -18
  6. data/app/views/erd/erd/_column.html.erb +1 -1
  7. data/app/views/erd/erd/_model.html.erb +1 -1
  8. data/app/views/erd/erd/index.html.erb +2 -2
  9. data/app/views/layouts/erd/application.html.erb +3 -2
  10. data/erd.gemspec +1 -1
  11. data/gemfiles/rails_32.gemfile +1 -1
  12. data/gemfiles/rails_40.gemfile +1 -0
  13. data/gemfiles/rails_41.gemfile +1 -0
  14. data/gemfiles/rails_42.gemfile +1 -0
  15. data/gemfiles/rails_50.gemfile +1 -0
  16. data/gemfiles/rails_51.gemfile +1 -0
  17. data/gemfiles/rails_52.gemfile +1 -0
  18. data/gemfiles/rails_60.gemfile +9 -0
  19. data/gemfiles/rails_edge.gemfile +1 -0
  20. data/lib/erd.rb +7 -1
  21. data/lib/erd/engine.rb +12 -0
  22. data/lib/erd/migrator.rb +3 -1
  23. data/lib/erd/version.rb +1 -1
  24. data/{vendor/assets/images → public}/erd/angle-left.png +0 -0
  25. data/{vendor/assets/images → public}/erd/angle-right.png +0 -0
  26. data/{vendor/assets/images → public}/erd/animated-overlay.gif +0 -0
  27. data/{vendor/assets/images → public}/erd/background.png +0 -0
  28. data/{vendor/assets/images → public}/erd/cancel.png +0 -0
  29. data/{vendor/assets/images → public}/erd/close.png +0 -0
  30. data/public/erd/erd.css +549 -0
  31. data/{app/assets/javascripts/erd/erd.js.js → public/erd/erd.js} +1 -1
  32. data/{app → src}/assets/stylesheets/erd/erd.css.scss +1 -1
  33. metadata +16 -18
  34. data/app/assets/javascripts/erd/application.js +0 -14
  35. data/app/assets/stylesheets/erd/application.css +0 -13
  36. data/lib/erd/railtie.rb +0 -21
  37. data/vendor/assets/javascripts/raphael-min.js +0 -12
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 19f3db87a114e08714d36a0f30667bdf13e414d4a31a05c9040cbcebb096c3e0
4
- data.tar.gz: f9a57e8692ce03076fa560efd3d6d161735bd2f71c1947a39c164be24a84220b
3
+ metadata.gz: 614e01232d2efeca93c7bed35a751e25a9ee991e2f51e80e171f918fc7f243ef
4
+ data.tar.gz: 357077faae8695c34f34fda83f3f4437c95b1725d452c4b262cfbf68648edf28
5
5
  SHA512:
6
- metadata.gz: 4e9ace58506b790f0467cb90a03bd0bb30030d02d952ca411b74a779e5a16eeb6f92c45c0a2cabb024d25e04be2b53a0c6bbd1b3b8b3ea892bd8558f0d8708c1
7
- data.tar.gz: 7e7f9287350669a8d4a17672ec3e026c313182a4b569a79e809da839e51a2b64d05d13041429b04b732d00c1570ebec38210c66643e5e7fb9c80866bef18ec1d
6
+ metadata.gz: 07a9c92343e1d277fbe84f944f08c8d3adb7ae1e166bd04b59606d7325ed25adb2c60f03aee27696e8bda48fc56ba182fde0a31cb0110aa19ad81a41ea608285
7
+ data.tar.gz: 15f84992ff7fc3d83cf3df98902afaa22df912ea860345755dd21b06a7521c2d86b2a997d14ebd2cb2d59594ebf211f72271f0375b766c6bc526a58f84518144
data/.gitignore CHANGED
@@ -3,6 +3,7 @@
3
3
  .bundle
4
4
  .config
5
5
  .yardoc
6
+ .sass-cache
6
7
  Gemfile.lock
7
8
  gemfiles/*.lock
8
9
  InstalledFiles
@@ -14,7 +14,6 @@ cache:
14
14
 
15
15
  before_install:
16
16
  - sudo apt install -y chromium-chromedriver
17
- - sudo ln -s /usr/lib/chromium-browser/chromedriver /usr/bin/
18
17
  - gem i bundler -v '<2'
19
18
 
20
19
  rvm:
@@ -22,6 +21,7 @@ rvm:
22
21
  - 2.0.0
23
22
 
24
23
  gemfile:
24
+ - gemfiles/rails_60.gemfile
25
25
  - gemfiles/rails_52.gemfile
26
26
  - gemfiles/rails_51.gemfile
27
27
  - gemfiles/rails_50.gemfile
@@ -32,6 +32,8 @@ gemfile:
32
32
 
33
33
  matrix:
34
34
  exclude:
35
+ - rvm: 2.0.0
36
+ gemfile: gemfiles/rails_60.gemfile
35
37
  - rvm: 2.0.0
36
38
  gemfile: gemfiles/rails_52.gemfile
37
39
  - rvm: 2.0.0
@@ -46,6 +48,3 @@ matrix:
46
48
  gemfile: gemfiles/rails_40.gemfile
47
49
  - rvm: 2.6.0
48
50
  gemfile: gemfiles/rails_32.gemfile
49
- include:
50
- - rvm: 1.8.7
51
- gemfile: gemfiles/rails_32.gemfile
@@ -43,7 +43,7 @@ Browse at your http://localhost:3000/erd
43
43
 
44
44
  * drop column (need to think of the UI)
45
45
 
46
- * stop depending on rails-erd and Graphviz
46
+ * stop depending on Graphviz
47
47
 
48
48
  * tests
49
49
 
@@ -1,16 +1,13 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'nokogiri'
4
- require 'rails_erd/diagram/graphviz'
4
+ require 'ruby-graphviz'
5
5
  require 'erd/application_controller'
6
6
 
7
7
  module Erd
8
8
  class ErdController < ::Erd::ApplicationController
9
9
  def index
10
- Rails.application.eager_load!
11
- RailsERD.options[:filename], RailsERD.options[:filetype] = Rails.root.join('tmp/erd'), 'plain'
12
- RailsERD::Diagram::Graphviz.create
13
- plain = Rails.root.join('tmp/erd.plain').read
10
+ plain = generate_plain
14
11
  positions = if (json = Rails.root.join('tmp/erd_positions.json')).exist?
15
12
  ActiveSupport::JSON.decode json.read
16
13
  else
@@ -22,7 +19,7 @@ module Erd
22
19
  end
23
20
 
24
21
  def update
25
- changes = ActiveSupport::JSON.decode(params[:changes])
22
+ changes = params[:changes].present? ? ActiveSupport::JSON.decode(params[:changes]) : []
26
23
  executed_migrations, failed_migrations = [], []
27
24
  changes.each do |row|
28
25
  begin
@@ -79,27 +76,58 @@ module Erd
79
76
  end
80
77
 
81
78
  private
79
+
80
+ def generate_plain
81
+ if Rails.respond_to?(:autoloaders) && Rails.autoloaders.try(:zeitwerk_enabled?)
82
+ Zeitwerk::Loader.eager_load_all
83
+ else
84
+ Rails.application.eager_load!
85
+ end
86
+ ar_descendants = ActiveRecord::Base.descendants.reject {|m| m.name.in?(%w(ActiveRecord::SchemaMigration ActiveRecord::InternalMetadata ApplicationRecord)) }
87
+ ar_descendants.reject! {|m| !m.table_exists? }
88
+
89
+ g = GraphViz.new('ERD', :type => :digraph, :rankdir => 'LR', :labelloc => :t, :ranksep => '1.5', :nodesep => '1.8', :margin => '0,0', :splines => 'spline') {|g|
90
+ nodes = ar_descendants.each_with_object({}) do |model, hash|
91
+ next if model.name.start_with? 'HABTM_'
92
+ hash[model.name] = model.columns.reject {|c| c.name.in? %w(id created_at updated_at) }.map {|c| [c.name, c.type]}
93
+ end
94
+
95
+ edges = []
96
+ ar_descendants.each do |model|
97
+ model.reflect_on_all_associations.each do |reflection|
98
+ next unless nodes.key? model.name
99
+ next if reflection.macro == :belongs_to
100
+ next unless nodes.key?(reflection.klass.name)
101
+
102
+ edges << [model.name, reflection.klass.name]
103
+ # don't include the FKs in the diagram
104
+ nodes[reflection.klass.name].delete_if {|col, _type| col == reflection.foreign_key }
105
+ end
106
+ end
107
+
108
+ nodes.each_pair do |model_name, cols|
109
+ g.add_nodes model_name, 'shape' => 'record', 'label' => "#{model_name}|#{cols.map {|name, type| "#{name}(#{type})"}.join('\l')}"
110
+ end
111
+ edges.each do |from, to|
112
+ g.add_edge g.search_node(from), g.search_node(to)
113
+ end
114
+ }
115
+ g.output('plain' => String)
116
+ end
117
+
82
118
  def render_plain(plain, positions)
83
- _scale, svg_width, svg_height = plain.scan(/\Agraph ([0-9\.]+) ([0-9\.]+) ([0-9\.]+)$/).first
119
+ _scale, svg_width, svg_height = plain.scan(/\Agraph ([\d\.]+) ([\d\.]+) ([\d\.]+)$/).first
84
120
  # node name x y width height label style shape color fillcolor
85
121
  max_model_x, max_model_y = 0, 0
86
- models = plain.scan(/^node ([^ ]+) ([0-9\.]+) ([0-9\.]+) ([0-9\.]+) ([0-9\.]+) <\{?(<((?!^\}?>).)*)^\}?> [^ ]+ [^ ]+ [^ ]+ [^ ]+\n/m).map {|node_name, x, y, width, height, label|
87
- label_doc = Nokogiri::HTML::DocumentFragment.parse(label)
88
- model_name = node_name.dup
89
- model_name[0] = model_name[-1] = '' if (model_name.first == '"') && (model_name.last == '"')
90
- model_name = model_name.sub(/^m_/, '')
91
- next if model_name.in? ['ActiveRecord::SchemaMigration', 'ActiveRecord::InternalMetadata']
92
- columns = []
93
- if (cols_table = label_doc.search('table')[1])
94
- columns = cols_table.search('tr > td').map {|col| col_name, col_type = col.text.split(' '); {:name => col_name, :type => col_type}}
95
- end
122
+ models = plain.scan(/^node ([^ ]+) ([\d\.]+) ([\d\.]+) ([\d\.]+) ([\d\.]+) ([^ ]+) [^ ]+ [^ ]+ [^ ]+ [^ ]+\n/m).map {|model_name, x, y, width, height, label|
123
+ columns = label.gsub("\\\n", '').split('|')[1].split('\l').map {|name_and_type| name_and_type.scan(/(.*?)\((.*?)\)/).first }.map {|n, t| {:name => n, :type => t} }
96
124
  custom_x, custom_y = positions[model_name.tableize].try(:split, ',')
97
125
  h = {:model => model_name, :x => (custom_x || (BigDecimal(x) * 72).round), :y => (custom_y || (BigDecimal(y) * 72).round), :width => (BigDecimal(width) * 72).round, :height => height, :columns => columns}
98
126
  max_model_x, max_model_y = [h[:x].to_i + h[:width].to_i, max_model_x, 1024].max, [h[:y].to_i + h[:height].to_i, max_model_y, 768].max
99
127
  h
100
128
  }.compact
101
129
  # edge tail head n x1 y1 .. xn yn [label xl yl] style color
102
- edges = plain.scan(/^edge ([^ ]+)+ ([^ ]+)/).map {|from, to| {:from => from.sub(/^m_/, ''), :to => to.sub(/^m_/, '')}}
130
+ edges = plain.scan(/^edge ([^ ]+)+ ([^ ]+)/).map {|from, to| {:from => from, :to => to}}
103
131
  render_to_string 'erd/erd/erd', :layout => nil, :locals => {:width => [(BigDecimal(svg_width) * 72).round, max_model_x].max, :height => [(BigDecimal(svg_height) * 72).round, max_model_y].max, :models => models, :edges => edges}
104
132
  end
105
133
 
@@ -6,7 +6,7 @@
6
6
  <form class="rename_column_form"><span><input name="model" type="hidden" value="<%= model[:model] %>" /><input name="column" type="hidden" value="<%= column[:name] %>" /><input name="to" type="text" /><input type="submit" value="Change" /></span><a href="#!" class="cancel">Cancel</a></form>
7
7
  </td>
8
8
  <td>
9
- <span class="column_type_text <%= column[:type].delete(" ∗") %>"><%= column[:type] %></span>
9
+ <span class="column_type_text <%= column[:type] %>"><%= column[:type] %></span>
10
10
  <form class="alter_column_form"><span><input name="model" type="hidden" value="<%= model[:model] %>" /><input name="column" type="hidden" value="<%= column[:name] %>" /><input name="type" type="hidden" value="<%= column[:type] %>" /><input name="to" type="text" /><input type="submit" value="Change" /></span><a href="#!" class="cancel">Cancel</a></form>
11
11
  </td>
12
12
  </tr>
@@ -1,5 +1,5 @@
1
1
  <div id="erd-<%= model[:model] %>" class="model" style="top: <%= model[:y] %>px; left: <%= model[:x] %>px;" data-model_name="<%= model[:model] %>">
2
- <a href="#!" class="close"><%= image_tag("/assets/erd/close.png") %></a>
2
+ <a href="#!" class="close"><%= image_tag '/erd/close.png' %></a>
3
3
  <div class="model_name">
4
4
  <div class="model_name_text"><%= model[:model] %></div>
5
5
  <form class="rename_model_form">
@@ -2,9 +2,9 @@
2
2
  <div id="erd_container">
3
3
  <%=raw @erd %>
4
4
  </div>
5
- <div id="open_migration"><%= image_tag("/assets/erd/angle-left.png") %></div>
5
+ <div id="open_migration"><%= image_tag '/erd/angle-left.png' %></div>
6
6
  <div id="migration">
7
- <div id="close_migration"><%= image_tag("/assets/erd/angle-right.png") %></div>
7
+ <div id="close_migration"><%= image_tag '/erd/angle-right.png' %></div>
8
8
  <%- if flash[:executed_migrations].present? -%>
9
9
  <div id="executed">
10
10
  <h2>Successfully executed following <%= flash[:executed_migrations].values.flatten.count %> migrations!</h2>
@@ -3,11 +3,12 @@
3
3
  <head>
4
4
  <meta charset='utf-8'>
5
5
  <title>ERD - <%= Rails.application.class.parent.name %></title>
6
- <%= stylesheet_link_tag 'erd/application', :media => 'all' %>
6
+ <%= stylesheet_link_tag '/erd/erd', :media => 'all' %>
7
7
  <%= stylesheet_link_tag 'https://ajax.googleapis.com/ajax/libs/jqueryui/1.12.1/themes/smoothness/jquery-ui.css', :media => 'all' %>
8
8
  <%= javascript_include_tag 'https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js' %>
9
9
  <%= javascript_include_tag 'https://ajax.googleapis.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js' %>
10
- <%= javascript_include_tag 'erd/application' %>
10
+ <%= javascript_include_tag 'https://cdnjs.cloudflare.com/ajax/libs/raphael/2.3.0/raphael.min.js' %>
11
+ <%= javascript_include_tag '/erd/erd' %>
11
12
  <%= csrf_meta_tags %>
12
13
  </head>
13
14
  <body>
@@ -18,7 +18,7 @@ Gem::Specification.new do |gem|
18
18
  gem.require_paths = ['lib']
19
19
  gem.version = Erd::VERSION
20
20
 
21
- gem.add_runtime_dependency 'rails-erd', ['>= 0.4.5']
21
+ gem.add_runtime_dependency 'ruby-graphviz'
22
22
  gem.add_runtime_dependency 'nokogiri'
23
23
 
24
24
  gem.add_development_dependency 'rails', '>= 3.2'
@@ -11,4 +11,4 @@ gem 'rubyzip', '0.9.9' if RUBY_VERSION < '1.9'
11
11
 
12
12
  gem 'test-unit-rails', '1.0.2'
13
13
  gem 'test-unit', '< 3.1'
14
- gem 'rails-erd', '< 1.2'
14
+ gem 'sqlite3', '< 1.4'
@@ -6,3 +6,4 @@ gemspec :path => '../'
6
6
 
7
7
  gem 'rails', '~> 4.0.0'
8
8
  gem 'nokogiri', RUBY_VERSION < '2.1' ? '~> 1.6.0' : '>= 1.7'
9
+ gem 'sqlite3', '< 1.4'
@@ -6,3 +6,4 @@ gemspec :path => '../'
6
6
 
7
7
  gem 'rails', '~> 4.1.0'
8
8
  gem 'nokogiri', RUBY_VERSION < '2.1' ? '~> 1.6.0' : '>= 1.7'
9
+ gem 'sqlite3', '< 1.4'
@@ -6,3 +6,4 @@ gemspec :path => '../'
6
6
 
7
7
  gem 'rails', '~> 4.2.0'
8
8
  gem 'nokogiri', RUBY_VERSION < '2.1' ? '~> 1.6.0' : '>= 1.7'
9
+ gem 'sqlite3', '< 1.4'
@@ -5,3 +5,4 @@ source 'https://rubygems.org'
5
5
  gemspec :path => '../'
6
6
 
7
7
  gem 'rails', '~> 5.0.0'
8
+ gem 'sqlite3', '< 1.4'
@@ -5,3 +5,4 @@ source 'https://rubygems.org'
5
5
  gemspec :path => '../'
6
6
 
7
7
  gem 'rails', '~> 5.1.0'
8
+ gem 'sqlite3', '< 1.4'
@@ -6,3 +6,4 @@ gemspec :path => '../'
6
6
 
7
7
  gem 'rails', '~> 5.2.0'
8
8
  gem 'puma'
9
+ gem 'sqlite3', '< 1.4'
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ source 'https://rubygems.org'
4
+
5
+ gemspec :path => '../'
6
+
7
+ gem 'rails', '~> 6.0.0'
8
+ gem 'puma'
9
+ gem 'sqlite3'
@@ -6,3 +6,4 @@ gemspec :path => '../'
6
6
 
7
7
  gem 'rails', git: 'https://github.com/rails/rails'
8
8
  gem 'puma'
9
+ gem 'sqlite3'
data/lib/erd.rb CHANGED
@@ -1,4 +1,10 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'erd/version'
4
- require 'erd/railtie'
4
+ require 'rails'
5
+ require 'erd/engine'
6
+
7
+ module Erd
8
+ autoload :Migrator, 'erd/migrator'
9
+ autoload :GenaratorRunner, 'erd/generator_runner'
10
+ end
@@ -3,5 +3,17 @@
3
3
  module Erd
4
4
  class Engine < ::Rails::Engine
5
5
  isolate_namespace Erd
6
+
7
+ initializer 'erd' do |app|
8
+ if Rails.env.development?
9
+ ActiveSupport.on_load :after_initialize do
10
+ Rails.application.routes.prepend do
11
+ mount Erd::Engine, :at => '/erd'
12
+ end
13
+ end
14
+
15
+ app.middleware.insert_before ::ActionDispatch::Static, ::ActionDispatch::Static, root.join('public').to_s
16
+ end
17
+ end
6
18
  end
7
19
  end
@@ -8,9 +8,11 @@ module Erd
8
8
  class Migrator
9
9
  class << self
10
10
  def status
11
+ migrations = []
11
12
  migration_table_name = defined?(ActiveRecord::SchemaMigration) ? ActiveRecord::SchemaMigration.table_name : ActiveRecord::Migrator.schema_migrations_table_name
13
+ return migrations unless ActiveRecord::Base.connection.table_exists? migration_table_name
14
+
12
15
  migrated_versions = ActiveRecord::Base.connection.select_values("SELECT version FROM #{migration_table_name}").map {|v| '%.3d' % v}
13
- migrations = []
14
16
  ActiveRecord::Migrator.migrations_paths.each do |path|
15
17
  Dir.foreach(Rails.root.join(path)) do |file|
16
18
  if (version_and_name = /^(\d{3,})_(.+)\.rb$/.match(file))
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Erd
4
- VERSION = '0.6.3'
4
+ VERSION = '0.6.4'
5
5
  end
@@ -0,0 +1,549 @@
1
+ html, body, p, ul, ol, dl, p, li, dt, dd, tr, td, form {
2
+ margin: 0;
3
+ padding: 0; }
4
+
5
+ li {
6
+ list-style-type: none; }
7
+
8
+ .cancel {
9
+ display: block;
10
+ margin: 0.4em auto 0;
11
+ background: rgba(0, 0, 0, 0.4);
12
+ font-size: 12px;
13
+ width: 70px;
14
+ -webkit-border-radius: 4px;
15
+ -moz-border-radius: 4px;
16
+ -ms-border-radius: 4px;
17
+ -o-border-radius: 4px;
18
+ border-radius: 4px;
19
+ text-decoration: none;
20
+ line-height: 1.8;
21
+ text-align: center;
22
+ color: white;
23
+ position: relative;
24
+ padding: 2px 0 0 8px;
25
+ text-shadow: none; }
26
+ .cancel:hover {
27
+ background: rgba(0, 0, 0, 0.6); }
28
+ .cancel:before {
29
+ content: "";
30
+ display: block;
31
+ height: 10px;
32
+ width: 10px;
33
+ position: absolute;
34
+ left: 8px;
35
+ top: 6px;
36
+ background-image: image_url("erd/cancel.png");
37
+ background-size: 10px 10px;
38
+ background-position: center center; }
39
+
40
+ #erd_box {
41
+ display: -webkit-box;
42
+ display: -moz-box;
43
+ display: -ms-box;
44
+ display: -o-box;
45
+ display: box; }
46
+
47
+ #erd_container {
48
+ -webkit-box-flex: 1;
49
+ -moz-box-flex: 1;
50
+ -ms-box-flex: 1;
51
+ -o-box-flex: 1;
52
+ box-flex: 1; }
53
+
54
+ #open_migration,
55
+ #close_migration {
56
+ position: fixed;
57
+ top: 0;
58
+ background: rgba(0, 0, 0, 0.6);
59
+ width: 80px;
60
+ text-align: center;
61
+ color: white;
62
+ cursor: pointer;
63
+ z-index: 5; }
64
+ #open_migration:hover,
65
+ #close_migration:hover {
66
+ background: rgba(0, 0, 0, 0.8); }
67
+ #open_migration img,
68
+ #close_migration img {
69
+ width: 16px;
70
+ height: 27px;
71
+ display: block;
72
+ margin: 16px auto; }
73
+
74
+ #open_migration {
75
+ right: 15px; }
76
+
77
+ #migrate_form {
78
+ position: relative; }
79
+ #migrate_form #open_buttons {
80
+ position: absolute;
81
+ right: 0;
82
+ top: 0; }
83
+ #migrate_form #open_buttons li {
84
+ display: -moz-inline-stack;
85
+ display: inline-block;
86
+ vertical-align: middle;
87
+ *vertical-align: auto;
88
+ zoom: 1;
89
+ *display: inline; }
90
+
91
+ #migration {
92
+ padding: 10px 10px;
93
+ min-width: 500px;
94
+ overflow-x: auto;
95
+ -webkit-box-sizing: content-box;
96
+ -moz-box-sizing: content-box;
97
+ -ms-box-sizing: content-box;
98
+ -o-box-sizing: content-box;
99
+ box-sizing: content-box;
100
+ position: relative;
101
+ display: none; }
102
+ #migration table,
103
+ #migration th,
104
+ #migration td {
105
+ border: 1px #444444 solid;
106
+ border-collapse: collapse; }
107
+ #migration table {
108
+ width: 100%;
109
+ margin: 0 0 0.6em; }
110
+ #migration table caption {
111
+ font-weight: bold;
112
+ margin: 0 0 0.5em; }
113
+ #migration table thead td {
114
+ text-align: center; }
115
+ #migration table thead td button {
116
+ padding: 3px 30px; }
117
+ #migration table td {
118
+ font-size: 12px;
119
+ padding: 2px 0.8em;
120
+ line-height: 1.4; }
121
+ #migration table td.migrations {
122
+ background: #444444;
123
+ color: white; }
124
+ #migration table td.migration_file_name {
125
+ white-space: normal !important;
126
+ word-break: break-all;
127
+ -ms-word-wrap: break-word;
128
+ max-width: 200px; }
129
+ #migration table th {
130
+ background: -webkit-linear-gradient(top, #eeeeee 0%, #d0d0d0 88%);
131
+ background: -moz-linear-gradient(top, #eeeeee 0%, #d0d0d0 88%);
132
+ background: -ms-linear-gradient(top, #eeeeee 0%, #d0d0d0 88%);
133
+ background: -o-linear-gradient(top, #eeeeee 0%, #d0d0d0 88%);
134
+ background: linear-gradient(top, #eeeeee 0%, #d0d0d0 88%);
135
+ font-size: 13px;
136
+ font-weight: bold;
137
+ text-shadow: 0 1px 0 rgba(255, 255, 255, 0.6);
138
+ line-height: 2.2;
139
+ padding: 0 0.8em; }
140
+ #migration table th.status {
141
+ width: 60px; }
142
+ #migration table th.version {
143
+ width: 140px; }
144
+ #migration #changes_form {
145
+ margin: 0 0 20px; }
146
+
147
+ #migration_status {
148
+ width: 386px; }
149
+ #migration_status td.migration_file_name {
150
+ word-break: break-all; }
151
+ #migration_status td label {
152
+ white-space: nowrap; }
153
+ #migration_status tr.up, #migration_status tr.down {
154
+ font-size: 0;
155
+ height: 2px;
156
+ overflow: hidden; }
157
+ #migration_status tr.up *, #migration_status tr.down * {
158
+ font-size: 0;
159
+ overflow: hidden; }
160
+ #migration_status tr.up input, #migration_status tr.down input {
161
+ display: none; }
162
+ #migration_status tr.up:hover, #migration_status tr.up.active, #migration_status tr.up.open, #migration_status tr.down:hover, #migration_status tr.down.active, #migration_status tr.down.open {
163
+ height: auto;
164
+ background: white; }
165
+ #migration_status tr.up:hover *, #migration_status tr.up.active *, #migration_status tr.up.open *, #migration_status tr.down:hover *, #migration_status tr.down.active *, #migration_status tr.down.open * {
166
+ font-size: small;
167
+ height: auto;
168
+ overflow: auto; }
169
+ #migration_status tr.up:hover td, #migration_status tr.up.active td, #migration_status tr.up.open td, #migration_status tr.down:hover td, #migration_status tr.down.active td, #migration_status tr.down.open td {
170
+ padding: 4px 0.8em; }
171
+ #migration_status tr.up:hover input, #migration_status tr.up.active input, #migration_status tr.up.open input, #migration_status tr.down:hover input, #migration_status tr.down.active input, #migration_status tr.down.open input {
172
+ display: -moz-inline-stack;
173
+ display: inline-block;
174
+ vertical-align: middle;
175
+ *vertical-align: auto;
176
+ zoom: 1;
177
+ *display: inline; }
178
+ #migration_status tr.up.active, #migration_status tr.down.active {
179
+ background: #fffebe; }
180
+ #migration_status.show_all_migrations .up,
181
+ #migration_status.show_all_migrations .down {
182
+ height: auto;
183
+ background: white; }
184
+ #migration_status.show_all_migrations .up *,
185
+ #migration_status.show_all_migrations .down * {
186
+ font-size: small;
187
+ height: auto;
188
+ overflow: auto; }
189
+ #migration_status.show_all_migrations .up td,
190
+ #migration_status.show_all_migrations .down td {
191
+ padding: 4px 0.8em; }
192
+ #migration_status.show_all_migrations .up input,
193
+ #migration_status.show_all_migrations .down input {
194
+ display: -moz-inline-stack;
195
+ display: inline-block;
196
+ vertical-align: middle;
197
+ *vertical-align: auto;
198
+ zoom: 1;
199
+ *display: inline; }
200
+
201
+ #erd {
202
+ overflow: auto;
203
+ position: relative;
204
+ background-color: #3aade3;
205
+ background-image: image_url("/erd/background.png"); }
206
+ #erd form {
207
+ display: none; }
208
+ #erd .model {
209
+ background-color: white;
210
+ position: absolute;
211
+ border: 1px #444444 solid;
212
+ cursor: move;
213
+ z-index: 1; }
214
+ #erd .model:hover {
215
+ -webkit-box-shadow: rgba(0, 0, 0, 0.7) 0 2px 2px;
216
+ -moz-box-shadow: rgba(0, 0, 0, 0.7) 0 2px 2px;
217
+ -ms-box-shadow: rgba(0, 0, 0, 0.7) 0 2px 2px;
218
+ -o-box-shadow: rgba(0, 0, 0, 0.7) 0 2px 2px;
219
+ box-shadow: rgba(0, 0, 0, 0.7) 0 2px 2px; }
220
+ #erd .model .model_name {
221
+ border-bottom: 1px #444444 solid;
222
+ cursor: pointer;
223
+ margin: 1px 5px 0 5px auto; }
224
+ #erd .model .model_name .model_name_text {
225
+ text-align: center;
226
+ display: block;
227
+ background: -webkit-linear-gradient(top, #eeeeee 0%, #d0d0d0 88%);
228
+ background: -moz-linear-gradient(top, #eeeeee 0%, #d0d0d0 88%);
229
+ background: -ms-linear-gradient(top, #eeeeee 0%, #d0d0d0 88%);
230
+ background: -o-linear-gradient(top, #eeeeee 0%, #d0d0d0 88%);
231
+ background: linear-gradient(top, #eeeeee 0%, #d0d0d0 88%);
232
+ font-size: 13px;
233
+ font-weight: bold;
234
+ text-shadow: 0 1px 0 rgba(255, 255, 255, 0.6);
235
+ line-height: 2.2;
236
+ padding: 0 0.8em; }
237
+ #erd .model .model_name .model_name_text.unsaved {
238
+ background: #fffebe;
239
+ position: relative;
240
+ background: #fffebe;
241
+ position: relative; }
242
+ #erd .model .model_name .model_name_text.unsaved:before {
243
+ content: "!";
244
+ display: block;
245
+ position: absolute;
246
+ width: 18px;
247
+ height: 18px;
248
+ background: #ec7500;
249
+ left: -14px;
250
+ top: 6px;
251
+ text-align: center;
252
+ line-height: 18px;
253
+ color: white;
254
+ -webkit-border-radius: 100px;
255
+ -moz-border-radius: 100px;
256
+ -ms-border-radius: 100px;
257
+ -o-border-radius: 100px;
258
+ border-radius: 100px;
259
+ -webkit-box-shadow: rgba(0, 0, 0, 0.4) 0px 1px 1px;
260
+ -moz-box-shadow: rgba(0, 0, 0, 0.4) 0px 1px 1px;
261
+ -ms-box-shadow: rgba(0, 0, 0, 0.4) 0px 1px 1px;
262
+ -o-box-shadow: rgba(0, 0, 0, 0.4) 0px 1px 1px;
263
+ box-shadow: rgba(0, 0, 0, 0.4) 0px 1px 1px;
264
+ font-size: 12px;
265
+ font-family: Arial, sans-serif; }
266
+ #erd .model .model_name .model_name_text.unsaved:hover {
267
+ background: #f9f8b8; }
268
+ #erd .model .model_name form {
269
+ background: -webkit-linear-gradient(top, #eeeeee 0%, #d0d0d0 88%);
270
+ background: -moz-linear-gradient(top, #eeeeee 0%, #d0d0d0 88%);
271
+ background: -ms-linear-gradient(top, #eeeeee 0%, #d0d0d0 88%);
272
+ background: -o-linear-gradient(top, #eeeeee 0%, #d0d0d0 88%);
273
+ background: linear-gradient(top, #eeeeee 0%, #d0d0d0 88%);
274
+ font-size: 13px;
275
+ font-weight: bold;
276
+ text-shadow: 0 1px 0 rgba(255, 255, 255, 0.6);
277
+ line-height: 2.2;
278
+ padding: 0 0.8em;
279
+ padding: 8px; }
280
+ #erd .model .model_name > div.model_name_text:hover {
281
+ background: -webkit-linear-gradient(top, #b9e0f5 0%, #9bc2d7 88%);
282
+ background: -moz-linear-gradient(top, #b9e0f5 0%, #9bc2d7 88%);
283
+ background: -ms-linear-gradient(top, #b9e0f5 0%, #9bc2d7 88%);
284
+ background: -o-linear-gradient(top, #b9e0f5 0%, #9bc2d7 88%);
285
+ background: linear-gradient(top, #b9e0f5 0%, #9bc2d7 88%); }
286
+ #erd .model a.close {
287
+ position: absolute;
288
+ top: -6px;
289
+ right: -6px;
290
+ z-index: 2;
291
+ background-color: #444444;
292
+ border: 1px solid #444444;
293
+ display: block;
294
+ width: 16px;
295
+ height: 13px;
296
+ text-align: center;
297
+ -webkit-border-radius: 9px;
298
+ -moz-border-radius: 9px;
299
+ -ms-border-radius: 9px;
300
+ -o-border-radius: 9px;
301
+ border-radius: 9px;
302
+ padding: 3px 0 0; }
303
+ #erd .model a.close:hover {
304
+ background: #767676; }
305
+ #erd .model a.close img {
306
+ width: 10px;
307
+ height: 10px;
308
+ display: block;
309
+ margin: 0 auto; }
310
+
311
+ .add_column_box {
312
+ text-align: center; }
313
+ .add_column_box a.add_column {
314
+ font-size: small;
315
+ display: block;
316
+ padding: 0 5px;
317
+ line-height: 2;
318
+ background: #444444;
319
+ color: white;
320
+ text-decoration: none; }
321
+ .add_column_box a.add_column:hover {
322
+ background: #3a3a3a; }
323
+
324
+ .add_column_form {
325
+ background: #444444;
326
+ color: white;
327
+ padding: 8px; }
328
+
329
+ .columns .column {
330
+ border-bottom: dotted 1px #cccccc;
331
+ padding: 0 0.8em;
332
+ clear: both;
333
+ line-height: 28px;
334
+ font-size: 14px; }
335
+ .columns .column table {
336
+ width: 100%; }
337
+ .columns .column:nth-child(even) {
338
+ background: #f9f9f9; }
339
+ .columns .column:last-child {
340
+ border-bottom: none; }
341
+ .columns .column .column_name_text,
342
+ .columns .column .column_type_text {
343
+ cursor: pointer; }
344
+ .columns .column .column_name_text {
345
+ margin: 0 1.4em 0 0; }
346
+ .columns .column .column_name_text:hover {
347
+ text-decoration: underline; }
348
+ .columns .column.unsaved {
349
+ background: #fffebe;
350
+ position: relative; }
351
+ .columns .column.unsaved:before {
352
+ content: "!";
353
+ display: block;
354
+ position: absolute;
355
+ width: 18px;
356
+ height: 18px;
357
+ background: #ec7500;
358
+ left: -14px;
359
+ top: 6px;
360
+ text-align: center;
361
+ line-height: 18px;
362
+ color: white;
363
+ -webkit-border-radius: 100px;
364
+ -moz-border-radius: 100px;
365
+ -ms-border-radius: 100px;
366
+ -o-border-radius: 100px;
367
+ border-radius: 100px;
368
+ -webkit-box-shadow: rgba(0, 0, 0, 0.4) 0px 1px 1px;
369
+ -moz-box-shadow: rgba(0, 0, 0, 0.4) 0px 1px 1px;
370
+ -ms-box-shadow: rgba(0, 0, 0, 0.4) 0px 1px 1px;
371
+ -o-box-shadow: rgba(0, 0, 0, 0.4) 0px 1px 1px;
372
+ box-shadow: rgba(0, 0, 0, 0.4) 0px 1px 1px;
373
+ font-size: 12px;
374
+ font-family: Arial, sans-serif; }
375
+ .columns .column.unsaved:hover {
376
+ background: #f9f8b8; }
377
+ .columns .column .rename_column_form {
378
+ padding: 8px; }
379
+ .columns .column .column_type_text {
380
+ font-size: 10px;
381
+ float: right;
382
+ display: block;
383
+ line-height: 16px;
384
+ margin: 5px 0 0;
385
+ -webkit-border-radius: 4px;
386
+ -moz-border-radius: 4px;
387
+ -ms-border-radius: 4px;
388
+ -o-border-radius: 4px;
389
+ border-radius: 4px;
390
+ border-width: 1px;
391
+ border-style: solid;
392
+ width: 70px;
393
+ text-align: center;
394
+ border-color: #e98c60;
395
+ background: #f9eee9;
396
+ color: #444444;
397
+ border-style: solid; }
398
+ .columns .column .column_type_text:hover {
399
+ border-color: #e36c33;
400
+ background: #edd0c2; }
401
+ .columns .column .column_type_text.date, .columns .column .column_type_text.time, .columns .column .column_type_text.timestamp, .columns .column .column_type_text.datetime {
402
+ border-color: #da6272;
403
+ background: #f3e2e4;
404
+ color: #444444;
405
+ border-style: solid; }
406
+ .columns .column .column_type_text.date:hover, .columns .column .column_type_text.time:hover, .columns .column .column_type_text.timestamp:hover, .columns .column .column_type_text.datetime:hover {
407
+ border-color: #d0394d;
408
+ background: #e4bec3; }
409
+ .columns .column .column_type_text.boolean {
410
+ border-color: #45a1cf;
411
+ background: #c7dce6;
412
+ color: #444444;
413
+ border-style: solid; }
414
+ .columns .column .column_type_text.boolean:hover {
415
+ border-color: #2e87b3;
416
+ background: #a3c6d7; }
417
+ .columns .column .column_type_text.text {
418
+ border-color: #dab24f;
419
+ background: #efe7d3;
420
+ color: #444444;
421
+ border-style: solid; }
422
+ .columns .column .column_type_text.text:hover {
423
+ border-color: #cb9d2b;
424
+ background: #e1d2ae; }
425
+ .columns .column .column_type_text.decimal {
426
+ border-color: #8e8e08;
427
+ background: #dfdf50;
428
+ color: #444444;
429
+ border-style: solid; }
430
+ .columns .column .column_type_text.decimal:hover {
431
+ border-color: #5e5e05;
432
+ background: #d5d527; }
433
+ .columns .column .column_type_text.float {
434
+ border-color: #85616b;
435
+ background: silver;
436
+ color: #444444;
437
+ border-style: solid; }
438
+ .columns .column .column_type_text.float:hover {
439
+ border-color: #684b53;
440
+ background: #a6a6a6; }
441
+ .columns .column .column_type_text.integer {
442
+ border-color: #7c80aa;
443
+ background: #dfdfe0;
444
+ color: #444444;
445
+ border-style: solid; }
446
+ .columns .column .column_type_text.integer:hover {
447
+ border-color: #606493;
448
+ background: #c5c5c7; }
449
+ .columns .column .column_type_text.primary_key {
450
+ border-color: #ea9a5d;
451
+ background: #f9efe7;
452
+ color: #444444;
453
+ border-style: solid; }
454
+ .columns .column .column_type_text.primary_key:hover {
455
+ border-color: #e47e30;
456
+ background: #eed3bf; }
457
+ .columns .column .column_type_text.string {
458
+ border-color: #a4c520;
459
+ background: #d3e09e;
460
+ color: #444444;
461
+ border-style: solid; }
462
+ .columns .column .column_type_text.string:hover {
463
+ border-color: #7f9919;
464
+ background: #c1d477; }
465
+ .columns .column .column_type_text.unsaved {
466
+ border-color: #a55d00;
467
+ background: #eca952;
468
+ color: #444444;
469
+ border-style: solid; }
470
+ .columns .column .column_type_text.unsaved:hover {
471
+ border-color: #724000;
472
+ background: #e79224; }
473
+ .columns .column .alter_column_form {
474
+ padding: 8px; }
475
+ .columns .column:hover {
476
+ background-color: #ebebeb; }
477
+
478
+ #executed, #failed {
479
+ padding: 7px;
480
+ padding-bottom: 0;
481
+ margin-bottom: 20px;
482
+ background-color: #f0f0f0; }
483
+ #executed h2, #failed h2 {
484
+ text-align: left;
485
+ font-weight: bold;
486
+ padding: 5px 5px 5px 15px;
487
+ font-size: 12px;
488
+ margin: -7px;
489
+ margin-bottom: 0px;
490
+ color: white; }
491
+ #executed h3, #failed h3 {
492
+ font-size: 12px;
493
+ margin: 0;
494
+ padding: 0; }
495
+ #executed ul li, #failed ul li {
496
+ margin-left: 25px;
497
+ font-size: 12px;
498
+ list-style: square; }
499
+
500
+ #executed {
501
+ border: 2px lime solid; }
502
+ #executed h2 {
503
+ background-color: #00cc00; }
504
+
505
+ #failed {
506
+ border: 2px red solid; }
507
+ #failed h2 {
508
+ background-color: #cc0000; }
509
+
510
+ #model_name_changes, #column_name_changes {
511
+ display: none; }
512
+
513
+ #open_create_model_dialog {
514
+ position: fixed;
515
+ right: 15px;
516
+ top: 70px;
517
+ background: rgba(0, 0, 0, 0.6);
518
+ padding: 12px 20px;
519
+ color: white;
520
+ text-decoration: none;
521
+ font-size: 13px; }
522
+ #open_create_model_dialog:hover {
523
+ background: rgba(0, 0, 0, 0.8); }
524
+
525
+ #create_model_form {
526
+ font-size: 14px; }
527
+
528
+ #create_model_table {
529
+ margin: 12px auto;
530
+ border-spacing: 0;
531
+ width: 100%; }
532
+ #create_model_table tr:nth-child(odd) td {
533
+ background: #f8f8f8; }
534
+ #create_model_table tr:nth-child(even) td {
535
+ background: #eee; }
536
+ #create_model_table tr td {
537
+ padding: 6px 12px; }
538
+ #create_model_table tr td input {
539
+ width: 100%;
540
+ box-sizing: border-box; }
541
+ #create_model_table tr td.separator {
542
+ padding: 6px 0; }
543
+
544
+ #new_model_add_column {
545
+ margin: 10px auto 0;
546
+ display: block;
547
+ width: 160px;
548
+ padding: 2px 10px;
549
+ text-decoration: none; }