migrant 0.1.0 → 0.1.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 CHANGED
@@ -19,9 +19,6 @@ Start by creating some models with the structure you need:
19
19
  belongs_to :user
20
20
 
21
21
  # Here's where you describe the columns in your model
22
- # You can provide a symbol (like a migration) or better still, give an example
23
- # of the data that will go in there
24
-
25
22
  structure do
26
23
  name "The kernel's favourite fried chickens"
27
24
  website "http://www.google.co.za/"
@@ -29,8 +26,10 @@ Start by creating some models with the structure you need:
29
26
  date_established Time.now - 300.years
30
27
  end
31
28
  end
32
-
33
- And another for good measure:
29
+
30
+ The best and easiest way is to provide example data and then Migrant will work out the appropriate
31
+ column type for you. You can also specify a symbol (like normal migrations), or just omit arguments
32
+ to get a good 'ol varchar(255). One more example model:
34
33
 
35
34
  class User < ActiveRecord::Base
36
35
  has_many :businesses
@@ -90,6 +89,17 @@ These actions won't be performed (because we don't want to hurt your data):
90
89
  irb(main):003:0> my_business.user
91
90
  => #<User id: nil, name: "John", surname: "Smith", description: "Some string">
92
91
 
92
+ == Maintability / Usability concerns
93
+ * You don't have to define a structure on every model, Migrant ignores models with no definitions
94
+ * You can remove the structure definitions later and nothing bad will happen (besides losing automigration for those fields)
95
+ * If you have a model with relations but no columns, you can still have migrations generated by adding "no_structure" or define a blank structure block.
96
+ * It's probably a good idea to review the generated migrations before committing to SCM, just to check there's nothing left out.
97
+
98
+ == Roadmap / Planned features
99
+ * To be implemented very soon - A :was => [:this,:then,:that] option to rename columns and add an alias method onto models (so as to not break existing code)
100
+ * Rake task to consolidate a given set of migrations (a lot of people like to do this once in a while to keep migration levels sane)
101
+ * Fabricator/Factory integration/seperation
102
+
93
103
  == License
94
104
 
95
105
  Copyright (c) 2010 Pascal Houliston
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.0
1
+ 0.1.1
@@ -0,0 +1,7 @@
1
+ require 'rails/generators'
2
+
3
+ class Migrations < Rails::Generators::Base
4
+ def migrate
5
+ Migrant::MigrationGenerator.new.run
6
+ end
7
+ end
data/lib/railtie.rb CHANGED
@@ -7,5 +7,9 @@ module Migrant
7
7
  rake_tasks do
8
8
  load "tasks/db.rake"
9
9
  end
10
+
11
+ generators do
12
+ load "generators/migrations.rb"
13
+ end
10
14
  end
11
15
  end
data/lib/tasks/db.rake CHANGED
@@ -1,9 +1,4 @@
1
1
  namespace :db do
2
- desc "Generates migrations as per structure design in your models but does not run them"
3
- task :update => :environment do
4
- Migrant::MigrationGenerator.new.run
5
- end
6
-
7
2
  desc "Generates migrations as per structure design in your models and runs them"
8
3
  task :upgrade => :environment do
9
4
  Rake::Task['db:migrate'].invoke if Migrant::MigrationGenerator.new.run
data/migrant.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{migrant}
8
- s.version = "0.1.0"
8
+ s.version = "0.1.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"]
@@ -34,6 +34,7 @@ Gem::Specification.new do |s|
34
34
  "lib/datatype/string.rb",
35
35
  "lib/datatype/symbol.rb",
36
36
  "lib/datatype/time.rb",
37
+ "lib/generators/migrations.rb",
37
38
  "lib/migrant.rb",
38
39
  "lib/migrant/migration_generator.rb",
39
40
  "lib/migrant/model_extensions.rb",
data/test/helper.rb CHANGED
@@ -4,6 +4,7 @@ require 'fileutils'
4
4
  SimpleCov.adapters.define 'migrant' do
5
5
  add_filter '/test'
6
6
  add_filter '/lib/tasks'
7
+ add_filter '/lib/railtie' # Not covering lines it's running here .. disabling for now
7
8
 
8
9
  add_group 'Core Extensions', '/lib/migrant'
9
10
  add_group 'Schema Data Types', '/lib/datatype'
@@ -10,7 +10,7 @@
10
10
  #
11
11
  # It's strongly recommended to check this file into your version control system.
12
12
 
13
- ActiveRecord::Schema.define(:version => 20101028205511) do
13
+ ActiveRecord::Schema.define(:version => 20101028213553) do
14
14
 
15
15
  create_table "business_categories", :force => true do |t|
16
16
  t.integer "business_id"
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 1
8
- - 0
9
- version: 0.1.0
8
+ - 1
9
+ version: 0.1.1
10
10
  platform: ruby
11
11
  authors:
12
12
  - Pascal Houliston
@@ -145,6 +145,7 @@ files:
145
145
  - lib/datatype/string.rb
146
146
  - lib/datatype/symbol.rb
147
147
  - lib/datatype/time.rb
148
+ - lib/generators/migrations.rb
148
149
  - lib/migrant.rb
149
150
  - lib/migrant/migration_generator.rb
150
151
  - lib/migrant/model_extensions.rb