nafkot
nafkot

Reputation: 113

Rails 3 - heroku PGError: ERROR: type modifier is not allowed for type "text"

I am a newbie on Rails and doing ok so far. I wanted to find out what schema file is uploaded when you do heroku rake db:setup. Because even though I have deleted a table it keeps trying to create it on heroku and gives error.

I even tried recreating the table but it keeps remembering the old setting and errors out.

PGError: ERROR: type modifier is not allowed for type "text" LINE 1:
"trainings" ("id" serial primary key, "content" text(255),...

It's trying to create table trainings with content column text but I no longer have that setting and I think the setting is saved somewhere.

I even tried deleting my app and restarting it but no luck.

Any clues?

Thanks.

Upvotes: 6

Views: 5064

Answers (2)

I got the same error below:

ERROR: type modifier is not allowed for type "text"

When I tried to set name column with TEXT(20) as shown below:

CREATE TABLE p1 (
  id INT,
  name TEXT(20) -- Here
);

So, I removed (20) as shown below, then the error was solved:

CREATE TABLE p1 (
  id INT,
  name TEXT -- Here
);

Or, I used VARCHAR(20) as shown below, then the error was solved:

CREATE TABLE p1 (
  id INT,
  name VARCHAR(20) -- Here
);

Upvotes: 0

hellvinz
hellvinz

Reputation: 3500

the default database on heroku is postgresql. And the text type in postgresql does not accept a size: it is unlimited.

See http://www.postgresql.org/docs/9.1/static/datatype-character.html

Upvotes: 9

Related Questions