| Column type | Description |
|---|---|
:primary_key | Primary key |
:string | Shorter string datatype. Allows limit option for maximum number of characters. |
:text | Longer amount of text. Allows limit option for maximum number of bytes. |
:integer | Integer. Allows limit option for maximum number of bytes. |
:bigint | Larger integer |
:float | Float |
:decimal | Decimal number with variable precision. Allows precision and scale options. |
:numeric | Allows precision and scale options. |
:datetime | DateTime object for dates/times. |
:time | Time object for times. |
:date | Date object for dates. |
:binary | Binary data. Allows limit option for maximum number of bytes. |
:boolean | Boolean |
Most migration files live in db/migrate/ directory. They’re identified by a UTC timestamp at the beginning of their file name: YYYYMMDDHHMMSS_create_products.rb.
The rails generate command can be shortened to rails g.
If a :type is not passed to a field, it defaults to a string.