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.
Jean N. (Guest)
on 2007-06-11 05: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.
Jeremy K. (Guest)
on 2007-06-11 06:45
(Received via mailing list)
On 6/10/07, Jean N. <removed_email_address@domain.invalid> 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
Jean N. (Guest)
on 2007-06-11 18:07
Jeremy K. 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.