public
Description: The automatic way to migrate
Homepage: http://errtheblog.com/posts/65-automatically
Clone URL: git://github.com/pjhyett/auto_migrations.git
Search Repo:
auto_migrations / README
100644 52 lines (32 sloc) 0.842 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
== AutoMigrations
 
Forget migrations, auto-migrate!
 
 
== Usage
 
Write out your schema (or use an existing one)
 
  $ cat db/schema.rb
 
  ActiveRecord::Schema.define do
 
    create_table :posts do |t|
      t.string :title
      t.text :body
      t.timestamps
    end
  
  end
 
  $ rake db:auto:migrate
 
  Created posts table
 
...a few days later
 
  $ cat db/schema.rb
 
  ActiveRecord::Schema.define do
 
    create_table :posts do |t|
      t.string :title
      t.text :content
      t.timestamps
    end
  
  end
 
  $ rake db:auto:migrate
  -- add_column("posts", :content, :text)
     -> 0.0307s
  -- remove_column("posts", "body")
     -> 0.0311s
 
Found a bug? Sweet. Add it at the Lighthouse:
  http://err.lighthouseapp.com/projects/466-plugins/tickets/new
 
Feature requests are welcome.
 
* PJ Hyett [ pjhyett@gmail.com ]