dynamic_migrations 3.6.2 → 3.6.3
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b60f89c7a66fe00d71581049f4886a5baa6ca89255dbb47315637bfa6fc5d9be
|
4
|
+
data.tar.gz: cde91d7188a94a3443c8331c6efa9e966a8e86fee236fb156adc577cfebbc156
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2a047c9a0d916de3bd28cd8bf41cbb91d7603eb562d68a5e5a9c099a1418d25a9756787ed735fe0badd8de712418366567b3af65cb86cf1c6b3c3898390c8415
|
7
|
+
data.tar.gz: 6ff07ad81f425dc6c2804e4dc38c36ee4122ff89b449fa9c98065213ca2730f0cf3f4e3c014f465482835c54d6d3f52453a0e0b463a694517b6c0c039e0bb3e9
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,12 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## [3.6.3](https://github.com/craigulliott/dynamic_migrations/compare/v3.6.2...v3.6.3) (2023-09-13)
|
4
|
+
|
5
|
+
|
6
|
+
### Bug Fixes
|
7
|
+
|
8
|
+
* passing correct type when generating column migrations ([e345d56](https://github.com/craigulliott/dynamic_migrations/commit/e345d56cdb11bb965c71c251d82ce2087b416f47))
|
9
|
+
|
3
10
|
## [3.6.2](https://github.com/craigulliott/dynamic_migrations/compare/v3.6.1...v3.6.2) (2023-09-13)
|
4
11
|
|
5
12
|
|
@@ -32,9 +32,17 @@ module DynamicMigrations
|
|
32
32
|
|
33
33
|
options_syntax = options.map { |k, v| "#{k}: #{v}" }.join(", ")
|
34
34
|
|
35
|
-
data_type = column.data_type
|
35
|
+
data_type = column.data_type.to_s
|
36
|
+
# if it's an array, then we need to remove the [] from the end
|
36
37
|
if column.array?
|
37
|
-
data_type =
|
38
|
+
data_type = data_type.sub(/\[\]\z/, "")
|
39
|
+
end
|
40
|
+
# if its a custom type (has special characters) then we need to quote it
|
41
|
+
# otherwise, present it as a symbol
|
42
|
+
data_type = if data_type.match?(/\A\w+\z/)
|
43
|
+
":#{data_type}"
|
44
|
+
else
|
45
|
+
"\"#{data_type}\""
|
38
46
|
end
|
39
47
|
|
40
48
|
add_fragment schema: column.table.schema,
|
@@ -43,7 +51,7 @@ module DynamicMigrations
|
|
43
51
|
object: column,
|
44
52
|
code_comment: code_comment,
|
45
53
|
migration: <<~RUBY
|
46
|
-
add_column :#{column.table.name}, :#{column.name},
|
54
|
+
add_column :#{column.table.name}, :#{column.name}, #{data_type}, #{options_syntax}
|
47
55
|
RUBY
|
48
56
|
end
|
49
57
|
|
@@ -88,6 +88,10 @@ module DynamicMigrations
|
|
88
88
|
options = {}
|
89
89
|
options[:null] = column.null
|
90
90
|
|
91
|
+
if column.array?
|
92
|
+
options[:array] = true
|
93
|
+
end
|
94
|
+
|
91
95
|
unless column.default.nil?
|
92
96
|
options[:default] = "\"#{column.default}\""
|
93
97
|
end
|
@@ -103,7 +107,20 @@ module DynamicMigrations
|
|
103
107
|
|
104
108
|
options_syntax = options.map { |k, v| "#{k}: #{v}" }.join(", ")
|
105
109
|
|
106
|
-
|
110
|
+
data_type = column.data_type.to_s
|
111
|
+
# if it's an array, then we need to remove the [] from the end
|
112
|
+
if column.array?
|
113
|
+
data_type = data_type.sub(/\[\]\z/, "")
|
114
|
+
end
|
115
|
+
# if its a custom type (has special characters) then we need to quote it
|
116
|
+
# otherwise, present it as a symbol
|
117
|
+
data_type = if data_type.match?(/\A\w+\z/)
|
118
|
+
":#{data_type}"
|
119
|
+
else
|
120
|
+
"\"#{data_type}\""
|
121
|
+
end
|
122
|
+
|
123
|
+
lines << "t.column #{data_type}, :#{column.name}, #{options_syntax}"
|
107
124
|
end
|
108
125
|
|
109
126
|
if timestamps.any?
|