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

  • Home
  • SEARCH
  • 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 6354779
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T22:38:03+00:00 2026-05-24T22:38:03+00:00

First ruby script/generate model Buyer id:integer name:string after generating Buyer model, I did rake

  • 0

First

ruby script/generate model Buyer id:integer name:string 

after generating Buyer model, I did

rake db:migrate

it was working fine.

After 1 day I have executed below command

ruby script/generate model Seller id:integer seller_name:string

after generating Seller model, I did

rake db:migrate

I got an error, that Buyer table is already exists. why? we have different timestamp file.

class CreateBuyer < ActiveRecord::Migration
  def self.up
    create_table :buyer do |t|
      t.string :name
      t.text :description
      t.decimal :price
      t.integer :seller_id
      t.string :email
      t.string :img_url

      t.timestamps
    end
  end

  def self.down
    drop_table :ads
  end
end

and another one is

class CreateSellers < ActiveRecord::Migration
  def self.up
    create_table :sellers do |t|
      t.integer :nos
      t.decimal :tsv
      t.decimal :avg_price

      t.timestamps
    end
  end

  def self.down
    drop_table :sellers
  end
end

I used Rails 2.3.11 and rake 0.8.7

  • 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-24T22:38:05+00:00Added an answer on May 24, 2026 at 10:38 pm

    Are you sure there were no errors generated when you ran the first migration? If an error is encountered while running a migration, the parts that were already run will still be in the database, but schema_migrations won’t be updated with the migration timestamp. Therefore, the next time you try to run migrations, it’ll try to re-run the first part of the failed migration, which will generate errors since it’s already been run.

    Updated: If you look in the error output you added (by the way, please add to the question rather than a comment, so it’s formatted and the whole thing is included) you can see that the first Execute db:migrate is running the migration CreateBuyer. This confirms that your migration did not complete the first time you ran it or has since been unsuccessfully rolled back. To fix this, manually drop the buyer table, then rerun your migrations.

    As a note, there’s at least a couple issues in your CreateBuyers migration:

    1. The table name should be buyers (plural) rather than buyer (singular)
    2. The down part of the migration is dropping the table ads instead of buyers

    The second problem there could explain why you’re having trouble running migrations now, actually. If you rolled back the CreateBuyers migration, it would have dropped your ads table and left buyers in place.

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

Sidebar

Related Questions

Through rspec (I'm using rspec-1.3.0, rspec-rails-1.3.2 gems) generator ( ruby script/generate rspec_model suggestion section_id:integer
I'm working on my first Ruby on Rails aplication and it's quite big (at
I've created a model for an existing table using the following generator command: script/generate
Can someone tell me what I have done wrong? I ran script/generate model CityZipMSA
in upgrading rails app from 2.2.2 to 2.3.9 first error was: D:\web>ruby script/server -trace
I've made a ruby script that generate a Plist from data in other format
I'm trying to access my first ruby project. After navigating to the proper directory
First, I logged into the ruby script/console -e production and tried to index each
I'm about to build my first Ruby on Rails application (and first anything beyond
In Ruby on Rails I'm doing something like: Appointment.find( :first, :conditions => staff_id =

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.