rails-domino 0.2.9.2 → 0.2.9.3
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 +4 -4
- data/lib/domino/scaffolder.rb +21 -1
- data/lib/domino/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9ad8b002c5b3dbc3acaacd130c2aa856a37fd9fadea0d159b0a7153f45f7a362
|
4
|
+
data.tar.gz: 5a34dc2bbc0462735e0fd32be3a55c64179dc0f84e811f423fae3a8807eb98cf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 386ebca7ab3f1134f0f19d3f804152401358ac1c8cd90cb26295d343c9fd222fb7b9631e9d91fb98c244a69899379616b971f3399c1b37c627c1c3d21ae0c032
|
7
|
+
data.tar.gz: b14b99a9ec6750e925748d55c3a98accd60ff885c2e613a8f51fc994198c5ecc2f9caa663f56e1253c059ef09712dc6468b3276f20af52be09c279cebb779257
|
data/lib/domino/scaffolder.rb
CHANGED
@@ -48,7 +48,27 @@ module Domino
|
|
48
48
|
end
|
49
49
|
|
50
50
|
def column_args
|
51
|
-
@columns.map { |col| "#{col.name}:#{col.sql_type}" unless col.name == "id" }.compact
|
51
|
+
# @columns.map { |col| "#{col.name}:#{col.sql_type}" unless col.name == "id" }.compact
|
52
|
+
@columns.map do |col|
|
53
|
+
next if col.name == "id"
|
54
|
+
|
55
|
+
rails_type = map_sql_type(col.sql_type)
|
56
|
+
"#{col.name}:#{rails_type}" if rails_type
|
57
|
+
end.compact
|
58
|
+
end
|
59
|
+
|
60
|
+
def map_sql_type(sql_type) # rubocop:disable Metrics/MethodLength
|
61
|
+
case sql_type
|
62
|
+
when /nvarchar|varchar|text/ then "string"
|
63
|
+
when /int/ then "integer"
|
64
|
+
when /timestamp/ then "datetime"
|
65
|
+
when /bool/ then "boolean"
|
66
|
+
when /decimal|numeric/ then "decimal"
|
67
|
+
when /date/ then "date"
|
68
|
+
else
|
69
|
+
puts "Warning: unknown SQL type #{sql_type}, skipping."
|
70
|
+
nil
|
71
|
+
end
|
52
72
|
end
|
53
73
|
|
54
74
|
def generate_file(type) # rubocop:disable Metrics/MethodLength
|
data/lib/domino/version.rb
CHANGED