brick 1.0.198 → 1.0.200
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 +115 -605
- data/lib/brick/frameworks/rails/engine.rb +2 -37
- data/lib/brick/frameworks/rails/form_tags.rb +3 -3
- data/lib/brick/reflect_tables.rb +582 -0
- data/lib/brick/route_mapper.rb +20 -4
- data/lib/brick/version_number.rb +1 -1
- data/lib/brick.rb +2 -1
- data/lib/generators/brick/migration_builder.rb +8 -5
- metadata +3 -2
@@ -141,7 +141,7 @@ module Brick
|
|
141
141
|
end
|
142
142
|
end).present?
|
143
143
|
fringe.each do |tbl|
|
144
|
-
mig = gen_migration_columns(relations, tbl, (tbl_parts = tbl.split('.')), (add_fks = []),
|
144
|
+
mig = gen_migration_columns(relations, tbl, (tbl_parts = tbl.split('.')), (add_fks = []), built_schemas, mig_path, current_mig_time,
|
145
145
|
key_type, is_4x_rails, ar_version, do_fks_last)
|
146
146
|
after_fks.concat(add_fks) if do_fks_last
|
147
147
|
versions_to_create << migration_file_write(mig_path, "create_#{::Brick._brick_index(tbl, nil, 'x')}", current_mig_time += 1.minute, ar_version, mig)
|
@@ -153,7 +153,7 @@ module Brick
|
|
153
153
|
if do_fks_last
|
154
154
|
# Write out any more tables that haven't been done yet
|
155
155
|
chosen.each do |tbl|
|
156
|
-
mig = gen_migration_columns(relations, tbl, (tbl_parts = tbl.split('.')), (add_fks = []),
|
156
|
+
mig = gen_migration_columns(relations, tbl, (tbl_parts = tbl.split('.')), (add_fks = []), built_schemas, mig_path, current_mig_time,
|
157
157
|
key_type, is_4x_rails, ar_version, do_fks_last)
|
158
158
|
after_fks.concat(add_fks)
|
159
159
|
migration_file_write(mig_path, "create_#{::Brick._brick_index(tbl, nil, 'x')}", current_mig_time += 1.minute, ar_version, mig)
|
@@ -204,8 +204,11 @@ module Brick
|
|
204
204
|
# No official PK, but if coincidentally there's a column of the same name, take a chance on it
|
205
205
|
pk = (add_fk[2][:cols].key?(add_fk[1]) && add_fk[1]) || '???'
|
206
206
|
end
|
207
|
-
|
208
|
-
|
207
|
+
from_table = add_fk[3]
|
208
|
+
from_table = "'#{from_table[1..-1]}'" if from_table[0] == ':'
|
209
|
+
to_table = add_fk[0]
|
210
|
+
to_table = "'#{to_table[1..-1]}'" if to_table[0] == ':'
|
211
|
+
puts " [#{from_table}, #{add_fk[1].inspect}, #{to_table}],"
|
209
212
|
end
|
210
213
|
puts ' ]'
|
211
214
|
end
|
@@ -251,7 +254,7 @@ module Brick
|
|
251
254
|
|
252
255
|
private
|
253
256
|
|
254
|
-
def gen_migration_columns(relations, tbl, tbl_parts, add_fks,
|
257
|
+
def gen_migration_columns(relations, tbl, tbl_parts, add_fks, built_schemas, mig_path, current_mig_time,
|
255
258
|
key_type, is_4x_rails, ar_version, do_fks_last)
|
256
259
|
return unless (relation = relations.fetch(tbl, nil))&.fetch(:cols, nil)&.present?
|
257
260
|
|
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.200
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Lorin Thwaits
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-01-
|
11
|
+
date: 2024-01-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -248,6 +248,7 @@ files:
|
|
248
248
|
- lib/brick/frameworks/rails/form_tags.rb
|
249
249
|
- lib/brick/frameworks/rspec.rb
|
250
250
|
- lib/brick/join_array.rb
|
251
|
+
- lib/brick/reflect_tables.rb
|
251
252
|
- lib/brick/route_mapper.rb
|
252
253
|
- lib/brick/serializers/json.rb
|
253
254
|
- lib/brick/serializers/yaml.rb
|