Hello,
Using jruby 1.5.1, rails 2.3.8, activerecord-jdbc-adapter-0.9.7-java,
jdbc-mysq-5.0.4 on Mac OS X Leopard, I’ve issued the following
commands to create a basic rails application with an association:
jruby -S rails first_app -d mysql
cd first_app
jruby script/generate jdbc
jruby -S rake db:create:all
jruby -S script/generate model Post name:string title:string
content:text
jruby -S rake db:migrate
jruby -S script/generate model Comment commenter:string body:text
post:references
jruby -S rake db:migrate
Now, when I check in mysql client the resulting tables, I’ve got this:
mysql> show create table posts\G
*************************** 1. row ***************************
Table: posts
Create Table: CREATE TABLE posts
(
id
int(11) NOT NULL AUTO_INCREMENT,
name
varchar(255) DEFAULT NULL,
title
varchar(255) DEFAULT NULL,
content
text,
created_at
datetime DEFAULT NULL,
updated_at
datetime DEFAULT NULL,
PRIMARY KEY (id
)
) ENGINE=InnoDB DEFAULT CHARSET=utf8
1 row in set (0.00 sec)
mysql> show create table comments\G
*************************** 1. row ***************************
Table: comments
Create Table: CREATE TABLE comments
(
id
int(11) NOT NULL AUTO_INCREMENT,
commenter
varchar(255) DEFAULT NULL,
body
text,
post_id
int(10) DEFAULT NULL,
created_at
datetime DEFAULT NULL,
updated_at
datetime DEFAULT NULL,
PRIMARY KEY (id
)
) ENGINE=InnoDB DEFAULT CHARSET=utf8
1 row in set (0.00 sec)
Notice the id in table posts is int(11) while the post_id in table
comments is int(10).
Am I missing something here to get the post_id being int(11)?
Thanks in advance for any advice.
Kind regards,
Michèle Garoche
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email