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.

On Tue, Feb 2, 2010 at 11:36 AM, Ichiro S. [email protected]
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 S. ------------------------ [email protected]
twitter: @hassan

Hassan S. wrote:

On Tue, Feb 2, 2010 at 11:36 AM, Ichiro S. [email protected]
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 S. ------------------------ [email protected]
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.

On Tue, Feb 2, 2010 at 2:08 PM, Ichiro S. [email protected]
wrote:

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

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 S. ------------------------ [email protected]
twitter: @hassan

Hassan S. wrote:

On Tue, Feb 2, 2010 at 2:08 PM, Ichiro S. [email protected]
wrote:

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

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 S. ------------------------ [email protected]
twitter: @hassan

under Type, it’s “varchar(255)”

Hassan S. wrote:

On Tue, Feb 2, 2010 at 2:43 PM, Ichiro S. [email protected]
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 S. ------------------------ [email protected]
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?

On Tue, Feb 2, 2010 at 2:43 PM, Ichiro S. [email protected]
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 S. ------------------------ [email protected]
twitter: @hassan

Ichiro S. wrote:

Hassan S. wrote:

On Tue, Feb 2, 2010 at 2:43 PM, Ichiro S. [email protected]
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 S. ------------------------ [email protected]
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.

On Tue, Feb 2, 2010 at 3:44 PM, Ichiro S. [email protected]
wrote:

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:


Hassan S. ------------------------ [email protected]
twitter: @hassan

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