brick 1.0.232 → 1.0.233
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 153b8d0a95771a92fad553394bb1dd51633a971e7909b3a32e6cf548dacb2cb9
|
4
|
+
data.tar.gz: '094c6476db206319239def080ffc9349a4e8ec35c915e23a3cf1db3a5d8b425d'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 54c76ebb11fead41ed9ae33fee09e2e6e4685aa12c50c073a9da72d1004d08c2065b441d2bf272d06e8aacc2de16401c74636c61f65048d30e6b9d0bd49add8a
|
7
|
+
data.tar.gz: 1c391fa9c4acfbb9ce327d9da410e23ee9c1b183145f1a636ca5be91ac48b369346859432982033f74cf50de99f7d4f9c2011e7111eeefe4830bd76e45d5b931
|
data/lib/brick/version_number.rb
CHANGED
@@ -64,11 +64,11 @@ Please provide your Airtable PAT:"
|
|
64
64
|
else
|
65
65
|
# puts col['type']
|
66
66
|
dt = case col['type']
|
67
|
-
when 'singleLineText', 'url', 'singleSelect'
|
67
|
+
when 'singleLineText', 'url', 'email', 'singleSelect'
|
68
68
|
'string'
|
69
69
|
when 'multilineText'
|
70
70
|
'text'
|
71
|
-
when 'number'
|
71
|
+
when 'number', 'currency'
|
72
72
|
'decimal'
|
73
73
|
when 'checkbox'
|
74
74
|
'boolean'
|
@@ -140,7 +140,7 @@ Please provide your Airtable PAT:"
|
|
140
140
|
end
|
141
141
|
|
142
142
|
def sane_name(col_name)
|
143
|
-
sane_table_name(col_name.gsub('&', 'and').tr('()?', ''))
|
143
|
+
sane_table_name(col_name.gsub('&', 'and').tr('()?', '').tr('/', '_'))
|
144
144
|
end
|
145
145
|
|
146
146
|
def sane_table_name(tbl_name)
|
@@ -183,7 +183,9 @@ module Brick
|
|
183
183
|
# to_table column
|
184
184
|
mig << "#{add_fk[0]}, column: :#{add_fk[1]}, primary_key: :#{pk}\n"
|
185
185
|
end
|
186
|
-
|
186
|
+
# If there are LOTS of foreign keys then give extra database maintenance info and initially
|
187
|
+
# disable the final FK migration by using a ".rbx" file extension.
|
188
|
+
fks_extension = if after_fks.length > 500
|
187
189
|
minutes = (after_fks.length + 1000) / 1500
|
188
190
|
mig << " if ActiveRecord::Base.connection.adapter_name == 'PostgreSQL'\n"
|
189
191
|
mig << " puts 'NOTE: It could take around #{minutes} #{'minute'.pluralize(minutes)} on a FAST machine for Postgres to do all the final processing for these foreign keys. Please be patient!'\n"
|
@@ -194,14 +196,19 @@ module Brick
|
|
194
196
|
execute('VACUUM FULL')
|
195
197
|
execute('BEGIN TRANSACTION')
|
196
198
|
end\n"
|
199
|
+
'rbx'
|
200
|
+
else
|
201
|
+
'rb'
|
197
202
|
end
|
198
203
|
mig << +" end\n"
|
199
204
|
current_mig_time[0] += 1.minute
|
200
|
-
versions_to_create << migration_file_write(mig_path,
|
201
|
-
puts "Have written out a final migration called 'create_brick_fks
|
202
|
-
|
205
|
+
versions_to_create << migration_file_write(mig_path, "create_brick_fks.#{fks_extension}", current_mig_time, ar_version, mig)
|
206
|
+
puts "Have written out a final migration called 'create_brick_fks.#{fks_extension}' which creates #{after_fks.length} foreign keys."
|
207
|
+
if fks_extension == 'rbx'
|
208
|
+
puts " This file extension (.rbx) will cause it not to run yet when you do a 'rails db:migrate'.
|
203
209
|
The idea here is to do all data loading first, and then rename that migration file back
|
204
210
|
into having a .rb extension, and run a final db:migrate to put the foreign keys in place."
|
211
|
+
end
|
205
212
|
|
206
213
|
when 'Create' # Show additional_references entries that can be added into brick.rb
|
207
214
|
puts 'Place this block into your brick.rb file:'
|
@@ -162,14 +162,14 @@ module Brick
|
|
162
162
|
s[col_name] = obj['fields'][field.first]
|
163
163
|
else # Consider N:M fks
|
164
164
|
hm_fk = relation[:fks].find { |_k, fk1| !fk1[:is_bt] && fk1[:assoc_name] == ::Brick::AirtableApiCaller.sane_name(field.first) }&.last
|
165
|
-
if (
|
166
|
-
associative_fks = relations[
|
165
|
+
if (assoc_table = hm_fk&.fetch(:inverse_table, nil))
|
166
|
+
associative_fks = relations[assoc_table][:fks]
|
167
167
|
# near_side_fk = associative_fks.find { |_k, fk1| fk1[:is_bt] && fk1[:assoc_name] == ::Brick::AirtableApiCaller.sane_name(field.first) }&.last
|
168
168
|
far_side_fk = associative_fks.find { |_k, fk1| fk1[:is_bt] && fk1[:assoc_name] != ::Brick::AirtableApiCaller.sane_name(field.first) }&.last
|
169
169
|
field.last.each do |nm_rec|
|
170
170
|
# Can trade out: hm_fk[:fk] for: near_side_fk[:inverse_table]
|
171
|
-
airtable_assoc_recids[
|
172
|
-
|
171
|
+
airtable_assoc_recids[assoc_table] << "#{hm_fk[:fk]}: #{hm_fk[:fk].singularize}_#{nm_rec[3..-1]}, " \
|
172
|
+
"#{far_side_fk[:assoc_name]}: #{far_side_fk[:inverse_table].singularize}_#{obj['id'][3..-1]}"
|
173
173
|
end
|
174
174
|
end
|
175
175
|
end
|
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.233
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Lorin Thwaits
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-03-
|
11
|
+
date: 2025-03-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|