Skip to content

Instantly share code, notes, and snippets.

@npassaro
Created May 1, 2020 14:42
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 npassaro/f00647895914f8f5876d7737c9dfa3a9 to your computer and use it in GitHub Desktop.
Save npassaro/f00647895914f8f5876d7737c9dfa3a9 to your computer and use it in GitHub Desktop.
Migrations
class CreateCompanionships < ActiveRecord::Migration[6.0]
def change
create_table :companionships do |t|
t.references :green, null: false, foreign_key: {to_table: :greens}
t.string :companion_type
t.references :companion, null: false, foreign_key: {to_table: :greens}
t.timestamps
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment