Skip to content

Instantly share code, notes, and snippets.

@aponcz
Created January 22, 2018 22:00
Show Gist options
  • Save aponcz/5041c536977d72c977aa5a5eb6e8fe5f to your computer and use it in GitHub Desktop.
Save aponcz/5041c536977d72c977aa5a5eb6e8fe5f to your computer and use it in GitHub Desktop.
class BaseModels < ActiveRecord::Migration[5.1]
def change
create_table :districts, id: :uuid do |t|
t.string :name
t.timestamps
end
create_table :schools, id: :uuid do |t|
t.references :district, foreign_key: true, type: :uuid
t.string :name
t.string :zip
t.string :phone_number
t.string :addressline1
t.string :addressline2
t.string :city
t.string :state
t.string :zip
t.string :website
t.string :description
t.timestamps
end
create_table :restaurants, id: :uuid do |t|
t.string :name
t.string :zip
t.string :phone_number
t.string :addressline1
t.string :addressline2
t.string :city
t.string :state
t.string :zip
t.timestamps
end
create_table :students, id: :uuid do |t|
t.string :name
t.string :grade
t.string :teacher
t.string :notes
t.references :school, foreign_key: true, type: :uuid
t.references :user, foreign_key: true, type: :uuid
t.timestamps
end
create_table :menus, id: :uuid do |t|
t.references :restaurant, foreign_key: true, type: :uuid
t.references :district, foreign_key: true, type: :uuid
t.date :start_on
t.date :end_on
t.string :name
t.timestamps
end
create_table :menue_items, id: :uuid do |t|
t.references :menu, foreign_key: true, type: :uuid
t.string :name
t.timestamps
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment