spree_flat_in_range 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/LICENSE +26 -0
- data/README.md +39 -0
- data/app/models/spree/calculator/flat_in_range.rb +21 -0
- data/config/locales/en.yml +5 -0
- data/lib/spree_flat_in_range.rb +21 -0
- data/spec/dummy/Rakefile +7 -0
- data/spec/dummy/app/assets/javascripts/admin/all.js +10 -0
- data/spec/dummy/app/assets/javascripts/application.js +9 -0
- data/spec/dummy/app/assets/javascripts/store/all.js +10 -0
- data/spec/dummy/app/assets/stylesheets/admin/all.css +11 -0
- data/spec/dummy/app/assets/stylesheets/application.css +7 -0
- data/spec/dummy/app/assets/stylesheets/store/all.css +11 -0
- data/spec/dummy/app/controllers/application_controller.rb +3 -0
- data/spec/dummy/app/helpers/application_helper.rb +2 -0
- data/spec/dummy/app/views/layouts/application.html.erb +14 -0
- data/spec/dummy/config.ru +4 -0
- data/spec/dummy/config/application.rb +60 -0
- data/spec/dummy/config/boot.rb +6 -0
- data/spec/dummy/config/database.yml +18 -0
- data/spec/dummy/config/environment.rb +7 -0
- data/spec/dummy/config/environments/development.rb +30 -0
- data/spec/dummy/config/environments/production.rb +60 -0
- data/spec/dummy/config/environments/test.rb +39 -0
- data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/dummy/config/initializers/inflections.rb +10 -0
- data/spec/dummy/config/initializers/mime_types.rb +5 -0
- data/spec/dummy/config/initializers/secret_token.rb +7 -0
- data/spec/dummy/config/initializers/session_store.rb +8 -0
- data/spec/dummy/config/initializers/spree.rb +12 -0
- data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/spec/dummy/config/locales/en.yml +5 -0
- data/spec/dummy/config/routes.rb +3 -0
- data/spec/dummy/config/spree.yml +2 -0
- data/spec/dummy/db/dummy_test +0 -0
- data/spec/dummy/db/migrate/20120218160357_spree_zero_nine_zero.rb +389 -0
- data/spec/dummy/db/migrate/20120218160358_create_indexes_for_inventory_units.rb +6 -0
- data/spec/dummy/db/migrate/20120218160359_add_count_on_hand_to_variants_and_products.rb +49 -0
- data/spec/dummy/db/migrate/20120218160360_change_taxons_to_nested_set.rb +46 -0
- data/spec/dummy/db/migrate/20120218160361_move_to_configurable_gateways.rb +54 -0
- data/spec/dummy/db/migrate/20120218160362_product_groups_and_scopes.rb +18 -0
- data/spec/dummy/db/migrate/20120218160363_add_open_id_authentication_tables.rb +15 -0
- data/spec/dummy/db/migrate/20120218160364_add_openid_field_to_users.rb +24 -0
- data/spec/dummy/db/migrate/20120218160365_change_preference_value_type.rb +10 -0
- data/spec/dummy/db/migrate/20120218160366_create_billing_integrations.rb +12 -0
- data/spec/dummy/db/migrate/20120218160367_charge_refactoring.rb +39 -0
- data/spec/dummy/db/migrate/20120218160368_add_some_indexes.rb +11 -0
- data/spec/dummy/db/migrate/20120218160369_checkout_state_machine.rb +5 -0
- data/spec/dummy/db/migrate/20120218160370_state_for_shipments.rb +5 -0
- data/spec/dummy/db/migrate/20120218160371_make_state_events_polymorphic.rb +12 -0
- data/spec/dummy/db/migrate/20120218160372_ship_address_id_for_checkouts.rb +5 -0
- data/spec/dummy/db/migrate/20120218160373_shipping_method_id_for_checkouts.rb +5 -0
- data/spec/dummy/db/migrate/20120218160374_creditcard_last_four_digits.rb +14 -0
- data/spec/dummy/db/migrate/20120218160375_populate_legacy_shipment_state.rb +15 -0
- data/spec/dummy/db/migrate/20120218160376_add_cost_price.rb +5 -0
- data/spec/dummy/db/migrate/20120218160377_shipment_id_for_inventory_units.rb +25 -0
- data/spec/dummy/db/migrate/20120218160378_cim_fields_for_creditcards.rb +6 -0
- data/spec/dummy/db/migrate/20120218160379_create_return_authorizations.rb +12 -0
- data/spec/dummy/db/migrate/20120218160380_add_return_authorization_to_inventory_units.rb +5 -0
- data/spec/dummy/db/migrate/20120218160381_create_trackers.rb +10 -0
- data/spec/dummy/db/migrate/20120218160382_creditcard_id_for_creditcard_txns.rb +5 -0
- data/spec/dummy/db/migrate/20120218160383_original_creditcard_txn_id_for_creditcard_txns.rb +5 -0
- data/spec/dummy/db/migrate/20120218160384_add_test_mode_to_billing_integration.rb +6 -0
- data/spec/dummy/db/migrate/20120218160385_create_products_product_groups.rb +8 -0
- data/spec/dummy/db/migrate/20120218160386_create_payment_methods.rb +16 -0
- data/spec/dummy/db/migrate/20120218160387_polymorphic_payments.rb +42 -0
- data/spec/dummy/db/migrate/20120218160388_change_payments_payment_method_to_belongs_to.rb +11 -0
- data/spec/dummy/db/migrate/20120218160389_assign_creditcard_txns_to_payment.rb +23 -0
- data/spec/dummy/db/migrate/20120218160390_sti_for_transactions.rb +15 -0
- data/spec/dummy/db/migrate/20120218160391_drop_billing_integrations.rb +16 -0
- data/spec/dummy/db/migrate/20120218160392_deleted_at_for_payment_methods.rb +14 -0
- data/spec/dummy/db/migrate/20120218160393_add_adjustments_index.rb +6 -0
- data/spec/dummy/db/migrate/20120218160394_fix_by_popularity.rb +9 -0
- data/spec/dummy/db/migrate/20120218160395_add_alt_text_to_images.rb +5 -0
- data/spec/dummy/db/migrate/20120218160396_fix_existing_coupon_credits.rb +13 -0
- data/spec/dummy/db/migrate/20120218160397_add_display_to_payment_methods.rb +5 -0
- data/spec/dummy/db/migrate/20120218160398_add_addresses_checkouts_indexes.rb +8 -0
- data/spec/dummy/db/migrate/20120218160399_add_icon_to_taxons.rb +17 -0
- data/spec/dummy/db/migrate/20120218160400_add_description_to_taxons.rb +11 -0
- data/spec/dummy/db/migrate/20120218160401_index_for_shipments_number.rb +5 -0
- data/spec/dummy/db/migrate/20120218160402_add_index_on_users_persistence_token.rb +5 -0
- data/spec/dummy/db/migrate/20120218160403_add_default_to_tax_categories.rb +5 -0
- data/spec/dummy/db/migrate/20120218160404_add_display_to_shipping_methods.rb +5 -0
- data/spec/dummy/db/migrate/20120218160405_rename_payment_method_display.rb +5 -0
- data/spec/dummy/db/migrate/20120218160406_rename_preferences_field.rb +5 -0
- data/spec/dummy/db/migrate/20120218160407_add_guest_flag.rb +5 -0
- data/spec/dummy/db/migrate/20120218160408_drop_order_token.rb +9 -0
- data/spec/dummy/db/migrate/20120218160409_payments_state_and_assigned_to_order_only.rb +14 -0
- data/spec/dummy/db/migrate/20120218160410_create_address_keys_for_order.rb +6 -0
- data/spec/dummy/db/migrate/20120218160411_payment_total_for_orders.rb +5 -0
- data/spec/dummy/db/migrate/20120218160412_shipping_method_id_for_orders.rb +5 -0
- data/spec/dummy/db/migrate/20120218160413_add_shipment_and_payment_state.rb +6 -0
- data/spec/dummy/db/migrate/20120218160414_refactor_adjustments.rb +29 -0
- data/spec/dummy/db/migrate/20120218160415_response_code_and_avs_response_for_payments.rb +6 -0
- data/spec/dummy/db/migrate/20120218160416_change_guest_flag_to_anonymous.rb +5 -0
- data/spec/dummy/db/migrate/20120218160417_email_for_orders.rb +5 -0
- data/spec/dummy/db/migrate/20120218160418_create_mail_methods.rb +10 -0
- data/spec/dummy/db/migrate/20120218160419_rename_frozen_to_locked.rb +5 -0
- data/spec/dummy/db/migrate/20120218160420_move_special_instructions_to_orders.rb +10 -0
- data/spec/dummy/db/migrate/20120218160421_create_log_entries.rb +11 -0
- data/spec/dummy/db/migrate/20120218160422_migrate_transactions_to_payment_state.rb +98 -0
- data/spec/dummy/db/migrate/20120218160423_delete_in_progress_orders.rb +19 -0
- data/spec/dummy/db/migrate/20120218160424_migrate_checkout_to_orders.rb +23 -0
- data/spec/dummy/db/migrate/20120218160425_remove_shipped_state.rb +12 -0
- data/spec/dummy/db/migrate/20120218160426_prevent_nil_payment_total.rb +8 -0
- data/spec/dummy/db/migrate/20120218160427_prevent_nil_email.rb +9 -0
- data/spec/dummy/db/migrate/20120218160428_generate_anonymous_users.rb +20 -0
- data/spec/dummy/db/migrate/20120218160429_update_order_state.rb +12 -0
- data/spec/dummy/db/migrate/20120218160430_cleanup_legacy_tables.rb +11 -0
- data/spec/dummy/db/migrate/20120218160431_remove_number_and_cvv_from_credicard.rb +11 -0
- data/spec/dummy/db/migrate/20120218160432_drop_anonymous_field_for_user.rb +9 -0
- data/spec/dummy/db/migrate/20120218160433_renamed_rma_cancelled_state.rb +9 -0
- data/spec/dummy/db/migrate/20120218160434_fix_problematic_index_names.rb +13 -0
- data/spec/dummy/db/migrate/20120218160435_add_position_to_variants.rb +5 -0
- data/spec/dummy/db/migrate/20120218160436_add_next_state_to_state_events.rb +5 -0
- data/spec/dummy/db/migrate/20120218160437_add_position_to_option_types.rb +5 -0
- data/spec/dummy/db/migrate/20120218160438_remove_trailing_slashes_in_taxon_permalinks.rb +19 -0
- data/spec/dummy/db/migrate/20120218160439_create_activators.rb +14 -0
- data/spec/dummy/db/migrate/20120218160440_eligible_for_adjustments.rb +5 -0
- data/spec/dummy/db/migrate/20120218160441_namespace_top_level_models.rb +52 -0
- data/spec/dummy/db/migrate/20120218160442_migrate_namespaced_polymorphic_models.rb +52 -0
- data/spec/dummy/db/migrate/20120218160443_make_adjustments_polymorphic.rb +9 -0
- data/spec/dummy/db/migrate/20120218160444_add_company_to_addresses.rb +5 -0
- data/spec/dummy/db/migrate/20120218160445_add_inc_tax_to_tax_rates.rb +5 -0
- data/spec/dummy/db/migrate/20120218160446_rename_inc_price_attribute.rb +5 -0
- data/spec/dummy/db/migrate/20120218160447_add_default_tax_zone.rb +5 -0
- data/spec/dummy/db/migrate/20120218160448_associate_shipping_methods_and_shipping_categories.rb +7 -0
- data/spec/dummy/db/migrate/20120218160449_add_match_rules_to_shipping_methods.rb +7 -0
- data/spec/dummy/db/migrate/20120218160450_new_preferences.rb +48 -0
- data/spec/dummy/db/migrate/20120218160451_add_deleted_at_to_tax_category.rb +5 -0
- data/spec/dummy/db/schema.rb +553 -0
- data/spec/dummy/db/seeds.rb +11 -0
- data/spec/dummy/log/test.log +1136 -0
- data/spec/dummy/public/404.html +26 -0
- data/spec/dummy/public/422.html +26 -0
- data/spec/dummy/public/500.html +26 -0
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/dummy/script/rails +6 -0
- data/spec/dummy/spec/dummy/script/rails +6 -0
- data/spec/flat_in_range_spec.rb +56 -0
- data/spec/spec_helper.rb +32 -0
- metadata +428 -0
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
class CreatePaymentMethods < ActiveRecord::Migration
|
|
2
|
+
def change
|
|
3
|
+
create_table :payment_methods do |t|
|
|
4
|
+
t.string :type, :name
|
|
5
|
+
t.text :description
|
|
6
|
+
t.boolean :active, :default => true
|
|
7
|
+
t.string :environment, :default => 'development'
|
|
8
|
+
|
|
9
|
+
t.timestamps
|
|
10
|
+
end
|
|
11
|
+
# TODO - also migrate any legacy configurations for gateways and billing integrations before dropping the old tables
|
|
12
|
+
# we probably also need to do this inside the payment_gateway extension b/c table won't exist yet in fresh bootstrap
|
|
13
|
+
#drop_table :billing_integrations
|
|
14
|
+
#drop_table :gateways
|
|
15
|
+
end
|
|
16
|
+
end
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# Legacy table support
|
|
2
|
+
class Checkout < ActiveRecord::Base; end;
|
|
3
|
+
|
|
4
|
+
class PolymorphicPayments < ActiveRecord::Migration
|
|
5
|
+
def up
|
|
6
|
+
remove_column :payments, :type
|
|
7
|
+
remove_column :payments, :creditcard_id
|
|
8
|
+
rename_column :payments, :order_id, :payable_id
|
|
9
|
+
change_table :payments do |t|
|
|
10
|
+
t.string :payable_type, :payment_method
|
|
11
|
+
t.references :source, :polymorphic => true
|
|
12
|
+
end
|
|
13
|
+
execute "UPDATE payments SET payable_type = 'Order'"
|
|
14
|
+
|
|
15
|
+
Spree::Creditcard.table_name = 'creditcards'
|
|
16
|
+
|
|
17
|
+
Spree::Creditcard.all.each do |creditcard|
|
|
18
|
+
if checkout = Checkout.find_by_id(creditcard.checkout_id) and checkout.order
|
|
19
|
+
if payment = checkout.order.payments.first
|
|
20
|
+
execute "UPDATE payments SET source_type = 'Creditcard', source_id = #{creditcard.id} WHERE id = #{payment.id}"
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
Spree::Creditcard.table_name = 'spree_creditcards'
|
|
26
|
+
|
|
27
|
+
remove_column :creditcards, :checkout_id
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def down
|
|
31
|
+
add_column :creditcards, :checkout_id, :integer
|
|
32
|
+
change_table :payments do |t|
|
|
33
|
+
t.remove :payable_type
|
|
34
|
+
t.remove :payment_method
|
|
35
|
+
t.remove :source_id
|
|
36
|
+
t.remove :source_type
|
|
37
|
+
end
|
|
38
|
+
rename_column :payments, :payable_id, :order_id
|
|
39
|
+
add_column :payments, :creditcard_id, :integer
|
|
40
|
+
add_column :payments, :type, :string
|
|
41
|
+
end
|
|
42
|
+
end
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
class ChangePaymentsPaymentMethodToBelongsTo < ActiveRecord::Migration
|
|
2
|
+
def up
|
|
3
|
+
remove_column :payments, :payment_method
|
|
4
|
+
add_column :payments, :payment_method_id, :integer
|
|
5
|
+
end
|
|
6
|
+
|
|
7
|
+
def down
|
|
8
|
+
add_column :payments, :payment_method, :string
|
|
9
|
+
remove_column :payments, :payment_method_id
|
|
10
|
+
end
|
|
11
|
+
end
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
class AssignCreditcardTxnsToPayment < ActiveRecord::Migration
|
|
2
|
+
def up
|
|
3
|
+
add_column :creditcard_txns, :payment_id, :integer
|
|
4
|
+
|
|
5
|
+
# Temporarily set back to creditcards
|
|
6
|
+
Spree::Creditcard.table_name = 'creditcards'
|
|
7
|
+
|
|
8
|
+
ActiveRecord::Base.connection.select_all('SELECT * FROM creditcard_txns').each do |txn_attrs|
|
|
9
|
+
if creditcard = Spree::Creditcard.find_by_id(txn_attrs['creditcard_id']) and creditcard.payments.first
|
|
10
|
+
execute "UPDATE creditcard_txns SET payment_id = #{creditcard.payments.first.id} WHERE id = #{txn_attrs['id']}"
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
Spree::Creditcard.table_name = 'spree_creditcards'
|
|
15
|
+
|
|
16
|
+
remove_column :creditcard_txns, :creditcard_payment_id
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def down
|
|
20
|
+
remove_column :creditcard_txns, :payment_id
|
|
21
|
+
add_column :creditcard_txns, :creditcard_payment_id, :integer
|
|
22
|
+
end
|
|
23
|
+
end
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
class StiForTransactions < ActiveRecord::Migration
|
|
2
|
+
def up
|
|
3
|
+
rename_table :creditcard_txns, :transactions
|
|
4
|
+
add_column :transactions, :type, :string
|
|
5
|
+
remove_column :transactions, :creditcard_id
|
|
6
|
+
|
|
7
|
+
execute "UPDATE transactions SET type = 'CreditcardTxn'"
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
def down
|
|
11
|
+
rename_table :transactions, :creditcard_txns
|
|
12
|
+
remove_column :transactions, :type
|
|
13
|
+
add_column :transactions, :creditcard_id, :integer
|
|
14
|
+
end
|
|
15
|
+
end
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
class DropBillingIntegrations < ActiveRecord::Migration
|
|
2
|
+
def up
|
|
3
|
+
drop_table :billing_integrations
|
|
4
|
+
end
|
|
5
|
+
|
|
6
|
+
def down
|
|
7
|
+
create_table :billing_integrations do |t|
|
|
8
|
+
t.string :type, :name
|
|
9
|
+
t.text :description
|
|
10
|
+
t.boolean :active, :default => true
|
|
11
|
+
t.string :environment, :default => 'development'
|
|
12
|
+
|
|
13
|
+
t.timestamps
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
class DeletedAtForPaymentMethods < ActiveRecord::Migration
|
|
2
|
+
def up
|
|
3
|
+
change_table :payment_methods do |t|
|
|
4
|
+
t.timestamp :deleted_at, :default => nil
|
|
5
|
+
end
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
def down
|
|
9
|
+
remove_column :payments_methods, :column_name
|
|
10
|
+
change_table :payment_methods do |t|
|
|
11
|
+
t.remove :deleted_at
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
class FixByPopularity < ActiveRecord::Migration
|
|
2
|
+
def up
|
|
3
|
+
execute("UPDATE product_scopes SET name='descend_by_popularity' WHERE name='by_popularity'")
|
|
4
|
+
end
|
|
5
|
+
|
|
6
|
+
def down
|
|
7
|
+
execute("UPDATE product_scopes SET name='by_popularity' WHERE name='descend_by_popularity'")
|
|
8
|
+
end
|
|
9
|
+
end
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
class Adjustment < ActiveRecord::Base; end;
|
|
2
|
+
|
|
3
|
+
class FixExistingCouponCredits < ActiveRecord::Migration
|
|
4
|
+
def up
|
|
5
|
+
execute("UPDATE adjustments SET type='PromotionCredit' WHERE type='CouponCredit'")
|
|
6
|
+
execute("UPDATE adjustments SET adjustment_source_type='Promotion' WHERE adjustment_source_type='Coupon'")
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
def down
|
|
10
|
+
execute("UPDATE adjustments SET adjustment_source_type='Coupon' WHERE adjustment_source_type='Promotion'")
|
|
11
|
+
execute("UPDATE adjustments SET type='CouponCredit' WHERE type='PromotionCredit'")
|
|
12
|
+
end
|
|
13
|
+
end
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
class AddIconToTaxons < ActiveRecord::Migration
|
|
2
|
+
def up
|
|
3
|
+
# skip this migration if the attribute already exists because of advanced taxon extension
|
|
4
|
+
return if column_exists?(:taxons, :icon_file_name)
|
|
5
|
+
add_column :taxons, :icon_file_name, :string
|
|
6
|
+
add_column :taxons, :icon_content_type, :string
|
|
7
|
+
add_column :taxons, :icon_file_size, :integer
|
|
8
|
+
add_column :taxons, :icon_updated_at, :datetime
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def down
|
|
12
|
+
remove_column :taxons, :icon_file_name
|
|
13
|
+
remove_column :taxons, :icon_content_type
|
|
14
|
+
remove_column :taxons, :icon_file_size
|
|
15
|
+
remove_column :taxons, :icon_updated_at
|
|
16
|
+
end
|
|
17
|
+
end
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
class AddDescriptionToTaxons < ActiveRecord::Migration
|
|
2
|
+
def up
|
|
3
|
+
# skip this migration if the attribute already exists because of advanced taxon extension
|
|
4
|
+
return if column_exists?(:taxons, :description)
|
|
5
|
+
add_column :taxons, :description, :text
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
def down
|
|
9
|
+
remove_column :taxons, :description
|
|
10
|
+
end
|
|
11
|
+
end
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
class PaymentsStateAndAssignedToOrderOnly < ActiveRecord::Migration
|
|
2
|
+
def up
|
|
3
|
+
# TODO: migrate existing payments
|
|
4
|
+
rename_column :payments, :payable_id, :order_id
|
|
5
|
+
remove_column :payments, :payable_type
|
|
6
|
+
add_column :payments, :state, :string
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
def down
|
|
10
|
+
remove_column :payments, :state
|
|
11
|
+
add_column :payments, :payable_type, :string
|
|
12
|
+
rename_column :payments, :order_id, :payable_id
|
|
13
|
+
end
|
|
14
|
+
end
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
class RefactorAdjustments < ActiveRecord::Migration
|
|
2
|
+
def up
|
|
3
|
+
change_table :adjustments do |t|
|
|
4
|
+
t.boolean :mandatory
|
|
5
|
+
t.boolean :frozen
|
|
6
|
+
t.rename :adjustment_source_id, :source_id
|
|
7
|
+
t.rename :adjustment_source_type, :source_type
|
|
8
|
+
t.references :originator
|
|
9
|
+
t.string :originator_type
|
|
10
|
+
t.remove :type
|
|
11
|
+
t.rename :description, :label
|
|
12
|
+
t.remove :position
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def down
|
|
17
|
+
change_table :adjustments do |t|
|
|
18
|
+
t.integer :position
|
|
19
|
+
t.rename :label, :description
|
|
20
|
+
t.string :type
|
|
21
|
+
t.remove :originator_type
|
|
22
|
+
t.remove :originator_id
|
|
23
|
+
t.rename :source_type, :adjustment_source_type
|
|
24
|
+
t.rename :source_id, :adjustment_source_id
|
|
25
|
+
t.remove :frozen
|
|
26
|
+
t.remove :mandatory
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
class MoveSpecialInstructionsToOrders < ActiveRecord::Migration
|
|
2
|
+
def up
|
|
3
|
+
add_column :orders, :special_instructions, :text
|
|
4
|
+
execute "UPDATE orders SET special_instructions = (SELECT special_instructions FROM checkouts WHERE order_id = orders.id)"
|
|
5
|
+
end
|
|
6
|
+
|
|
7
|
+
def down
|
|
8
|
+
remove_column :orders, :special_instructions, :text
|
|
9
|
+
end
|
|
10
|
+
end
|