Permalink
Browse files

Now using refactored migrations

  • Loading branch information...
1 parent 00cacfe commit 8898fb23267c221b6fba195add69101f166171f5 @BDQ BDQ committed Feb 9, 2012
Showing with 585 additions and 175 deletions.
  1. +4 −7 Gemfile
  2. +51 −35 Gemfile.lock
  3. +1 −1 app/controllers/spree/homepage_controller.rb
  4. +4 −9 config/initializers/site_preferences.rb
  5. +52 −0 db/migrate/20120209160827_namespace_top_level_models.rb
  6. +52 −0 db/migrate/20120209160828_migrate_namespaced_polymorphic_models.rb
  7. +9 −0 db/migrate/20120209160829_make_adjustments_polymorphic.rb
  8. +5 −0 db/migrate/20120209160830_add_company_to_addresses.rb
  9. +5 −0 db/migrate/20120209160831_add_inc_tax_to_tax_rates.rb
  10. +5 −0 db/migrate/20120209160832_rename_inc_price_attribute.rb
  11. +5 −0 db/migrate/20120209160833_add_default_tax_zone.rb
  12. +7 −0 db/migrate/20120209160834_associate_shipping_methods_and_shipping_categories.rb
  13. +7 −0 db/migrate/20120209160835_add_match_rules_to_shipping_methods.rb
  14. +48 −0 db/migrate/20120209160836_new_preferences.rb
  15. +5 −0 db/migrate/20120209160837_add_deleted_at_to_tax_category.rb
  16. +5 −0 db/migrate/20120209160838_namespace_tokenized_permission.rb
  17. +24 −0 db/migrate/20120209160839_migrate_tokenized_permissions.rb
  18. +85 −0 db/migrate/20120209160840_namespace_promo_tables.rb
  19. +11 −0 db/migrate/20120209160841_create_spree_pending_promotions.rb
  20. +29 −0 db/migrate/20120209160842_content_visited_event.rb
  21. +6 −0 db/migrate/20120209160843_prefix_tables_with_spree.rb
  22. +10 −0 db/migrate/20120209160844_namespace_spree_social_tables.rb
  23. +5 −0 db/migrate/20120209160845_prefix_table_names.rb
  24. +5 −0 db/migrate/20120209160846_namespace_paypal_accounts.rb
  25. +145 −123 db/schema.rb
View
11 Gemfile
@@ -9,7 +9,7 @@ gem 'mysql'
gem 'aws-sdk'
gem 'hoptoad_notifier'
-gem 'spree', :git => 'git://github.com/spree/spree.git'
+gem 'spree', :git => 'git://github.com/spree/spree.git', :branch => '1-0-stable'
gem 'spree_recently_viewed', :git => 'git://github.com/spree/spree_recently_viewed.git'
gem 'spree_related_products', :git => 'git://github.com/spree/spree_related_products.git'
@@ -20,12 +20,11 @@ gem 'spree_social', :git => 'git://github.com/spree/spree_social.git', :branch =
gem 'spree_static_content', :git => 'git://github.com/spree/spree_static_content.git', :branch => 'namespace'
#gem 'spree_editor', :git => 'git://github.com/spree/spree_editor.git'
gem 'spree_paypal_express', :git => 'git://github.com/spree/spree_paypal_express.git'
-gem 'active_shipping'#, :git => 'git://github.com/Shopify/active_shipping.git', :ref => '6be70c68574a9e420493' #only required until gem release 0.9.14 or later
-#gem 'spree_active_shipping', :git => 'git://github.com/spree/spree_active_shipping.git'
+gem 'spree_active_shipping', :git => 'git://github.com/spree/spree_active_shipping.git'
#gem 'spree_analytics', :git => 'https://ghro:btDMNirRZ8YF2V@github.com/spree/spree_analytics.git'
-gem 'spree_rdr_theme', :path => '../spree_rdr_theme'
+gem 'spree_rdr_theme', :git => '../spree_rdr_theme'
gem 'capistrano'
group :assets do
@@ -35,18 +34,16 @@ group :assets do
end
group :development, :test do
- gem 'sqlite3'
gem 'factory_girl_rails'
gem 'database_cleaner'
gem "rspec-rails", ">= 2.0.1"
gem "capybara", "= 0.4.0"
- #gem 'ruby-debug'
+ gem 'ruby-debug'
gem "launchy", ">= 0.3.7"
end
group :production do
gem 'foreman'
- gem 'mysql2'
gem 'unicorn'
gem 'therubyracer'
gem 'newrelic_rpm'
View
@@ -1,4 +1,10 @@
GIT
+ remote: ../spree_rdr_theme
+ revision: 97db72517e07cec9057254c80633d4e9f088adae
+ specs:
+ spree_rdr_theme (0.1.0)
+
+GIT
remote: git://github.com/railsdog/deface.git
revision: 7d097c794fec263cca5218499671683aa8f56773
specs:
@@ -8,26 +14,27 @@ GIT
GIT
remote: git://github.com/spree/spree.git
- revision: 5d49b19e711427f4e539256cce1729507405b696
+ revision: cf1bd44ec6706ae2ce420b05c847a50af3f4f18f
+ branch: 1-0-stable
specs:
- spree (1.0.0.rc3)
- spree_api (= 1.0.0.rc3)
- spree_auth (= 1.0.0.rc3)
- spree_cmd (= 1.0.0.rc3)
- spree_core (= 1.0.0.rc3)
- spree_dash (= 1.0.0.rc3)
- spree_promo (= 1.0.0.rc3)
- spree_sample (= 1.0.0.rc3)
- spree_api (1.0.0.rc3)
- spree_auth (= 1.0.0.rc3)
- spree_core (= 1.0.0.rc3)
- spree_auth (1.0.0.rc3)
+ spree (1.0.0)
+ spree_api (= 1.0.0)
+ spree_auth (= 1.0.0)
+ spree_cmd (= 1.0.0)
+ spree_core (= 1.0.0)
+ spree_dash (= 1.0.0)
+ spree_promo (= 1.0.0)
+ spree_sample (= 1.0.0)
+ spree_api (1.0.0)
+ spree_auth (= 1.0.0)
+ spree_core (= 1.0.0)
+ spree_auth (1.0.0)
cancan (= 1.6.7)
devise (= 1.4.8)
- spree_core (= 1.0.0.rc3)
- spree_cmd (1.0.0.rc3)
+ spree_core (= 1.0.0)
+ spree_cmd (1.0.0)
rails (>= 3.1.1, <= 3.1.3)
- spree_core (1.0.0.rc3)
+ spree_core (1.0.0)
activemerchant (= 1.20.1)
acts_as_list (= 0.1.4)
deface (>= 0.7.2)
@@ -41,13 +48,21 @@ GIT
rails (>= 3.1.1, <= 3.1.3)
state_machine (= 1.1.1)
stringex (~> 1.3.0)
- spree_dash (1.0.0.rc3)
- spree_core (= 1.0.0.rc3)
- spree_promo (1.0.0.rc3)
- spree_auth (= 1.0.0.rc3)
- spree_core (= 1.0.0.rc3)
- spree_sample (1.0.0.rc3)
- spree_core (= 1.0.0.rc3)
+ spree_dash (1.0.0)
+ spree_core (= 1.0.0)
+ spree_promo (1.0.0)
+ spree_auth (= 1.0.0)
+ spree_core (= 1.0.0)
+ spree_sample (1.0.0)
+ spree_core (= 1.0.0)
+
+GIT
+ remote: git://github.com/spree/spree_active_shipping.git
+ revision: fff6ad130eab4e73b45e76363294092253900bdb
+ specs:
+ spree_active_shipping (1.1.0)
+ active_shipping (= 0.9.13)
+ spree_core (>= 1.0.0.rc3)
GIT
remote: git://github.com/spree/spree_paypal_express.git
@@ -72,7 +87,7 @@ GIT
GIT
remote: git://github.com/spree/spree_social.git
- revision: 8769afcec5dd54b43e7b5672a0f2d42ff237e83b
+ revision: b2b9471013fd13fd6c270856f2ff02cb28245121
branch: namespace
specs:
spree_social (1.3)
@@ -89,11 +104,6 @@ GIT
spree_auth (>= 1.0.0.beta)
spree_core (>= 1.0.0.beta)
-PATH
- remote: ../spree_rdr_theme
- specs:
- spree_rdr_theme (0.1.0)
-
GEM
remote: http://rubygems.org/
specs:
@@ -147,7 +157,7 @@ GEM
nokogiri (>= 1.4.4)
uuidtools (~> 2.1)
bcrypt-ruby (3.0.1)
- braintree (2.13.3)
+ braintree (2.13.4)
builder (>= 2.0.0)
builder (3.0.0)
cancan (1.6.7)
@@ -177,6 +187,7 @@ GEM
coffee-script-source
execjs
coffee-script-source (1.2.0)
+ columnize (0.3.6)
culerity (0.2.15)
database_cleaner (0.7.1)
devise (1.4.8)
@@ -224,6 +235,8 @@ GEM
launchy (2.0.5)
addressable (~> 2.2.6)
libv8 (3.3.10.4)
+ linecache (0.46)
+ rbx-require-relative (> 0.0.4)
mail (2.3.0)
i18n (>= 0.4.0)
mime-types (~> 1.16)
@@ -240,7 +253,6 @@ GEM
multi_xml (0.4.1)
multipart-post (1.1.4)
mysql (2.8.1)
- mysql2 (0.3.11)
nested_set (1.6.8)
activerecord (>= 3.0.0)
railties (>= 3.0.0)
@@ -300,6 +312,7 @@ GEM
thor (~> 0.14.6)
raindrops (0.8.0)
rake (0.9.2.2)
+ rbx-require-relative (0.0.5)
rdoc (3.12)
json (~> 1.4)
rspec (2.8.0)
@@ -315,6 +328,11 @@ GEM
activesupport (>= 3.0)
railties (>= 3.0)
rspec (~> 2.8.0)
+ ruby-debug (0.10.4)
+ columnize (>= 0.1)
+ ruby-debug-base (~> 0.10.4.0)
+ ruby-debug-base (0.10.4)
+ linecache (>= 0.3)
rubyzip (0.9.5)
sass (3.1.14)
sass-rails (3.1.5)
@@ -331,7 +349,6 @@ GEM
hike (~> 1.2)
rack (~> 1.0)
tilt (~> 1.1, != 1.3.0)
- sqlite3 (1.3.5)
state_machine (1.1.1)
stringex (1.3.0)
term-ansicolor (1.0.7)
@@ -360,7 +377,6 @@ PLATFORMS
ruby
DEPENDENCIES
- active_shipping
aws-sdk
capistrano
capybara (= 0.4.0)
@@ -372,19 +388,19 @@ DEPENDENCIES
hoptoad_notifier
launchy (>= 0.3.7)
mysql
- mysql2
newrelic_rpm
rails (= 3.1.3)
rspec-rails (>= 2.0.1)
+ ruby-debug
sass-rails (~> 3.1.0)
spree!
+ spree_active_shipping!
spree_paypal_express!
spree_rdr_theme!
spree_recently_viewed!
spree_related_products!
spree_social!
spree_static_content!
- sqlite3
therubyracer
uglifier
unicorn
@@ -2,7 +2,7 @@ class Spree::HomepageController < Spree::BaseController
helper 'spree/products'
def show
- @product_groups = RailsdogRadio::Config[:homepage_groups].split(',').map { |name| Spree::ProductGroup.find_by_name(name) }.compact
+ @product_groups = Spree::Config[:homepage_groups].split(',').map { |name| Spree::ProductGroup.find_by_name(name) }.compact
end
end
@@ -1,15 +1,9 @@
-class RailsdogRadio::Configuration < Spree::Preferences::Configuration
- preference :homepage_groups, :default => ''
-end
-
-Spree::Config.class_eval do
+Spree::AppConfiguration.class_eval do
+ preference :homepage_groups, :string, :default => ''
preference :paypal_express_local_confirm, :boolean, :default => true
end
-#Spree::ActiveShipping::Config = Spree::ActiveShippingConfiguration.new
-
-RailsdogRadio::Config = RailsdogRadio::Configuration.new
-RailsdogRadio::Config.homepage_groups = 'Slingbox,Satellite Radios,Boomboxes,Accessories,Internet Radios,Vehicle Installation'
+# Spree::Config.set :homepage_groups => 'Slingbox,Satellite Radios,Boomboxes,Accessories,Internet Radios,Vehicle Installation'
# if ActiveRecord::Base.connection.tables.include?('spree_preferences')
# Spree::Config.set(:site_name => 'Rails Dog Radio')
@@ -18,3 +12,4 @@ class RailsdogRadio::Configuration < Spree::Preferences::Configuration
# Spree::ActiveShipping::Config.set(:origin_city => "Chevy Chase")
# Spree::ActiveShipping::Config.set(:origin_zip => "20815")
# end
+
@@ -0,0 +1,52 @@
+class NamespaceTopLevelModels < ActiveRecord::Migration
+ def change
+ rename_table :activators, :spree_activators
+ rename_table :addresses, :spree_addresses
+ rename_table :adjustments, :spree_adjustments
+ rename_table :configurations, :spree_configurations
+ rename_table :assets, :spree_assets
+ rename_table :calculators, :spree_calculators
+ rename_table :countries, :spree_countries
+ rename_table :creditcards, :spree_creditcards
+ rename_table :gateways, :spree_gateways
+ rename_table :inventory_units, :spree_inventory_units
+ rename_table :line_items, :spree_line_items
+ rename_table :log_entries, :spree_log_entries
+ rename_table :mail_methods, :spree_mail_methods
+ rename_table :option_types, :spree_option_types
+ rename_table :option_values, :spree_option_values
+ rename_table :option_types_prototypes, :spree_option_types_prototypes
+ rename_table :option_values_variants, :spree_option_values_variants
+ rename_table :orders, :spree_orders
+ rename_table :payments, :spree_payments
+ rename_table :payment_methods, :spree_payment_methods
+ rename_table :preferences, :spree_preferences
+ rename_table :products, :spree_products
+ rename_table :product_groups, :spree_product_groups
+ rename_table :product_groups_products, :spree_product_groups_products
+ rename_table :product_option_types, :spree_product_option_types
+ rename_table :product_properties, :spree_product_properties
+ rename_table :product_scopes, :spree_product_scopes
+ rename_table :products_taxons, :spree_products_taxons
+ rename_table :properties, :spree_properties
+ rename_table :prototypes, :spree_prototypes
+ rename_table :properties_prototypes, :spree_properties_prototypes
+ rename_table :return_authorizations, :spree_return_authorizations
+ rename_table :roles, :spree_roles
+ rename_table :roles_users, :spree_roles_users
+ rename_table :shipments, :spree_shipments
+ rename_table :shipping_categories, :spree_shipping_categories
+ rename_table :shipping_methods, :spree_shipping_methods
+ rename_table :states, :spree_states
+ rename_table :state_events, :spree_state_events
+ rename_table :tax_categories, :spree_tax_categories
+ rename_table :tax_rates, :spree_tax_rates
+ rename_table :taxons, :spree_taxons
+ rename_table :taxonomies, :spree_taxonomies
+ rename_table :trackers, :spree_trackers
+ rename_table :users, :spree_users
+ rename_table :variants, :spree_variants
+ rename_table :zones, :spree_zones
+ rename_table :zone_members, :spree_zone_members
+ end
+end
@@ -0,0 +1,52 @@
+class MigrateNamespacedPolymorphicModels < ActiveRecord::Migration
+ def concat(str1, str2)
+ dbtype = Rails.configuration.database_configuration[Rails.env]['adapter'].to_sym
+
+ case dbtype
+ when :mysql, :mysql2
+ "CONCAT(#{str1}, #{str2})"
+ when :sqlserver
+ "(#{str1} + #{str2})"
+ else
+ "(#{str1} || #{str2})"
+ end
+ end
+
+ def update_column_data(table_names, column_name)
+ tables = Array.wrap(table_names)
+ tables.each do |table|
+ execute "UPDATE #{table} SET #{column_name} = #{concat("'Spree::'", column_name)}" +
+ " where #{column_name} NOT LIKE 'Spree::%' AND #{column_name} IS NOT NULL"
+ end
+ end
+
+ def replace_column_data(table_names, column_name)
+ tables = Array.wrap(table_names)
+ tables.each do |table|
+ execute "UPDATE #{table} SET #{column_name} = REPLACE(#{column_name}, 'Spree::', '') " +
+ " where #{column_name} LIKE 'Spree::%'"
+ end
+ end
+
+ def up
+ update_column_data(['spree_payments', 'spree_adjustments', 'spree_log_entries'], 'source_type')
+ update_column_data('spree_adjustments', 'originator_type')
+ update_column_data('spree_calculators', 'calculable_type')
+ update_column_data('spree_preferences', 'owner_type')
+ update_column_data('spree_state_events', 'stateful_type')
+ update_column_data(['spree_activators', 'spree_assets', 'spree_calculators', 'spree_configurations', 'spree_gateways', 'spree_payment_methods'], 'type')
+ update_column_data('spree_assets', 'viewable_type')
+ update_column_data('spree_zone_members', 'zoneable_type')
+ end
+
+ def down
+ replace_column_data(['spree_payments', 'spree_adjustments', 'spree_log_entries'], 'source_type')
+ replace_column_data('spree_adjustments', 'originator_type')
+ replace_column_data('spree_calculators', 'calculable_type')
+ replace_column_data('spree_preferences', 'owner_type')
+ replace_column_data('spree_state_events', 'stateful_type')
+ replace_column_data(['spree_activators', 'spree_assets', 'spree_calculators', 'spree_configurations', 'spree_gateways', 'spree_payment_methods'], 'type')
+ replace_column_data('spree_assets', 'viewable_type')
+ replace_column_data('spree_zone_members', 'zoneable_type')
+ end
+end
@@ -0,0 +1,9 @@
+class MakeAdjustmentsPolymorphic < ActiveRecord::Migration
+
+ def change
+ add_column :spree_adjustments, :adjustable_type, :string
+ rename_column :spree_adjustments, :order_id, :adjustable_id
+ execute "UPDATE spree_adjustments SET adjustable_type = 'Spree::Order'"
+ end
+
+end
@@ -0,0 +1,5 @@
+class AddCompanyToAddresses < ActiveRecord::Migration
+ def change
+ add_column :spree_addresses, :company, :string
+ end
+end
Oops, something went wrong.

0 comments on commit 8898fb2

Please sign in to comment.