I' m using the following code to migrate a sqlite3 database on mysql
using Sequel v.2.10.0:
#!/usr/bin/ruby
require 'rubygems'
require 'sequel'
DB1 = Sequel.connect('sqlite://my.db') # source db
DB2 = Sequel.mysql('mysqldb', :user => 'cuser', :password =>
'cpasswd', :host => 'localhost')
unless DB2[:mytable].table_exists?
DB2.create_table :aggelies do
column :username, :text
column :hmer, :text
column :kath, :text
column :eiko, :text
column :titl, :text
column :peri, :text
end
end
ds1 = DB1[:mytable].all
ds2 = DB2[:mytable]
ds1.each do |hm|
ds2.insert(:username => hm[:username], :hmer => hm[:hmer], :kath =>
hm[:kath], :eiko => hm[:eiko], :titl => hm[:titl], :peri => hm[:peri])
end
##############################################################
I'm not expert with databases but i think there are no errors with my
code.
I get the following error:
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
/usr/lib/ruby/gems/1.8/gems/sequel-2.10.0/lib/sequel_core/adapters/
mysql.rb:138:in `query': Mysql::Error BLOB/TEXT column 'username' used
in key specification without a key length (Sequel::DatabaseError)
from /usr/lib/ruby/gems/1.8/gems/sequel-2.10.0/lib/sequel_core/
adapters/mysql.rb:138:in `_execute'
from /usr/lib/ruby/gems/1.8/gems/sequel-2.10.0/lib/sequel_core/
adapters/mysql.rb:97:in `execute'
from /usr/lib/ruby/gems/1.8/gems/sequel-2.10.0/lib/sequel_core/
connection_pool.rb:109:in `hold'
from /usr/lib/ruby/gems/1.8/gems/sequel-2.10.0/lib/sequel_core/
database.rb:437:in `synchronize'
from /usr/lib/ruby/gems/1.8/gems/sequel-2.10.0/lib/sequel_core/
adapters/mysql.rb:97:in `execute'
from /usr/lib/ruby/gems/1.8/gems/sequel-2.10.0/lib/sequel_core/
database.rb:287:in `execute_dui'
from /usr/lib/ruby/gems/1.8/gems/sequel-2.10.0/lib/sequel_core/
database.rb:281:in `execute_ddl'
from /usr/lib/ruby/gems/1.8/gems/sequel-2.10.0/lib/sequel_core/
database/schema.rb:60:in `create_table'
from /usr/lib/ruby/gems/1.8/gems/sequel-2.10.0/lib/sequel_core/
database/schema.rb:60:in `each'
from /usr/lib/ruby/gems/1.8/gems/sequel-2.10.0/lib/sequel_core/
database/schema.rb:60:in `create_table'
from migr2mysql.rb:22
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
Please could you help me with this? I'm not even sure that it's a
sequel issue, but your help is highly appreciated!
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"sequel-talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/sequel-talk?hl=en
-~----------~----~----~----~------~----~------~--~---