Using JRuby with AR Migrations standalone

Hi All,

I have a couple questions regarding JRuby and ActiveRecord migrations,
I’d like to introduce Ruby to a Java-based project for managing
database migrations initially, so here they are:

1- Is it possible to package everything needed for JRuby/ActiveRecord
migrations so that I can run it through a web-based interface as part
of the app or a batch script or something? In otherwords, without have
to physically install JRuby, AR, gems, etc?

2- Can AR migrations handle tables with the non default ID column (eg
table customers has cust_id)?

Thanks in advance for any advice!

-Abdullah


To unsubscribe from this list please visit:

http://xircles.codehaus.org/manage_email

On 9/30/07, Abdullah J. [email protected] wrote:

2- Can AR migrations handle tables with the non default ID column (eg
table customers has cust_id)?

JRuby is, basically, a big JAR, bunch of .rb files and a few shell
scripts to run it this, that and the other way. And in a Java shop
everybody has JDK installed. So, I’d put it all into the project
source control repository, so that anyone can run it against their own
development database. That is assuming that you are using reasonably
fast version control system (e.g., Subversion fits the bill, CVS
doesn’t), and you run a development database on your own computers.

If a centralized approach is warranted by circumstances, I don’t know
of any web interface for Rails migrations, but it is trivial to make
one.


Alexey V.
CruiseControl.rb [http://cruisecontrolrb.thoughtworks.com]
RubyWorks [http://rubyworks.thoughtworks.com]


To unsubscribe from this list please visit:

http://xircles.codehaus.org/manage_email

2- Can AR migrations handle tables with the non default ID column (eg
table customers has cust_id)?

Only did the searching for you to learn myself :wink:

From the create_table docs :


Rename the primary key column

create_table(:objects, :primary_key => ‘guid’) do |t|
t.column :name, :string, :limit => 80
end

generates:

CREATE TABLE objects (
guid int(11) DEFAULT NULL auto_increment PRIMARY KEY,
name varchar(80)
)

Do not add a primary key column

create_table(:categories_suppliers, :id => false) do |t|
t.column :category_id, :integer
t.column :supplier_id, :integer
end

generates:

CREATE TABLE categories_suppliers_join (
category_id int,
supplier_id int
)

http://api.rubyonrails.org/classes/ActiveRecord/ConnectionAdapters/SchemaStatements.html#M000703

Matt


To unsubscribe from this list please visit:

http://xircles.codehaus.org/manage_email

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs