Skip to content

Latest commit

 

History

History
39 lines (27 loc) · 580 Bytes

Rails_Migrations.md

File metadata and controls

39 lines (27 loc) · 580 Bytes

Rails: Migrations

Add

Add Column to existing model

rails g migration AddAddressToUser address:string
rake db:migrate

Delete

Force Delete and Children

drop_table :accounts, force: :cascade

Remove Column from existing model

rails g migration RemoveCountryFromSampleApps country:string
rails db:migrate

Associations

Remove Association in Database

def self.up
  remove_foreign_key :guideline_types, :guideline_groups
end

def self.down
  add_foreign_key :guideline_types, :guideline_groups
end