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 7836329
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T14:05:48+00:00 2026-06-02T14:05:48+00:00

I have an app on Heroku and need to clean up the database there,

  • 0

I have an app on Heroku and need to clean up the database there, again run all (edited) migrations (in the migrations are added the default rows into the table) with the new default rows.

I ran

heroku run rake db:reset

this command cleared up the database, but didn’t add the new rows into the tables. I am trying to add the new lines this way:

class CreateUsers < ActiveRecord::Migration
  def change
    create_table :users do |t|
      ...columns definitions...

      t.timestamps
    end
  end

  def self.up
    Users.new(:name => 'my name', :password => 'super-secret-pass')
  end
end

But the new user is not added. What am I missing?

  • 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-06-02T14:05:50+00:00Added an answer on June 2, 2026 at 2:05 pm

    Migrations should have one of:

    1. A change method.
    2. up and down methods (preferably instance methods in 3+ but class methods are fine too).

    You have a change method and a self.up method. The migration system looks for change first:

    ActiveRecord::Base.connection_pool.with_connection do |conn|
      @connection = conn
      if respond_to?(:change)
        #...
      else
        time = Benchmark.measure { send(direction) }
      end
      @connection = nil
    end
    

    so your self.up will never get run.

    Two solutions immediately present themselves:

    1. Use separate up and down methods. You might want to review the guide’s Using Models in Your Migrations section.
    2. Use two separate migrations: one to create the table and a separate one to create your user.

    I’d probably go with 2.

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

Sidebar

Related Questions

I have an app hosted on Heroku and this app need to run some
I have a Rails app running Mongoid on Heroku and I need to set
I have a heroku app, that's like the default, but I want to deploy
I am creating a Node.js app on Heroku and have run into an issue.
I have a rails app I want to run on heroku to test. I
I have a ruby on rails app that uses Heroku. I have the need
I have an app running on heroku and once an hour I need to
I have a Heroku app with a PostgreSQL DB. Now I want to have
I currently have an app deployed on Heroku which runs on two web dynos
I have a Rails app deployed on Heroku with the Heroku scheduler add-on successfully

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.