Datatypes (Mysql) in Rails Migrations


#1

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.


#2

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


#3

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?