Last active
August 29, 2015 14:16
-
-
Save gamanox/6d5d206425834b03b747 to your computer and use it in GitHub Desktop.
migration for cheers database
This file contains hidden or 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 scaffold beer name description:text image:attachment family_id:integer style_id:integer alcohol:integer country_id:integer state brewery_id rating:integer --skip-stylesheets | |
rails g scaffold brewery name description:text image:attachment --skip-stylesheets | |
rails g scaffold store name description:text image:attachment phone:integer address:text location_id:integer twitter facebook foursquare instagram --skip-stylesheets | |
rails g scaffold family name description:text image:attachment --skip-stylesheets | |
rails g scaffold style name description:text image:attachment --skip-stylesheets | |
rails g scaffold tag name description:text --skip-stylesheets | |
rails g scaffold location name code:integer --skip-stylesheets | |
rails g scaffold storetype name description:text --skip-stylesheets | |
rails g scaffold price beer_id:integer store_id:integer price:decimal{4,2} --skip-stylesheets | |
rails g migration CreateStoresStoreTypesJoinTable | |
class CreateStoresStoreTypesJoinTable < ActiveRecord::Migration | |
def self.up | |
create_table :stores_store_types, :id => false do |t| | |
t.integer :store_id | |
t.integer :store_type_id | |
end | |
add_index :stores_store_types, [:store_id, :store_type_id] | |
end | |
def self.down | |
drop_table :stores_store_types | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment