since this morning I ran into a problem with a “type” field and it did
not work at all since it is a deprecated method on every ruby object
and will always return the classname instead of the database entry.
renaming that helped.
your error seams different that what I saw but the underlying reason
might be the same.
since this morning I ran into a problem with a “type” field and it did
not work at all since it is a deprecated method on every ruby object
and will always return the classname instead of the database entry.
renaming that helped.
Renaming the table field?
I’ve do that renaming notes in comments but it doesn’t helped, the
error is still:
rake aborted!
ActiveRecord::JDBCError: ERROR: type modifier is not allowed for type
“text”
Posizione: 421: CREATE TABLE “computers” (“id” serial primary key,
“name” varchar(255), “state” varchar(255), “company” varchar(255),
“serial_number” varchar(255), “type” varchar(255), “model”
varchar(255), “operating_system” varchar(255), “cpu” varchar(255),
“cpu_mhz” bigint, “ram” bigint, “position” varchar(255), “contact”
varchar(255), “contact_tel” varchar(255), “ath_code” varchar(255),
“last_modified” timestamp(29), “comments” text(2147483647),
“created_at” timestamp(29), “updated_at” timestamp(29))
OK, I was on the wrong path. I talked about the
t.string :type
entry. but it looks like your database driver does not allow the
length modifier on the text type:
text(2147483647)
so if you can execute the following query
CREATE TABLE “computers” (“id” serial primary key,
“name” varchar(255), “state” varchar(255), “company” varchar(255),
“serial_number” varchar(255), “type” varchar(255), “model”
varchar(255), “operating_system” varchar(255), “cpu” varchar(255),
“cpu_mhz” bigint, “ram” bigint, “position” varchar(255), “contact”
varchar(255), “contact_tel” varchar(255), “ath_code” varchar(255),
“last_modified” timestamp(29), “comments” text,
“created_at” timestamp(29), “updated_at” timestamp(29))
without length in text than you found a bug. which database are you
using ?
is the actual task which fails the cucumber tasks or db:migrate from
rails ?
what needs to be fixed is the dump task for PostgreSQL databases and
warning that the maximum precision of 6 will be used for the timestamps.
I have just gotten into Rails, and JRuby especially, so I don’t know if
I
can fix this problem at the appropriate level, but I will attempt to
take a look at it when I get a chance.
I must only delete the :limit specification for text types?
I must only delete the :limit specification for text types?
That’s all I did for now. The issue with the timestamps just gives a
warning but should probably be fixed whenever the underlying issue with
text types is fixed. Note however, that you will need to edit the
schema.rb file each time you run db:migrate because it gets regenerated.
db:migrate is ok, in all my rails applications I have no problems with
fields of type text.
It is the cucumber task that fails.
I ran into a similar problem when running “rake spec”. I am using JRuby,
Rails 3, and activerecord-jdbcpostgresql-adapter 1.0.2. The problem
seems to be that when running db:migrate the db:schema:dump task is
creating a db/schema.rb file that specifies a :limit for “text” column
types and PostgreSQL does not allow specifying such a limit. I think
what needs to be fixed is the dump task for PostgreSQL databases and
possibly only when using the JDBC driver (I haven’t tested using
anything
other than JRuby so I don’t know if this problem exists when using MRI
and the native PostgreSQL driver).
I don’t have time to look into a fix for this right now and simply
modified my schema.rb file in order to get my tests to work. There may
be similar problems with timestamps as well. The schema.rb specifies a
limit of 29 for timestamps but when I run the SQL generated by the
db:schema:load task directly on the PostgreSQL console, Postgres gives a
warning that the maximum precision of 6 will be used for the timestamps.
I have just gotten into Rails, and JRuby especially, so I don’t know if
I
can fix this problem at the appropriate level, but I will attempt to
take a look at it when I get a chance.
I too have just encountered this problem, and it is not a problem with
Cucumber, because I am not using Cucumber. I am using JRuby and
PostgreSQL however.
I hit is when trying to do rake db:test:prepare, and removing the limit
from the text fields does indeed solve the problem. It seems to be an
issue with migrate, which generates the schema.rb file a fresh each time
with this erroneous limit. I am sure earlier versions of Rails did not
(pretty sure this was not a problem in 2.3.8), but 2.3.9 does (would not
care to say about the ones in between).
I would guess this is an issue in schema_dumper or
connection_adapters/postgresql_adapter.rb in active_record, but they
appear to be unchanged between 2.3.8 and 2.3.9.
A fix (not necessarily the best, and only slightly tested) is to modify
jruby-1.5.2\lib\ruby\gems\1.8\gems\activerecord-2.3.9\lib\active_record/schema_dumb.rb,
line 107