JDBC interpretes datetime in schemal.rb not correctly. MySql 5.1.37, JRUBY 
1.5.2, activerecord-jdbc-adapter 1.0.0.beta1
-----------------------------------------------------------------------------------------------------------------------

                 Key: JRUBY-5040
                 URL: http://jira.codehaus.org/browse/JRUBY-5040
             Project: JRuby
          Issue Type: Bug
    Affects Versions: JRuby 1.5.1
         Environment: Mac OS 10.6
            Reporter: Helmut Juskewycz
            Assignee: Thomas E Enebo
            Priority: Blocker


Using the JDBC driver for creating the database, running the migrations, and 
seeding the db works. However, when the JDBC driver uses the schema.rb for 
creating the database I get the following error:

** Invoke cucumber (first_time)
** Invoke cucumber:ok (first_time)
** Invoke db:test:prepare (first_time)
** Invoke db:abort_if_pending_migrations (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute db:abort_if_pending_migrations
** Execute db:test:prepare
** Invoke db:test:load (first_time)
** Invoke db:test:purge (first_time)
** Invoke environment 
** Execute db:test:purge
** Execute db:test:load
** Invoke db:schema:load (first_time)
** Invoke environment 
** Execute db:schema:load
rake aborted!
ActiveRecord::JDBCError: You have an error in your SQL syntax; check the manual 
that corresponds to your MySQL server version for the right syntax to use near 
'(19), `updated_at` datetime(19)) ENGINE=InnoDB CHARACTER SET `utf8`' at line 
1: CREATE TABLE `states` (`id` int(11) DEFAULT NULL auto_increment PRIMARY KEY, 
`name` varchar(255) NOT NULL, `created_at` datetime(19), `updated_at` 
datetime(19)) ENGINE=InnoDB CHARACTER SET `utf8`


Here is the migration and schema file

migration.rb
class CreateStates < ActiveRecord::Migration
  def self.up
    create_table :states do |t|
      t.string :name, :null => false, :unique => true
      t.string :symbol, :null => false, :unique => true

      t.timestamps
    end
    add_index :states, :symbol
  end

  def self.down
    drop_table :states
  end
end
------------
schema.rb
  create_table "states", :force => true do |t|
    t.string   "name",                     :null => false
    t.string   "symbol",                   :null => false
    t.datetime "created_at", :limit => 19
    t.datetime "updated_at", :limit => 19
  end

Everything works correctly when I use the sqlite3 driver. It looks like the 
JDBC driver tries to use the limit option for datetime when the schema.rb is 
used, but this isn't supported by MySQL.

-- 
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


Reply via email to