Rails 3 / Heroku - Error reselling databse to push to heroku - type modifier not allowed for type text

I am trying to use geku rake db: reset from a Rails 3 application using sqlite3, but I am getting the following error:

rake aborted! PGError: ERROR: type modifier is not allowed for type "text" LINE 1: ...ary key, "name" character varying(255), "content" text(255),... ^ 

here is my latest migration:

 change_table :mixes do |t| t.change :content, :text t.change :post, :text end 

and my schema.rb:

 create_table "mixes", :force => true do |t| t.string "name" t.text "content", :limit => 255 t.datetime "created_at" t.datetime "updated_at" t.string "mixologist" t.string "link" t.string "title" t.text "post", :limit => 255 end 

From my understanding, Sqlite3 does not apply restrictions on line and text, and I myself did not add these restrictions. I thought Heroku would automatically handle those who switch to Postgres or something else. But it seems that restrictions are casting it somewhere. What is the best way for me to handle this?

Let me know if I should write anything else.

Thank you very much.

+4
source share
1 answer

Change recent migration to

 change_table :mixes do |t| t.change :content, :text, :limit => nil t.change :post, :text, :limit => nil end 

This is one of the many nuances you will have to look for when developing using sqlite3 :( Only happens when you change the type of a column from row to text.

+4
source

Source: https://habr.com/ru/post/1369210/


All Articles