Adding columns in Rails

Add column

Add new column (basic) $ rails g migration (process to be performed + table name) (column and data type you want to add, etc.)

$rails g migration AddColumnToUsers  name:string age:integer


Add index to new column

$rails g migration AddColumnToUsers name:string:index


Delete column

string


Create columns at the same time as creating tables

$rails g migration CreateUsers name:string age:integer


Recommended Posts

Adding columns in Rails
Group_by in Rails
Model association in Rails
Disable turbolinks in Rails
CSRF measures in Rails
^, $ in Rails regular expression
Use images in Rails
Understand migration in rails
Split routes.rb in Rails6
Implement markdown in Rails
I can't overwrite information on columns in rails console ...
Get UserAgent in [Rails] controller
Implement application function in Rails
Declarative transaction in Rails #ginzarb
Implement follow function in Rails
Japaneseize using i18n with Rails
Implement LTI authentication in Rails
Error in rails db: migrate
Gem often used in Rails
Display Flash messages in Rails
View monthly calendar in Rails
Implement import process in Rails
Use multiple checkboxes in Rails6!
Rewrite Routes in Rails Engine
[Rails] Keyword search in multiple tables
Add a search function in Rails.
Enable jQuery and Bootstrap in Rails 6 (Rails 6)
[rails] Login screen implementation in devise
[Rails] How to write in Japanese
[Rails] Unexpected validation error in devise
About the symbol <%%> in Rails erb
[Rails] Easy way to check columns
[Ruby on Rails] Add / Remove Columns
[Rails] Use cookies in API mode
Implement simple login function in Rails
Create a new app in Rails
Ruby on Rails Japanese-English support i18n
[Solution] Webpacker :: Manifest :: MissingEntryError in Rails
Implement a contact form in Rails
Remove "assets" and "turbolinks" in "Rails6".
CRUD features and MVC in Rails
How to introduce jQuery in Rails 6
First pagination feature added in rails
Data is not registered in Rails.
[Rails 6] Customize Bootstrap in Rails + Bootstrap 5.0.0-alpha environment
Implement CSV download function in Rails
Ruby methods often used in Rails
How to install Swiper in Rails
[Rails] How to log in with a name by adding a devise name column
How to implement search functionality in Rails
Definitions other than 7 basic actions in Rails
[Rails] Function restrictions in devise (login / logout)
How to change app name in rails
How to use custom helpers in rails
How to insert a video in Rails
The identity of params [: id] in rails
[rails] List of actions defined in Controller
Rails refactoring story learned in the field
Ruby on Rails in Visual Studio Codespaces
JavaScript (vanilla) does not respond in Rails.
How to use MySQL in Rails tutorial