Last active
August 29, 2015 14:06
-
-
Save dvdasari/11be9082c10c51a8c42f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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