参考情報
http://api.rubyonrails.org/classes/ActiveRecord/ConnectionAdapters/SchemaStatements.html#method-i-add_column
...
The type parameter is normally one of the migrations native types, which is one of the following: :primary_key, :string, :text, :integer, :bigint, :float, :decimal, :numeric, :datetime, :time, :date, :binary, :boolean.
...
Available options are (none of these exists by default):
:limit - Requests a maximum column length. This is the number of characters for a :string column and number of bytes for :text, :binary and :integer columns.
:default - The column's default value. Use nil for NULL.
:null - Allows or disallows NULL values in the column. This option could have been named :null_allowed.
:precision - Specifies the precision for the :decimal and :numeric columns.
:scale - Specifies the scale for the :decimal and :numeric columns.
...
http://edgeguides.rubyonrails.org/active_record_migrations.html#column-modifiers
- Advanced Rails model generators
https://railsguides.net/advanced-rails-model-generators/
...
The whole list of available types:
integer
primary_key
decimal
float
boolean
binary
string
text
date
time
datetime
timestamp
...
Set limit for field of integer, string, text and binary fields:
$ rails generate model user pseudo:string{30}
Special syntax to generate decimal field with scale and precision:
$ rails generate model product 'price:decimal{10,2}'
...
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。