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 +4 -4
- data/lib/brick/extensions.rb +8 -3
- data/lib/brick/frameworks/rails/engine.rb +9 -5
- data/lib/brick/version_number.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5a3f6fe9aa20dd0fe9ae7058874432a5966dea3b36f79d1e84702728fb010071
|
4
|
+
data.tar.gz: fc6fa3766a3413f9ba4df5cd1d8361bea351a180f6a7950a3ef1f9427145884b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 64f5575cfba4fa0a7983ae4621941a3da6622ed70f606c7c418814d1041a10fec4b522cc0f4741faa6677681a1453b92f0cce31ad36edba9cb0f0c4ca9e812e2
|
7
|
+
data.tar.gz: e5aa7fa963d0756a9fa8946daef90f03e1d6e38210811a58c7f901895d44132785222095ea1b3f56223ef663328ecc3536d35a9b8bed6e97fde94edb5f4d5250
|
data/lib/brick/extensions.rb
CHANGED
@@ -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
|
-
|
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, *
|
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
|
-
|
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
|
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
|
-
<%
|
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
|
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\";
|
data/lib/brick/version_number.rb
CHANGED
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.
|
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-
|
11
|
+
date: 2023-05-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|