schemata

Allows you to use and create sets of commonly used schemata. For example:

create_table :accounts do |t|
    t.string "street_address_1"
    t.string "street_address_2"
    t.string "city"
    t.string "state"
    t.string "zip_code"
    t.string "country"
end

becomes

create_table :accounts do |t|
    t.addressable
end

Available schemata

Creating your own collection

Creating your own collections is easy:

#schema/timeable.rb
module Schemata
  module Schema
    def timeable
      apply_schema :start_time, :datetime
      apply_schema :end_time , :datetime
    end
  end
end

Then require the file in environment.rb or your rails engine.

require 'schema/timeable'

You can define as many methods within a file as you want and they’ll be available. A quick an easy way to port your definitions would be to create a gem like schemata-timeables.

Contributing to schemata

Copyright © 2011 Spencer Markowski. See LICENSE.txt for further details.