Forum: Ruby on Rails Datatypes (Mysql) in Rails Migrations...

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
9f4e11fd04ca1e5a56d00ff3531104ed?d=identicon&s=25 Jean Nibee (jeannibee)
on 2007-06-11 03:52
Hi

I'm using integer for most of my numeric data, and this is fine, but the
system I am building will convert my data structures OLTP to OLAP for
reporting. This will require TONS of data to be saved. In an effort to
reduce wasted space I'd rather use tinyint/smallint and other such more
precise data types in mysql.

Couldn't find any documentation about these 'nonstandard' data types. In
addition I couldn't find anything on use column options like "unsigned".

Thanks.
24d2f8804e6bb4b7ea6bd11e0a586470?d=identicon&s=25 Jeremy Kemper (Guest)
on 2007-06-11 04:45
(Received via mailing list)
On 6/10/07, Jean Nibee <rails-mailing-list@andreas-s.net> wrote:
> I'm using integer for most of my numeric data, and this is fine, but the
> system I am building will convert my data structures OLTP to OLAP for
> reporting. This will require TONS of data to be saved. In an effort to
> reduce wasted space I'd rather use tinyint/smallint and other such more
> precise data types in mysql.
>
> Couldn't find any documentation about these 'nonstandard' data types. In
> addition I couldn't find anything on use column options like "unsigned".

Pass a string as the column type and it'll be interpreted as a literal
sql fragment:
  t.column :foo, 'tinyint(2) unsigned'

Be sure not to use tinyint(1) since it's used for booleans only.

jeremy
9f4e11fd04ca1e5a56d00ff3531104ed?d=identicon&s=25 Jean Nibee (jeannibee)
on 2007-06-11 16:07
Jeremy Kemper wrote:
>
> Pass a string as the column type and it'll be interpreted as a literal
> sql fragment:
>   t.column :foo, 'tinyint(2) unsigned'
>
> Be sure not to use tinyint(1) since it's used for booleans only.
>
> jeremy

Thanks! Where did you find out about this anyway?
This topic is locked and can not be replied to.