Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6739773
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T11:31:40+00:00 2026-05-26T11:31:40+00:00

When I run $heroku db:push, I get the following error: Saving session to push_201110231302.dat..

  • 0

When I run $heroku db:push, I get the following error:

Saving session to push_201110231302.dat..
!!! Caught Server Exception
HTTP CODE: 500
Taps Server Error: PGError: ERROR:  value too long for type character varying(255)

The discussion here suggests that this is because one of my models has a string attribute that’s longer than 255 chars.

I think I identified the problem in the “descrip” attribute of my “Course” model.

I tried fixing this by changing descrip’s type from string to text. I did this by generating and running a “remove_descrip_from_Course descrip:string” type migration, then generating/running an “add_descrip_to_Course descrip:text.” But that didn’t work — descrip still shows up as a string.

Does anyone know if (1) changing descrip from a string to text is the best (only?) way of solving the heroku problem, and (2) what I can do to change descrip from string to text?

Thanks!

EDITED:

Here’s the relevant portion of my schema.rb file (descrip is at bottom):

  create_table "courses", :force => true do |t|
    t.string   "name"
    t.string   "number"
    t.string   "instructor"
    t.string   "room"
    t.string   "day"
    t.string   "units"
    t.string   "time"
    t.datetime "created_at"
    t.datetime "updated_at"
    t.string   "limitations"
    t.string   "address"
    t.string   "end_time"
    t.string   "start_time"
    t.string   "crn"
    t.string   "term_code"
    t.text     "evals"
    t.boolean  "paper_required"
    t.string   "exam_type"
    t.string   "paper_type"
    t.string   "past_instructors"
    t.string   "past_semesters"
    t.string   "tod"
    t.boolean  "in_cart",          :default => false
    t.integer  "day_num"
    t.integer  "time_num"
    t.string   "units_alt"
    t.text     "descrip"
  end

And here’s the add_descrip_to_course migration:

class AddDescripToCourse < ActiveRecord::Migration
  def self.up
    add_column :courses, :descrip, :text
  end

  def self.down
    remove_column :courses, :descrip
  end
end

But this is what happens in my rails console:

ruby-1.9.2-p290 :008 > a = Course.new
 => #<Course id: nil, name: nil, number: nil, instructor: nil, room: nil, day: nil, units: nil, time: nil, created_at: nil, updated_at: nil, limitations: nil, address: nil, end_time: nil, start_time: nil, crn: nil, term_code: nil, evals: nil, paper_required: nil, exam_type: nil, paper_type: nil, past_instructors: nil, past_semesters: nil, tod: nil, in_cart: false, day_num: nil, time_num: nil, units_alt: nil, descrip: nil> 
ruby-1.9.2-p290 :009 > a.descrip = "test"
 => "test" 
ruby-1.9.2-p290 :010 > a.descrip.class
 => String 
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T11:31:41+00:00Added an answer on May 26, 2026 at 11:31 am

    Your first step is to develop and deploy on the same stack; developing on top of MySQL or SQLite and then deploying on top of PostgreSQL is just asking for trouble, PostgreSQL is (thankfully) a lot stricter than SQLite and MySQL. So install PostgreSQL locally if you’re going to be deploying to Heroku.

    To change the column type, you should be able to use this in a migration:

    def self.up # or "def change" or "def up" depending on your Rails version
        change_column :courses, :descrip, :text
    end
    

    That should give you a column of type TEXT in PostgreSQL and TEXT is a “variable unlimited length” character type.

    Using :text for this is the best way to get an arbitrarily large text column.

    If you don’t really want an unlimited length then you should include length validations in your model. MySQL will silently truncate your data and SQLite ignores length on string columns, PostgreSQL does neither of these things.

    In the Rails/ActiveRecord world, all stringish types are instances of String so char(n), varchar(n), and text all come out as String and go in as String.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Everybody, I get an error when I run this command: git push heroku master.
I am following the directions here http://blog.heroku.com/archives/2011/8/29/play/ but I do play run and then
I have troubles to push my rails app on heroku. In my local server,
I run commands heroku create --stack cedar git push heroku master but it gave
When I try to run: heroku run rake db:drop db:create db:migrate I get the
I'm trying to get an app to run on Heroku properly. (Heroku uses the
I get a 503 Error when trying to push my database to Amazon RDS
so when I run heroku rake db:migrate, after pushing my latest code Heroku doesn't
I run the following command to push the contents of my local database to
In my Jenkins build, the last step is to push to heroku and run

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.