Skip to content

Instantly share code, notes, and snippets.

@dvdasari
Last active August 29, 2015 14:06
Show Gist options
  • Save dvdasari/11be9082c10c51a8c42f to your computer and use it in GitHub Desktop.
Save dvdasari/11be9082c10c51a8c42f to your computer and use it in GitHub Desktop.
# rails g model Book name:string:index isbn:string:uniq description:text user:references content:string{30}
class CreateBooks < ActiveRecord::Migration
def change
create_table :books do |t|
t.string :name
t.string :isbn
t.text :description
t.references :user, index: true
t.string :content, limit: 30
t.timestamps
end
add_index :books, :name
add_index :books, :isbn, unique: true
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment