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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T00:56:48+00:00 2026-05-16T00:56:48+00:00

I generated a scaffold and put in the type:value but now I need to

  • 0

I generated a scaffold and put in the type:value but now I need to add another field / db column how do I add another type:value without destroying and restarting my whole project?

rake aborted!
Mysql::Error: You have an error in your SQL syntax; check the manual that corres
ponds to your MySQL server version for the right syntax to use near '(11), `titl
e` varchar(255) DEFAULT NULL, `artist_old` varchar(255) DEFAULT NULL,' at line 1
: CREATE TABLE `albums` (`id` int(11) DEFAULT NULL auto_increment PRIMARY KEY(11
), `title` varchar(255) DEFAULT NULL, `artist_old` varchar(255) DEFAULT NULL, `r
elease_date` datetime DEFAULT NULL, `genre` varchar(255) DEFAULT NULL, `feature`
 int(11) DEFAULT NULL, `image_path` varchar(255) DEFAULT NULL, `created_at` date
time DEFAULT NULL, `updated_at` datetime DEFAULT NULL, `artist_id` int(11) DEFAU
LT NULL) ENGINE=InnoDB
  • 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-16T00:56:49+00:00Added an answer on May 16, 2026 at 12:56 am

    usually when you use the scaffold command it will create a migration in your db/migrate/ folder, containing all the database setup for your model, for example:

    class CreateComments < ActiveRecord::Migration
      def self.up
        create_table :comments do |t|
          t.text :body
        end
      end
    
      def self.down
        drop_table :comments
      end
    end
    

    If you have not successfully run the rake db:migrate command after you created the scaffold, you can just easily edit the migration file under db/migrate/ and add the field you missed in the beginning. After you edited the file, run the rake db:migrate command to apply the migration to your database.

    If you already stepped through rake db:migrate after creating your scaffold, you can create a new migration with script/generate migration AddSubjectColumnToComments to add another field to your table. In my example above, I would get a new migration and fill in the following code:

    class AddSubjectColumnToComments < ActiveRecord::Migration
      def self.up
        add_column :subject, :comments, :string
      end
    
      def self.down
        remove_column :subject, :comments
      end
    

    Good luck migrating!

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

Sidebar

Related Questions

No related questions found

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.