migrant 1.3.1 → 1.3.2

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.3.1
1
+ 1.3.2
@@ -0,0 +1,15 @@
1
+ ### 1.3.1 / 2012-02-12
2
+
3
+ [full changelog](http://github.com/pascalh1011/migrant/compare/v1.3.0...v1.3.1)
4
+
5
+ * Features
6
+ * Migrant now offers to generate migrations that would lose data in conversion (eg. text -> int), after warning the user.
7
+ * Now on [Travis CI](http://travis-ci.org/#!/pascalh1011/migrant)!
8
+
9
+ * Bug fixes
10
+ * Disable schema cache for Rails >= 3.2.0.rc2. Mostly fixes issues with the tests, but peace of mind for Rails 3.2 nonetheless.
11
+ * Fix filename tests not running on some systems
12
+
13
+ * Contributors
14
+ * pascalh1011
15
+ * L2G
@@ -29,7 +29,7 @@ module Migrant
29
29
  # Rails 3.2+ caches table (non) existence so this needs to be cleared before we start
30
30
  ActiveRecord::Base.connection.schema_cache.clear! if ActiveRecord::Base.connection.respond_to?(:schema_cache)
31
31
 
32
- ActiveRecord::Base.descendants.select { |model| model.schema && model.schema.requires_migration? }.each do |model|
32
+ ActiveRecord::Base.descendants.select { |model| model.structure_defined? && model.schema.requires_migration? }.each do |model|
33
33
  model.reset_column_information # db:migrate doesn't do this
34
34
  @table_name = model.table_name
35
35
  @columns = Hash[[:changed, :added, :deleted, :renamed, :transferred].collect { |a| [a,[]] }]
@@ -21,6 +21,8 @@ module Migrant
21
21
  # So, my_field in the structure block actually calls Migrant::Schema.my_field
22
22
 
23
23
  create_migrant_schema
24
+ @structure_defined = true
25
+
24
26
  if self.superclass == ActiveRecord::Base
25
27
  @schema.define_structure(type, &block)
26
28
  @schema.validations.each do |field, validation_options|
@@ -41,6 +43,10 @@ module Migrant
41
43
  end
42
44
  end
43
45
 
46
+ def structure_defined?
47
+ @schema && @structure_defined || false
48
+ end
49
+
44
50
  # Same as defining a structure block, but with no attributes besides
45
51
  # relationships (such as in a many-to-many)
46
52
  def no_structure
@@ -0,0 +1,3 @@
1
+ class NonMigrantModel < ActiveRecord::Base
2
+ belongs_to :business
3
+ end
@@ -99,4 +99,8 @@ class TestDataSchema < Test::Unit::TestCase
99
99
  end
100
100
  end
101
101
 
102
+ should "still indicate a structure is not defined if a belongs_to association is added" do
103
+ assert_equal(false, NonMigrantModel.structure_defined?)
104
+ assert_equal(true, Business.structure_defined?)
105
+ end
102
106
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: migrant
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.1
4
+ version: 1.3.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-05-23 00:00:00.000000000 Z
12
+ date: 2011-05-23 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: thoughtbot-shoulda
16
- requirement: &74513810 !ruby/object:Gem::Requirement
16
+ requirement: &2152389600 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :development
23
23
  prerelease: false
24
- version_requirements: *74513810
24
+ version_requirements: *2152389600
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: minitest
27
- requirement: &74513520 !ruby/object:Gem::Requirement
27
+ requirement: &2152388420 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: 1.6.0
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *74513520
35
+ version_requirements: *2152388420
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: ansi
38
- requirement: &74513240 !ruby/object:Gem::Requirement
38
+ requirement: &2152387000 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '0'
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *74513240
46
+ version_requirements: *2152387000
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: turn
49
- requirement: &74512790 !ruby/object:Gem::Requirement
49
+ requirement: &2152385460 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: '0'
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *74512790
57
+ version_requirements: *2152385460
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: sqlite3
60
- requirement: &74512220 !ruby/object:Gem::Requirement
60
+ requirement: &2152384020 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ! '>='
@@ -65,10 +65,10 @@ dependencies:
65
65
  version: '0'
66
66
  type: :development
67
67
  prerelease: false
68
- version_requirements: *74512220
68
+ version_requirements: *2152384020
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: simplecov
71
- requirement: &74511770 !ruby/object:Gem::Requirement
71
+ requirement: &2152381760 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - ! '>='
@@ -76,10 +76,10 @@ dependencies:
76
76
  version: '0'
77
77
  type: :development
78
78
  prerelease: false
79
- version_requirements: *74511770
79
+ version_requirements: *2152381760
80
80
  - !ruby/object:Gem::Dependency
81
81
  name: terminal-table
82
- requirement: &74511520 !ruby/object:Gem::Requirement
82
+ requirement: &2152379720 !ruby/object:Gem::Requirement
83
83
  none: false
84
84
  requirements:
85
85
  - - ! '>='
@@ -87,10 +87,10 @@ dependencies:
87
87
  version: '0'
88
88
  type: :development
89
89
  prerelease: false
90
- version_requirements: *74511520
90
+ version_requirements: *2152379720
91
91
  - !ruby/object:Gem::Dependency
92
92
  name: term-ansicolor
93
- requirement: &74511130 !ruby/object:Gem::Requirement
93
+ requirement: &2152378020 !ruby/object:Gem::Requirement
94
94
  none: false
95
95
  requirements:
96
96
  - - ! '>='
@@ -98,10 +98,10 @@ dependencies:
98
98
  version: '0'
99
99
  type: :development
100
100
  prerelease: false
101
- version_requirements: *74511130
101
+ version_requirements: *2152378020
102
102
  - !ruby/object:Gem::Dependency
103
103
  name: rake
104
- requirement: &74510740 !ruby/object:Gem::Requirement
104
+ requirement: &2152376680 !ruby/object:Gem::Requirement
105
105
  none: false
106
106
  requirements:
107
107
  - - ! '>='
@@ -109,10 +109,10 @@ dependencies:
109
109
  version: 0.8.7
110
110
  type: :development
111
111
  prerelease: false
112
- version_requirements: *74510740
112
+ version_requirements: *2152376680
113
113
  - !ruby/object:Gem::Dependency
114
114
  name: simplecov
115
- requirement: &74510150 !ruby/object:Gem::Requirement
115
+ requirement: &2152375460 !ruby/object:Gem::Requirement
116
116
  none: false
117
117
  requirements:
118
118
  - - ! '>='
@@ -120,10 +120,10 @@ dependencies:
120
120
  version: '0'
121
121
  type: :development
122
122
  prerelease: false
123
- version_requirements: *74510150
123
+ version_requirements: *2152375460
124
124
  - !ruby/object:Gem::Dependency
125
125
  name: rails
126
- requirement: &74509790 !ruby/object:Gem::Requirement
126
+ requirement: &2152374300 !ruby/object:Gem::Requirement
127
127
  none: false
128
128
  requirements:
129
129
  - - ! '>='
@@ -131,10 +131,10 @@ dependencies:
131
131
  version: 3.0.0
132
132
  type: :runtime
133
133
  prerelease: false
134
- version_requirements: *74509790
134
+ version_requirements: *2152374300
135
135
  - !ruby/object:Gem::Dependency
136
136
  name: faker
137
- requirement: &74509550 !ruby/object:Gem::Requirement
137
+ requirement: &2152373160 !ruby/object:Gem::Requirement
138
138
  none: false
139
139
  requirements:
140
140
  - - ! '>='
@@ -142,10 +142,10 @@ dependencies:
142
142
  version: '0'
143
143
  type: :runtime
144
144
  prerelease: false
145
- version_requirements: *74509550
145
+ version_requirements: *2152373160
146
146
  - !ruby/object:Gem::Dependency
147
147
  name: term-ansicolor
148
- requirement: &74509240 !ruby/object:Gem::Requirement
148
+ requirement: &2152371600 !ruby/object:Gem::Requirement
149
149
  none: false
150
150
  requirements:
151
151
  - - ! '>='
@@ -153,7 +153,7 @@ dependencies:
153
153
  version: '0'
154
154
  type: :runtime
155
155
  prerelease: false
156
- version_requirements: *74509240
156
+ version_requirements: *2152371600
157
157
  description: Easier schema management for Rails that complements your domain model.
158
158
  email: 101pascal@gmail.com
159
159
  executables: []
@@ -170,6 +170,7 @@ files:
170
170
  - README.rdoc
171
171
  - Rakefile
172
172
  - VERSION
173
+ - changelog.md
173
174
  - lib/dsl/data_type.rb
174
175
  - lib/dsl/data_types/primitives.rb
175
176
  - lib/dsl/data_types/semantic.rb
@@ -200,6 +201,7 @@ files:
200
201
  - test/rails_app/app/models/category.rb
201
202
  - test/rails_app/app/models/chameleon.rb
202
203
  - test/rails_app/app/models/customer.rb
204
+ - test/rails_app/app/models/non_migrant_model.rb
203
205
  - test/rails_app/app/models/user.rb
204
206
  - test/rails_app/app/views/layouts/application.html.erb
205
207
  - test/rails_app/config.ru
@@ -265,7 +267,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
265
267
  version: '0'
266
268
  requirements: []
267
269
  rubyforge_project:
268
- rubygems_version: 1.8.16
270
+ rubygems_version: 1.8.10
269
271
  signing_key:
270
272
  specification_version: 3
271
273
  summary: All the fun of ActiveRecord without writing your migrations, and with a dash