Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Refactor api and promo migration

  • Loading branch information...
commit 02622030b57f2d4b8744f266e9e8d1bffcacfbcc 1 parent c4b0369
@joneslee85 joneslee85 authored
View
2  api/db/migrate/20120411123334_resize_api_key_field.rb
@@ -1,6 +1,6 @@
class ResizeApiKeyField < ActiveRecord::Migration
def change
- unless defined?(User)
+ unless defined?(User)
change_column :spree_users, :api_key, :string, :limit => 48
end
end
View
24 core/db/migrate/20120831092320_spree_one_two.rb
@@ -32,7 +32,7 @@ def up
end
add_index :spree_addresses, [:firstname], :name => 'index_addresses_on_firstname'
- add_index :spree_addresses, [:lastname], :name => 'index_addresses_on_lastname'
+ add_index :spree_addresses, [:lastname], :name => 'index_addresses_on_lastname'
create_table :spree_adjustments do |t|
t.references :source, :polymorphic => true
@@ -61,7 +61,7 @@ def up
t.text :alt
end
- add_index :spree_assets, [:viewable_id], :name => 'index_assets_on_viewable_id'
+ add_index :spree_assets, [:viewable_id], :name => 'index_assets_on_viewable_id'
add_index :spree_assets, [:viewable_type, :type], :name => 'index_assets_on_viewable_type_and_type'
create_table :spree_calculators do |t|
@@ -123,9 +123,9 @@ def up
t.timestamps
end
- add_index :spree_inventory_units, [:order_id], :name => 'index_inventory_units_on_order_id'
+ add_index :spree_inventory_units, [:order_id], :name => 'index_inventory_units_on_order_id'
add_index :spree_inventory_units, [:shipment_id], :name => 'index_inventory_units_on_shipment_id'
- add_index :spree_inventory_units, [:variant_id], :name => 'index_inventory_units_on_variant_id'
+ add_index :spree_inventory_units, [:variant_id], :name => 'index_inventory_units_on_variant_id'
create_table :spree_line_items do |t|
t.references :variant
@@ -135,7 +135,7 @@ def up
t.timestamps
end
- add_index :spree_line_items, [:order_id], :name => 'index_spree_line_items_on_order_id'
+ add_index :spree_line_items, [:order_id], :name => 'index_spree_line_items_on_order_id'
add_index :spree_line_items, [:variant_id], :name => 'index_spree_line_items_on_variant_id'
create_table :spree_log_entries do |t|
@@ -176,7 +176,7 @@ def up
end
add_index :spree_option_values_variants, [:variant_id, :option_value_id], :name => 'index_option_values_variants_on_variant_id_and_option_value_id'
- add_index :spree_option_values_variants, [:variant_id], :name => 'index_spree_option_values_variants_on_variant_id'
+ add_index :spree_option_values_variants, [:variant_id], :name => 'index_spree_option_values_variants_on_variant_id'
create_table :spree_orders do |t|
t.string :number, :limit => 15
@@ -263,9 +263,9 @@ def up
end
add_index :spree_products, [:available_on], :name => 'index_spree_products_on_available_on'
- add_index :spree_products, [:deleted_at], :name => 'index_spree_products_on_deleted_at'
- add_index :spree_products, [:name], :name => 'index_spree_products_on_name'
- add_index :spree_products, [:permalink], :name => 'index_spree_products_on_permalink'
+ add_index :spree_products, [:deleted_at], :name => 'index_spree_products_on_deleted_at'
+ add_index :spree_products, [:name], :name => 'index_spree_products_on_name'
+ add_index :spree_products, [:permalink], :name => 'index_spree_products_on_permalink'
create_table :spree_products_taxons, :id => false do |t|
t.references :product
@@ -273,7 +273,7 @@ def up
end
add_index :spree_products_taxons, [:product_id], :name => 'index_spree_products_taxons_on_product_id'
- add_index :spree_products_taxons, [:taxon_id], :name => 'index_spree_products_taxons_on_taxon_id'
+ add_index :spree_products_taxons, [:taxon_id], :name => 'index_spree_products_taxons_on_taxon_id'
create_table :spree_properties do |t|
t.string :name
@@ -396,8 +396,8 @@ def up
t.timestamps
end
- add_index :spree_taxons, [:parent_id], :name => 'index_taxons_on_parent_id'
- add_index :spree_taxons, [:permalink], :name => 'index_taxons_on_permalink'
+ add_index :spree_taxons, [:parent_id], :name => 'index_taxons_on_parent_id'
+ add_index :spree_taxons, [:permalink], :name => 'index_taxons_on_permalink'
add_index :spree_taxons, [:taxonomy_id], :name => 'index_taxons_on_taxonomy_id'
create_table :spree_tokenized_permissions, :force => true do |t|
View
50 promo/db/migrate/20120831092359_spree_promo_one_two.rb
@@ -1,42 +1,42 @@
class SpreePromoOneTwo < ActiveRecord::Migration
def up
- create_table "spree_products_promotion_rules", :id => false, :force => true do |t|
- t.integer "product_id"
- t.integer "promotion_rule_id"
+ create_table :spree_products_promotion_rules, :id => false, :force => true do |t|
+ t.references :product
+ t.references :promotion_rule
end
- add_index "spree_products_promotion_rules", ["product_id"], :name => "index_products_promotion_rules_on_product_id"
- add_index "spree_products_promotion_rules", ["promotion_rule_id"], :name => "index_products_promotion_rules_on_promotion_rule_id"
+ add_index :spree_products_promotion_rules, [:product_id], :name => 'index_products_promotion_rules_on_product_id'
+ add_index :spree_products_promotion_rules, [:promotion_rule_id], :name => 'index_products_promotion_rules_on_promotion_rule_id'
- create_table "spree_promotion_action_line_items", :force => true do |t|
- t.integer "promotion_action_id"
- t.integer "variant_id"
- t.integer "quantity", :default => 1
+ create_table :spree_promotion_action_line_items, :force => true do |t|
+ t.references :promotion_action
+ t.references :variant
+ t.integer :quantity, :default => 1
end
- create_table "spree_promotion_actions", :force => true do |t|
- t.integer "activator_id"
- t.integer "position"
- t.string "type"
+ create_table :spree_promotion_actions, :force => true do |t|
+ t.references :activator
+ t.integer :position
+ t.string :type
end
- create_table "spree_promotion_rules", :force => true do |t|
- t.integer "activator_id"
- t.integer "user_id"
- t.integer "product_group_id"
- t.string "type"
+ create_table :spree_promotion_rules, :force => true do |t|
+ t.references :activator
+ t.references :user
+ t.references :product_group
+ t.string :type
t.timestamps
end
- add_index "spree_promotion_rules", ["product_group_id"], :name => "index_promotion_rules_on_product_group_id"
- add_index "spree_promotion_rules", ["user_id"], :name => "index_promotion_rules_on_user_id"
+ add_index :spree_promotion_rules, [:product_group_id], :name => 'index_promotion_rules_on_product_group_id'
+ add_index :spree_promotion_rules, [:user_id], :name => 'index_promotion_rules_on_user_id'
- create_table "spree_promotion_rules_users", :id => false, :force => true do |t|
- t.integer "user_id"
- t.integer "promotion_rule_id"
+ create_table :spree_promotion_rules_users, :id => false, :force => true do |t|
+ t.references :user
+ t.references :promotion_rule
end
- add_index "spree_promotion_rules_users", ["promotion_rule_id"], :name => "index_promotion_rules_users_on_promotion_rule_id"
- add_index "spree_promotion_rules_users", ["user_id"], :name => "index_promotion_rules_users_on_user_id"
+ add_index :spree_promotion_rules_users, [:promotion_rule_id], :name => 'index_promotion_rules_users_on_promotion_rule_id'
+ add_index :spree_promotion_rules_users, [:user_id], :name => 'index_promotion_rules_users_on_user_id'
end
end

2 comments on commit 0262203

@radar
Collaborator
@joneslee85
Collaborator

@radar lookin' into

Please sign in to comment.
Something went wrong with that request. Please try again.