Skip to content

Instantly share code, notes, and snippets.

@gabidavila
Created August 26, 2017 18:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gabidavila/8d0bf1d91c48f5c763a440b6b2e79a58 to your computer and use it in GitHub Desktop.
Save gabidavila/8d0bf1d91c48f5c763a440b6b2e79a58 to your computer and use it in GitHub Desktop.
class CreateSongs < ActiveRecord::Migration
def change
create_table :songs do |t|
t.string :title
t.integer :artist_id, limit: 8
t.timestamps
end
add_index :songs, :title
add_foreign_key :songs, :artists
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment