smallint is not working to genrate model and table rails 3+ postgreSQL
mode, postgresql, ruby-on-rails
Solution
As I said,there is no `smallint` that supports Rails 3.You should be using `integer datatype` with `limit of 2 bytes` to make it as `smallint`.
For a list of available Rails 3 datatypes,see this SO Post.
This command will give you what you want
rails generate model FeedbackComment type:integer{2} reply:text
See this link for advanced Rails model generators.
Here is some more useful info
:limit Numeric Type Column Size Max value
1 tinyint 1 byte 127
2 smallint 2 bytes 32767
3 mediumint 3 bytes 8388607
nil, 4, 11 int(11) 4 bytes 2147483647
5..8 bigint 8 bytes 9223372036854775807
Problem
first I have run this command ``` rails generate model FeedbackComment type:smallint reply:text ``` after then ``` rake db:migrate ``` I am getting this error ``` StandardError: An error has occurred, this and all later migrations canceled: undefined method `smallint' for #<ActiveRecord::ConnectionAdapters::PostgreSQLAdapter::TableDefinition:0x9d1a318>/var/www/blog/db/migrate/20140712064127_create_feedback_comments.rb:4:in `block in change' ``` How can i create smallint through command in postgreSQL ? Please hellp me