sqlite to mysql

Hi, there. I have an application running with sqlite in development mode and production mode. I just installed mysql on windows and created a new database in mysql for the application in development mode. After putting some data in database, I found that I can't save Time object like 'Tue Feb 01 12:34:56 UTC 2000" completely. Mysql showed the time only "12:34:26". But sqlite is able to save it and convert it to something like "2010-02-01 12:34:56". I had to convert the Time object before I saved it to database. The other problem I encountered is storing long string in mysql. I put some long strings(about thousand characters) in one of the columns in a table using sqlite without any problems. When I did it with mysql, it truncated the string by itself with less than 300 characters left. It did that on every long string in the table. I did not change any ruby code except the yml file. Did I miss something? Thanks in advance.

Your MySQL field definitions obviously don't match the data you're trying to store there.

Did you create it by hand or using rake and migrations/schema load?

Hassan Schroeder wrote:

Hi, there. I have an application running with sqlite in development mode and production mode. �I just installed mysql on windows and created a new database in mysql for the application in development mode.

Did I miss something?

Your MySQL field definitions obviously don't match the data you're trying to store there.

Did you create it by hand or using rake and migrations/schema load?

-- Hassan Schroeder ------------------------ hassan.schroeder@gmail.com twitter: @hassan

Hi, Hassan. I ran:   rake db:create   rake db:migrate also tried:   rake db:create   rake db:schema:load both have the same problem mentioned in the previous post.

Somewhat surprising, but still -- if it's wrong, it's wrong. What does `show create table` say about the fields that are failing for specific inputs?

Hassan Schroeder wrote:

So if you want to store more than 255 characters, as you indicated earlier, you need to change that field :slight_smile:

Not too surprising, eh?

Hassan Schroeder wrote:

Ichiro Saga wrote:

Hassan Schroeder wrote:

under Type, it's "varchar(255)"

So if you want to store more than 255 characters, as you indicated earlier, you need to change that field :slight_smile:

Not too surprising, eh?

-- Hassan Schroeder ------------------------ hassan.schroeder@gmail.com twitter: @hassan

Oh. How can I change that field? When I checked the same field in sqlite3, it is also "varchar(255)". Could you please explain it a little more?

It works! Thanks Hassan. But still not sure why sqlite3 has "varchar(255)" as well. Maybe that's not the real length of the field.

Apparently that's just a serving suggestion in SQLite3 -- it doesn't even issue a warning; MySQL does :slight_smile: