brick 1.0.144 → 1.0.146

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6b84f681ffcc3cfbc37531e21ee68c07a27df07d0b0b63aed94d7e13fedc8ec1
4
- data.tar.gz: b1f96b376d7c27b9a01e8025f8628efdfedff77875b089323e66bdff557a4141
3
+ metadata.gz: 5a3f6fe9aa20dd0fe9ae7058874432a5966dea3b36f79d1e84702728fb010071
4
+ data.tar.gz: fc6fa3766a3413f9ba4df5cd1d8361bea351a180f6a7950a3ef1f9427145884b
5
5
  SHA512:
6
- metadata.gz: d6b2dfbd93defb98b61bd20c405657d8b3df5c9f1c4887dc37fe75a09fdcc61abc9ba15a1e9a16006487017f270d62ca1843fefeea574eb8df07fc55f136693b
7
- data.tar.gz: 4f1d192f9420b9f8cfac9fa7d6f7f6c057d5bb0f852b8066937f79410b20005b4080b6bdec16f2e470e8fa1a9e5331fd26b64d675e1e397942ec65a371f8d977
6
+ metadata.gz: 64f5575cfba4fa0a7983ae4621941a3da6622ed70f606c7c418814d1041a10fec4b522cc0f4741faa6677681a1453b92f0cce31ad36edba9cb0f0c4ca9e812e2
7
+ data.tar.gz: e5aa7fa963d0756a9fa8946daef90f03e1d6e38210811a58c7f901895d44132785222095ea1b3f56223ef663328ecc3536d35a9b8bed6e97fde94edb5f4d5250
@@ -2661,6 +2661,7 @@ ORDER BY 1, 2, c.internal_column_id, acc.position"
2661
2661
 
2662
2662
  def retrieve_schema_and_tables(sql = nil, is_postgres = nil, is_mssql = nil, schema = nil)
2663
2663
  is_mssql = ActiveRecord::Base.connection.adapter_name == 'SQLServer' if is_mssql.nil?
2664
+ params = ar_tables
2664
2665
  sql ||= "SELECT t.table_schema AS \"schema\", t.table_name AS relation_name, t.table_type,#{"
2665
2666
  pg_catalog.obj_description(
2666
2667
  ('\"' || t.table_schema || '\".\"' || t.table_name || '\"')::regclass::oid, 'pg_class'
@@ -2698,12 +2699,16 @@ ORDER BY 1, 2, c.internal_column_id, acc.position"
2698
2699
  "NOT IN ('information_schema', 'pg_catalog', 'pg_toast', 'heroku_ext',
2699
2700
  'INFORMATION_SCHEMA', 'sys')"
2700
2701
  :
2701
- "= '#{ActiveRecord::Base.connection.current_database&.tr("'", "''")}'"}#{"
2702
- AND t.table_schema = COALESCE(current_setting('SEARCH_PATH'), 'public')" if is_postgres && schema }
2702
+ "= '#{ActiveRecord::Base.connection.current_database&.tr("'", "''")}'"}#{
2703
+ if is_postgres && schema
2704
+ params = params.unshift(schema) # Used to use this SQL: current_setting('SEARCH_PATH')
2705
+ "
2706
+ AND t.table_schema = COALESCE(?, 'public')"
2707
+ end}
2703
2708
  -- AND t.table_type IN ('VIEW') -- 'BASE TABLE', 'FOREIGN TABLE'
2704
2709
  AND t.table_name NOT IN ('pg_stat_statements', ?, ?)
2705
2710
  ORDER BY 1, t.table_type DESC, 2, c.ordinal_position"
2706
- ActiveRecord::Base.execute_sql(sql, *ar_tables)
2711
+ ActiveRecord::Base.execute_sql(sql, *params)
2707
2712
  end
2708
2713
 
2709
2714
  def ar_tables
@@ -1165,7 +1165,7 @@ erDiagram
1165
1165
  }\\\"\".html_safe %>
1166
1166
  <%= sidelinks(shown_classes, bt_class).html_safe %>
1167
1167
  <% end
1168
- last_through = nil
1168
+ last_hm = nil
1169
1169
  @_brick_hm_counts&.each do |hm|
1170
1170
  # Skip showing self-referencing HM links since they would have already been drawn while evaluating the BT side
1171
1171
  next if (hm_class = hm.last&.klass) == #{@_brick_model.name}
@@ -1174,18 +1174,18 @@ erDiagram
1174
1174
  if (through = hm.last.options[:through]&.to_s) # has_many :through (HMT)
1175
1175
  through_name = (through_assoc = hm.last.source_reflection).active_record.name.split('::').last
1176
1176
  callbacks[through_name] = through_assoc.active_record
1177
- if last_through == through # Same HM, so no need to build it again, and for clarity just put in a blank line
1177
+ if last_hm == through # Same HM, so no need to build it again, and for clarity just put in a blank line
1178
1178
  %><%= \"\n\"
1179
1179
  %><% else
1180
1180
  %> <%= \"#\{model_short_name} ||--o{ #\{through_name}\".html_safe %> : \"\"
1181
1181
  <%= sidelinks(shown_classes, through_assoc.active_record).html_safe %>
1182
- <% last_through = through
1182
+ <% last_hm = through
1183
1183
  end
1184
1184
  %> <%= \"#\{through_name} }o--|| #\{hm_name}\".html_safe %> : \"\"
1185
1185
  <%= \"#\{model_short_name} }o..o{ #\{hm_name} : \\\"#\{hm.first}\\\"\".html_safe %><%
1186
1186
  else # has_many
1187
1187
  %> <%= \"#\{model_short_name} ||--o{ #\{hm_name} : \\\"#\{
1188
- hm.first.to_s unless hm.first.to_s.downcase == hm_class.name.underscore.pluralize.tr('/', '_')
1188
+ hm.first.to_s unless (last_hm = hm.first.to_s).downcase == hm_class.name.underscore.pluralize.tr('/', '_')
1189
1189
  }\\\"\".html_safe %><%
1190
1190
  end %>
1191
1191
  <%= sidelinks(shown_classes, hm_class).html_safe %>
@@ -1846,7 +1846,11 @@ flatpickr(\".timepicker\", {enableTime: true, noCalendar: true});
1846
1846
  var imgErd = document.getElementById(\"imgErd\");
1847
1847
  var mermaidErd = document.getElementById(\"mermaidErd\");
1848
1848
  var mermaidCode;
1849
- var cbs = {<%= callbacks.map { |k, v| \"#\{k}: \\\"#\{send(\"#\{v._brick_index}_path\".to_sym)}\\\"\" }.join(', ').html_safe %>};
1849
+ var cbs = {<%= callbacks.map do |k, v|
1850
+ path = send(\"#\{v._brick_index}_path\".to_sym)
1851
+ path << \"?#\{v.base_class.inheritance_column}=#\{v.name}\" unless v == v.base_class
1852
+ \"#\{k}: \\\"#\{path}\\\"\"
1853
+ end.join(', ').html_safe %>};
1850
1854
  if (imgErd) imgErd.addEventListener(\"click\", showErd);
1851
1855
  function showErd() {
1852
1856
  imgErd.style.display = \"none\";
@@ -5,7 +5,7 @@ module Brick
5
5
  module VERSION
6
6
  MAJOR = 1
7
7
  MINOR = 0
8
- TINY = 144
8
+ TINY = 146
9
9
 
10
10
  # PRE is nil unless it's a pre-release (beta, RC, etc.)
11
11
  PRE = nil
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: brick
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.144
4
+ version: 1.0.146
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lorin Thwaits
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-05-23 00:00:00.000000000 Z
11
+ date: 2023-05-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord