Linked Questions

-1 votes
1 answer
542 views

add_index :tests, [:title, :level], unique: true how can i change title to body and save in schema.rb I tired to manually change it but it doesn't save in schema.rb
Southpaw's user avatar
441 votes
7 answers
160k views

I'm terrible at naming and realize that there are a better set of names for my models in my Rails app. Is there any way to use a migration to rename a model and its corresponding table?
readonly's user avatar
  • 358k
17 votes
3 answers
4k views

I want to auto generate a migration file that looks like this: class RenameDatabaseColumn < ActiveRecord::Migration def change rename_column :events, :subcategory, :subcategory_id end end ...
Dan Baker's user avatar
  • 1,837
0 votes
2 answers
4k views

I tried googling and stackoverflowing this but couldn't find an answer, so I thought I would post one. Currently I inherited a legacy system (PHP/MySQL) where the table and column names are defined ...
Kevin Liang's user avatar
0 votes
2 answers
635 views

(rails 2.2.2) I have 2 models, user and subscription. Each user can have one ore more subscriptions (= premium services). Below the attributes: user: id, username, ... subscription: id, user_id (FK), ...
hebe's user avatar
  • 387
0 votes
2 answers
1k views

I created a migration: class AddFormCounterToUsers < ActiveRecord::Migration[5.2] def change add_column :users, :form_count, :integer, default: 0 end end I ran rails db:migrate but soon ...
user3574603's user avatar
  • 3,678
3 votes
2 answers
1k views

On Rails 3.2.1. I have a model called Car with an attribute called rate (indicates a price quantity). I'm using the ajaxful_rating gem which associates a method called rate (to submit a rating of how ...
user avatar
0 votes
1 answer
1k views

I'm trying to rename a column that is definitely there in the schema and all the info is there, but when I go to update it it's giving me a "missing column" error and I can't figure out why? Any ideas?...
Steve Q's user avatar
  • 395
1 vote
1 answer
898 views

I am trying to change "localhost:3000/users/1" to "localhost:3000/members/1". I changed resources :users in the routes to resources :members and changed users_controller.rb to members_controller.rb ...
Bill K 's user avatar
1 vote
1 answer
462 views

I'm not sure why it happened, but one of the columns starts with a capital letter. I'm a little worried to change it by doing migrations because the affected column is 'comment_id' column, and Comment ...
Maximus S's user avatar
  • 11.2k
1 vote
2 answers
752 views

I created 'Country' table with following columns in rails: Country id country_code name prefix url Then, updated column names in phppgadmin and now table ...
Vinay Kashyap T S's user avatar
1 vote
1 answer
339 views

Below is the migration file I have defined to rename the column in schooling_document_types_managing_areas table but the issue is when I run the migration I am getting an error Index name is too long; ...
user12763413's user avatar
  • 1,349
1 vote
1 answer
460 views

created a new rails db migration for renaming a set of columns including one with blob format. when running the migration the following error occurs and the migration is canceled: SQLite3::...
user1727870's user avatar
0 votes
2 answers
360 views

Hello I am about to attempt to run a rails migration on a database of skills that has a :title and :description. I need to remove the description field and I assume it will look something like this: ...
ZachyBear's user avatar
  • 307
5 votes
1 answer
192 views

My current schema looks like: create_table "users", :force => true do |t| t.string "username" t.string "firstname" t.string "lastname" ...
Blankman's user avatar
  • 269k

15 30 50 per page