Home Programming What Are The Rails 4 ActiveRecord Migration DataTypes?

What Are The Rails 4 ActiveRecord Migration DataTypes?

1

This comes up a lot, so I’m providing this handy list of Rails 4 ActiveRecord Migration DataTypes here for reference.
These can be used across all database types.

If you happen to be using a PostgreSQL database, then you have access to these as well:

  • :hstore - storing key/value pairs within a single value. (Learn more about this new data type)
  • :array - an arrangement of numbers or strings in a particular row. (Learn more about it and see examples)
  • :cidr_address - used for IPv4 or IPv6 host addresses.
  • :ip_address - used for IPv4 or IPv6 host addresses, same as cidr_address but it also accepts values with nonzero bits to the right of the netmask.
  • :mac_address - used for MAC host addresses.

Please note, that they will be stored as strings if you use those with a non-PostgreSQL database.

 

1 COMMENT

  1. Must see The Universe episode Sex in Space. (history channel)http://www.youtube.co/watch?v=_yS001aTq64
    The 2suit would make an excellent emergency thermal solution also. Between this and what the Kepler project will find, the future maybe radically, um, missionary.
    tracked to this story. Science journalist Woodmansee and novelist-inventor Vanna Bonta seemed to have taken the lid off taboo.
    Outserspace sex carries complications http://www.msnbc.msn.com/id/14002908/

Comments are closed.