Fandom

Ruby Wiki

Migrations

26pages on
this wiki
Add New Page
Talk0 Share

Migrations Edit

Migrations are database schemas that tell ruby how to create or undo database changes.

Example Migration Edit

 class CreateUsers < ActiveRecord::Migration
 def change
   create_table :users do |t|
     t.string :username
     t.string :password
     t.string :email
     t.timestamps
   end
 end
 end


this would create the following

Field Type
id int(11) AUTOINCREMENT
username varchar(255)
password varchar(255)
email varchar(255)
created_at datetime
updated_at datetime

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.