Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class CreateCustomers < ActiveRecord::Migration
- def self.up
- create_table :customers do |t|
- t.string :firstname
- t.string :lastname
- t.string :address1
- t.string :address2
- t.string :city
- t.integer :state
- t.integer :zipcode
- t.string :phone_number
- t.string :email
- t.string :alternative_phonenumber
- t.timestamps
- end
- end
- def self.down
- drop_table :customers
- end
- end
- class CreatePriorities < ActiveRecord::Migration
- def self.up
- create_table :priorities do |t|
- t.column "name", :string, :limit => 60
- t.column "digit", :string, :limit => 10
- end
- Priority.create([
- { :name => 'high', :digit => 1},
- { :name => 'low', :digit => 2},
- { :name => 'medium', :digit => 3 },
- { :name => 'emergency', :digit => 4 }
- ])
- end
- def self.down
- drop_table :priorities
- end
- end
- class CreatePriorities < ActiveRecord::Migration
- def self.up
- create_table :priorities do |t|
- t.column "name", :string, :limit => 60
- t.column "digit", :string, :limit => 10
- end
- Priority.create([
- { :name => 'high', :digit => 1},
- { :name => 'low', :digit => 2},
- { :name => 'medium', :digit => 3 },
- { :name => 'emergency', :digit => 4 }
- ])
- end
- def self.down
- drop_table :priorities
- end
- end
- class CreateShippings < ActiveRecord::Migration
- def self.up
- create_table :shippings do |t|
- t.column "name", :string, :limit => 40
- end
- ['Ground', 'Air', '3-day UPS', '3-Day Fedex', 'Next-Day UPS', ].each do |shipping|
- Shipping.create( :name => shipping )
- end
- end
- def self.down
- drop_table :shippings
- end
- end
- class CreateStatuses < ActiveRecord::Migration
- def self.up
- create_table :statuses do |t|
- t.column "name", :string, :limit => 15
- end
- ['Pending', 'Open', 'Contacted', 'Closed', 'Recieved', 'Ordered', 'Shipped', 'Approved' ].each do |status|
- Status.create( :name => status )
- end
- end
- def self.down
- drop_table :statuses
- end
- end
Add Comment
Please, Sign In to add comment