Rails 2.0 (RC2) with HSQLDB does not save tables to disk when running "rake
db:migrate"
---------------------------------------------------------------------------------------
Key: JRUBY-1662
URL: http://jira.codehaus.org/browse/JRUBY-1662
Project: JRuby
Issue Type: Bug
Components: ActiveRecord-JDBC
Affects Versions: JRuby 1.1b1
Environment: JRuby 1.1b1, Rails 2.0 RC2, Mac OS X 10.5, Java 1.5.0_13
Reporter: Caleb Land
The problem: Using the {{activerecord-jdbchsqldb-adapter}} create a scaffold
with {{script/generate scaffold}} and when you run the generated migration
everything appears to work, but the table is not created on disk. Using the
derby database everything works as expected.
Here is the procedure to reproduce it:
Extract JRuby (I tried both 1.0.2 and 1.1b1) and add it to your path
{{$ gem install rails --source http://gems.rubyonrails.org -y}}
{{$ gem install jruby-openssl}}
{{$ gem install activerecord-jdbchsqldb-adapter -y}}
{{$ rails bwah}}
Edit config/database.yml (change the adapter and username):
{quote}
development:
adapter: *jdbchsqldb*
encoding: utf8
database: bwah_development
username: *sa*
password:
host: localhost
# Warning: The database defined as 'test' will be erased and
# re-generated from your development database when you run 'rake'.
# Do not set this db to the same as development or production.
test:
adapter: *jdbchsqldb*
encoding: utf8
database: bwah_test
username: *sa*
password:
host: localhost
production:
adapter: *jdbchsqldb*
encoding: utf8
database: bwah_production
username: *sa*
password:
host: localhost
{quote}
{{$ jruby script/generate scaffold customer name:string}}
{{$ cat db/migrate/001_create_customers.rb}}
{quote}
class CreateCustomers < ActiveRecord::Migration
def self.up
create_table :customers do |t|
t.string :name
t.timestamps
end
end
def self.down
drop_table :customers
end
end
{quote}
Then I run:
{{$ rake db:migrate}}
{quote}== 1 CreateCustomers: migrating
===============================================
-- create_table(:customers)
-> 0.0020s
-> 0 rows
== 1 CreateCustomers: migrated (0.0020s) ======================================
{quote}
But when I navigate to: http://localhost:3000/customers I get an error that
says:
{quote}{{ArgumentError: Table not found in statement [SELECT * FROM customers]:
SELECT * FROM customers}}{quote}
If you change the jdbchsqldb adapter to jdbcderby the above procedure works
correctly.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe from this list please visit:
http://xircles.codehaus.org/manage_email