migrant 0.2.0 → 0.2.1
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.
- data/README.rdoc +5 -5
- data/Rakefile +1 -1
- data/VERSION +1 -1
- data/lib/migrant/schema.rb +2 -2
- data/migrant.gemspec +5 -5
- metadata +5 -7
data/README.rdoc
CHANGED
@@ -28,16 +28,16 @@ Start by creating some models with the structure you need:
|
|
28
28
|
end
|
29
29
|
|
30
30
|
The best and easiest way is to provide example data and then Migrant will work out the appropriate
|
31
|
-
column type for you.
|
32
|
-
to get a good 'ol varchar(255). One more example model:
|
31
|
+
column type for you. Another example covering some more bases:
|
33
32
|
|
34
33
|
class User < ActiveRecord::Base
|
35
34
|
has_many :businesses
|
36
35
|
|
37
36
|
structure do
|
38
|
-
name
|
39
|
-
surname "Smith"
|
40
|
-
description :string
|
37
|
+
name # Don't specify any structure to get good 'ol varchar(255)
|
38
|
+
surname "Smith", :validates => :presence # You can add your validations in here too to keep DRY
|
39
|
+
description :string # Passing a symbol works like it does in add_column
|
40
|
+
timestamps # Gets you a created_at, and updated_at
|
41
41
|
end
|
42
42
|
end
|
43
43
|
|
data/Rakefile
CHANGED
@@ -18,7 +18,7 @@ Jeweler::Tasks.new do |gem|
|
|
18
18
|
gem.homepage = "http://github.com/pascalh1011/migrant"
|
19
19
|
gem.authors = ["Pascal Houliston"]
|
20
20
|
gem.add_development_dependency "bundler"
|
21
|
-
gem.add_runtime_dependency "rails"
|
21
|
+
gem.add_runtime_dependency "rails"
|
22
22
|
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
23
23
|
end
|
24
24
|
Jeweler::RubygemsDotOrgTasks.new
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.2.
|
1
|
+
0.2.1
|
data/lib/migrant/schema.rb
CHANGED
@@ -26,7 +26,7 @@ module Migrant
|
|
26
26
|
|
27
27
|
def add_associations(associations)
|
28
28
|
associations.each do |association|
|
29
|
-
field = association.
|
29
|
+
field = association.association_foreign_key.to_sym
|
30
30
|
case association.macro
|
31
31
|
when :belongs_to
|
32
32
|
if association.options[:polymorphic]
|
@@ -34,7 +34,7 @@ module Migrant
|
|
34
34
|
@indexes << [(association.name.to_s+'_type').to_sym, field]
|
35
35
|
end
|
36
36
|
@columns[field] = DataType::ForeignKey.new(:field => field)
|
37
|
-
@indexes <<
|
37
|
+
@indexes << field
|
38
38
|
end
|
39
39
|
end
|
40
40
|
end
|
data/migrant.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{migrant}
|
8
|
-
s.version = "0.2.
|
8
|
+
s.version = "0.2.1"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Pascal Houliston"]
|
12
|
-
s.date = %q{
|
12
|
+
s.date = %q{2011-01-24}
|
13
13
|
s.description = %q{Migrant gives you a super-clean DSL to describe your ActiveRecord models (somewhat similar to DataMapper) and generates all your migrations for you so you can spend more time coding the stuff that counts!}
|
14
14
|
s.email = %q{101pascal@gmail.com}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -149,7 +149,7 @@ Gem::Specification.new do |s|
|
|
149
149
|
s.add_runtime_dependency(%q<simplecov>, ["= 0.3.5"])
|
150
150
|
s.add_runtime_dependency(%q<rails>, ["= 3.0.0"])
|
151
151
|
s.add_development_dependency(%q<bundler>, [">= 0"])
|
152
|
-
s.add_runtime_dependency(%q<rails>, [">=
|
152
|
+
s.add_runtime_dependency(%q<rails>, [">= 0"])
|
153
153
|
else
|
154
154
|
s.add_dependency(%q<jeweler>, [">= 0"])
|
155
155
|
s.add_dependency(%q<thoughtbot-shoulda>, [">= 0"])
|
@@ -159,7 +159,7 @@ Gem::Specification.new do |s|
|
|
159
159
|
s.add_dependency(%q<simplecov>, ["= 0.3.5"])
|
160
160
|
s.add_dependency(%q<rails>, ["= 3.0.0"])
|
161
161
|
s.add_dependency(%q<bundler>, [">= 0"])
|
162
|
-
s.add_dependency(%q<rails>, [">=
|
162
|
+
s.add_dependency(%q<rails>, [">= 0"])
|
163
163
|
end
|
164
164
|
else
|
165
165
|
s.add_dependency(%q<jeweler>, [">= 0"])
|
@@ -170,7 +170,7 @@ Gem::Specification.new do |s|
|
|
170
170
|
s.add_dependency(%q<simplecov>, ["= 0.3.5"])
|
171
171
|
s.add_dependency(%q<rails>, ["= 3.0.0"])
|
172
172
|
s.add_dependency(%q<bundler>, [">= 0"])
|
173
|
-
s.add_dependency(%q<rails>, [">=
|
173
|
+
s.add_dependency(%q<rails>, [">= 0"])
|
174
174
|
end
|
175
175
|
end
|
176
176
|
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 2
|
8
|
-
-
|
9
|
-
version: 0.2.
|
8
|
+
- 1
|
9
|
+
version: 0.2.1
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Pascal Houliston
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date:
|
17
|
+
date: 2011-01-24 00:00:00 +02:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
@@ -133,10 +133,8 @@ dependencies:
|
|
133
133
|
- - ">="
|
134
134
|
- !ruby/object:Gem::Version
|
135
135
|
segments:
|
136
|
-
- 3
|
137
|
-
- 0
|
138
136
|
- 0
|
139
|
-
version:
|
137
|
+
version: "0"
|
140
138
|
type: :runtime
|
141
139
|
prerelease: false
|
142
140
|
version_requirements: *id009
|
@@ -239,7 +237,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
239
237
|
requirements:
|
240
238
|
- - ">="
|
241
239
|
- !ruby/object:Gem::Version
|
242
|
-
hash:
|
240
|
+
hash: 162847055
|
243
241
|
segments:
|
244
242
|
- 0
|
245
243
|
version: "0"
|