Skip to content

Instantly share code, notes, and snippets.

@bibliotechy
Last active November 9, 2017 03:07
Show Gist options
  • Save bibliotechy/9def061b82b6f34daded219a1a30087e to your computer and use it in GitHub Desktop.
Save bibliotechy/9def061b82b6f34daded219a1a30087e to your computer and use it in GitHub Desktop.
#Y ou could write this
bin/rails generate migration CreateComponentsTable name:string local_id:string description_en:text description_jp:text
# and do so for all the fields outlined in the issue
# then do the same for Artist
bin/rails generate migration CreateArtistsTable name_en:string name_jp:string local_id:string viaf_id:string
# There a few fields that are references to another field. Like The user who created a component of a work.
# To add a reference to another Model, like Artist in Component
bin/rails generate migration AddArtistRefToComponents artist:references
class CreateComponentsTable < ActiveRecord::Migration[5.0]
def change
create_table :components do |t|
t.string :name
t.string :local_id
t.text :description_en
t.text :description_jp
# ...
t.timestamps
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment