Camping 2.1: Making migrations less sucky

Magnus Holm judofyr at gmail.com
Mon Apr 12 11:00:26 EDT 2010


http://github.com/camping/camping/issues#issue/12

This is probably the most exciting issue: Making migrations less sucky.

The fact that you'll have to do this to get started sucks:

module Nuts::Models
  class Page < Base
  end

  class BasicFields < V 1.0
    def self.up
      create_table Page.table_name do |t|
        t.string :title
        t.text   :content
        # This gives us created_at and updated_at
        t.timestamps
      end
    end

    def self.down
      drop_table Page.table_name
    end
  end
end

It should really just be something like this:

module Nuts::Models
  class Page < Base
    t.string :title
    t.text  :content
    t.timestamps
  end
end

But we still want to support regular migrations (in some way at
least). See the issue for more examples/comments.

// Magnus Holm


More information about the Camping-list mailing list