Truls Unstad
Truls Unstad

Reputation:

Rails does not recognize sqlite3 REAL datatype

I have created the following table in sqlite3:

CREATE TABLE Test ( Id TEXT PRIMARY KEY NOT NULL, Count REAL );

But when I try to generate a model for this table, the schema.rb gives the following error:

Could not dump table "Test" because of following StandardError: Unknown type 'REAL' for column 'Count'

Is there another datatype I can use instead of real that will work with rails?

Upvotes: 0

Views: 683

Answers (2)

Sev
Sev

Reputation: 15709

Yes, use rake db:migrate

Also, for a count field, simply use an integer datatype instead of a float or REAL.

Upvotes: 0

Codebeef
Codebeef

Reputation: 43996

Have you tried using Rails' inbuilt migrations to build your table?

Upvotes: 0

Related Questions