ar_checked_migration 3.2 → 4.0
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
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dbd79cfb32baff7768069624f6b80ef19e259e06
|
4
|
+
data.tar.gz: 8791d242261a664295f154bd4e7b68c3d5e3f0b9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 848fe38180b04093a55b3c51341ff1b6dd7fe322185aece9840ba86b79425a8c62d6eb4b8176cafe4b99ca2f6b9d8e2a1f522772d3913b0e5db326e0ee5dc1f6
|
7
|
+
data.tar.gz: 9731a65c52f8078116643c4e36b3a8c8fdc39458adf7d17276878b2fa69a6fc3a001d5ae2a2220de77c81246c8ed16d444a771e32dcc3e214b3f62070c2d3ceb
|
@@ -5,32 +5,37 @@ class <%= migration_class_name %> < ActiveRecord::CheckedMigration
|
|
5
5
|
<%- if migration_action == 'add' -%>
|
6
6
|
def change
|
7
7
|
<% attributes.each do |attribute| -%>
|
8
|
+
<%- if attribute.reference? -%>
|
9
|
+
add_reference :<%= table_name %>, :<%= attribute.name %><%= attribute.inject_options %>
|
10
|
+
<%- else -%>
|
8
11
|
add_column :<%= table_name %>, :<%= attribute.name %>, :<%= attribute.type %><%= attribute.inject_options %>
|
9
12
|
<%- if attribute.has_index? -%>
|
10
13
|
add_index :<%= table_name %>, :<%= attribute.index_name %><%= attribute.inject_index_options %>
|
11
14
|
<%- end -%>
|
15
|
+
<%- end -%>
|
12
16
|
<%- end -%>
|
13
17
|
end
|
18
|
+
<%- elsif migration_action == 'join' -%>
|
19
|
+
def change
|
20
|
+
create_join_table :<%= join_tables.first %>, :<%= join_tables.second %> do |t|
|
21
|
+
<%- attributes.each do |attribute| -%>
|
22
|
+
<%= '# ' unless attribute.has_index? -%>t.index <%= attribute.index_name %><%= attribute.inject_index_options %>
|
23
|
+
<%- end -%>
|
24
|
+
end
|
25
|
+
end
|
14
26
|
<%- else -%>
|
15
|
-
def
|
27
|
+
def change
|
16
28
|
<% attributes.each do |attribute| -%>
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
29
|
+
<%- if migration_action -%>
|
30
|
+
<%- if attribute.reference? -%>
|
31
|
+
remove_reference :<%= table_name %>, :<%= attribute.name %><%= attribute.inject_options %>
|
32
|
+
<%- else -%>
|
33
|
+
<%- if attribute.has_index? -%>
|
34
|
+
remove_index :<%= table_name %>, :<%= attribute.index_name %><%= attribute.inject_index_options %>
|
21
35
|
<%- end -%>
|
36
|
+
remove_column :<%= table_name %>, :<%= attribute.name %>, :<%= attribute.type %><%= attribute.inject_options %>
|
22
37
|
<%- end -%>
|
23
38
|
<%- end -%>
|
24
|
-
end
|
25
|
-
|
26
|
-
def down
|
27
|
-
<% attributes.reverse.each do |attribute| -%>
|
28
|
-
<%- if migration_action -%>
|
29
|
-
<%= migration_action == 'add' ? 'remove' : 'add' %>_column :<%= table_name %>, :<%= attribute.name %><% if migration_action == 'remove' %>, :<%= attribute.type %><%= attribute.inject_options %><% end %>
|
30
|
-
<%- if attribute.has_index? && migration_action == 'remove' -%>
|
31
|
-
add_index :<%= table_name %>, :<%= attribute.index_name %><%= attribute.inject_index_options %>
|
32
|
-
<%- end -%>
|
33
|
-
<%- end -%>
|
34
39
|
<%- end -%>
|
35
40
|
end
|
36
41
|
<%- end -%>
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ar_checked_migration
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '
|
4
|
+
version: '4.0'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brad Robertson
|
@@ -156,14 +156,14 @@ dependencies:
|
|
156
156
|
requirements:
|
157
157
|
- - '>='
|
158
158
|
- !ruby/object:Gem::Version
|
159
|
-
version: '
|
159
|
+
version: '4.0'
|
160
160
|
type: :runtime
|
161
161
|
prerelease: false
|
162
162
|
version_requirements: !ruby/object:Gem::Requirement
|
163
163
|
requirements:
|
164
164
|
- - '>='
|
165
165
|
- !ruby/object:Gem::Version
|
166
|
-
version: '
|
166
|
+
version: '4.0'
|
167
167
|
description: |-
|
168
168
|
Determine whether or not ActiveRecord migrations are
|
169
169
|
considered safe to know if an app
|