caboose-cms 0.2.100 → 0.2.102
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/app/models/caboose/utilities/schema.rb +22 -20
- data/lib/caboose/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
ZDFmMzUzNzI2YWU0NzA0MWEyNDc1ZDZkNGM0YWNmOGExMGY1NzdkMg==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
ZDgzYzVkY2VmY2I3MGQ5Y2NlOGQxZDQ4YzRmNGUzOWQzYjY3N2FlYQ==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
Mzc3MWQ3ODhhZTdiZGIxZmI3OGY0ZjllZjdhMzZiMTNjOTJjZjZjZTM0YTVk
|
10
|
+
MzM3N2M2NGM3NGMyZjAxMGQ5ZjAyYWU0MjVkOWM2NzgyMjBjOWQzNTE2ZWM5
|
11
|
+
NDlhZWUwNDBkZGE2Mzk3YmUwNmY3MGU1ZWQyYTA1YjUwNGFhNjA=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
MzU0NmNlODUxM2QwNGEzOTU2NDYwNzdhNGY2ZmYzOTc1ZWZhOWFmYTJjOWEw
|
14
|
+
NjE4MDg2MTIyMDE4ZjIxZGVhNzhkOGIzMDBjZGZkYWZjYWEwZGU0ZDQyNDhj
|
15
|
+
ZDUwNmE1MGU3NDZmZTA3ZDgwZjZhZGE4NDNmMzI1NzQwN2E0ZDc=
|
@@ -59,31 +59,33 @@ class Caboose::Utilities::Schema
|
|
59
59
|
# Column exists, but not with the correct data type, try to change it
|
60
60
|
else
|
61
61
|
|
62
|
+
c.execute("alter table #{tbl} alter column #{col[0]} type #{col[1]} using cast(#{col[0]} as #{col[1]})")
|
63
|
+
|
62
64
|
# Add a temp column
|
63
|
-
c.remove_column tbl, "#{col[0]}_temp" if c.column_exists?(tbl, "#{col[0]}_temp")
|
64
|
-
if col.count > 2
|
65
|
-
|
66
|
-
else
|
67
|
-
|
68
|
-
end
|
65
|
+
#c.remove_column tbl, "#{col[0]}_temp" if c.column_exists?(tbl, "#{col[0]}_temp")
|
66
|
+
#if col.count > 2
|
67
|
+
# c.add_column tbl, "#{col[0]}_temp", col[1], col[2]
|
68
|
+
#else
|
69
|
+
# c.add_column tbl, "#{col[0]}_temp", col[1]
|
70
|
+
#end
|
69
71
|
|
70
72
|
# Copy the old column and cast with correct data type to the new column
|
71
|
-
model.all.each do |m|
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
end
|
73
|
+
#model.all.each do |m|
|
74
|
+
# m["#{col[0]}_temp"] = case col[1]
|
75
|
+
# when :integer then m[col[0]].to_i
|
76
|
+
# when :string then m[col[0]].to_s
|
77
|
+
# when :text then m[col[0]].to_s
|
78
|
+
# when :numeric then m[col[0]].to_f
|
79
|
+
# when :datetime then DateTime.parse(m[col[0]])
|
80
|
+
# when :boolean then m[col[0]].to_i == 1
|
81
|
+
# else nil
|
82
|
+
# end
|
83
|
+
# m.save
|
84
|
+
#end
|
83
85
|
|
84
86
|
# Remove the old column and rename the new one
|
85
|
-
c.remove_column tbl, col[0]
|
86
|
-
c.rename_column tbl, "#{col[0]}_temp", col[0]
|
87
|
+
#c.remove_column tbl, col[0]
|
88
|
+
#c.rename_column tbl, "#{col[0]}_temp", col[0]
|
87
89
|
|
88
90
|
end
|
89
91
|
end
|
data/lib/caboose/version.rb
CHANGED