From 71c7c356793f7e070ec27de7f0e5899aa5633478 Mon Sep 17 00:00:00 2001 From: Matt-Yorkley <9029026+Matt-Yorkley@users.noreply.github.com> Date: Thu, 16 Apr 2020 13:44:18 +0200 Subject: [PATCH 1/4] Remove old migrations! :tada: --- .../20120327000552_spree_zero_nine_zero.rb | 389 -------------- ...0553_create_indexes_for_inventory_units.rb | 6 - ..._count_on_hand_to_variants_and_products.rb | 49 -- ...20327000555_change_taxons_to_nested_set.rb | 46 -- ...327000556_move_to_configurable_gateways.rb | 54 -- ...0120327000557_product_groups_and_scopes.rb | 18 - ...00558_add_open_id_authentication_tables.rb | 15 - ...0120327000559_add_openid_field_to_users.rb | 24 - ...0327000560_change_preference_value_type.rb | 10 - ...20327000561_create_billing_integrations.rb | 12 - .../20120327000562_charge_refactoring.rb | 39 -- db/migrate/20120327000563_add_some_indexes.rb | 11 - .../20120327000564_checkout_state_machine.rb | 5 - .../20120327000565_state_for_shipments.rb | 5 - ...327000566_make_state_events_polymorphic.rb | 12 - ...327000567_ship_address_id_for_checkouts.rb | 5 - ...000568_shipping_method_id_for_checkouts.rb | 5 - ...20327000569_creditcard_last_four_digits.rb | 14 - ...27000570_populate_legacy_shipment_state.rb | 15 - db/migrate/20120327000571_add_cost_price.rb | 5 - ...7000572_shipment_id_for_inventory_units.rb | 25 - ...120327000573_cim_fields_for_creditcards.rb | 6 - ...0327000574_create_return_authorizations.rb | 12 - ...return_authorization_to_inventory_units.rb | 5 - db/migrate/20120327000576_create_trackers.rb | 10 - ...00577_creditcard_id_for_creditcard_txns.rb | 5 - ...l_creditcard_txn_id_for_creditcard_txns.rb | 5 - ...79_add_test_mode_to_billing_integration.rb | 6 - ...27000580_create_products_product_groups.rb | 8 - .../20120327000581_create_payment_methods.rb | 16 - .../20120327000582_polymorphic_payments.rb | 43 -- ...e_payments_payment_method_to_belongs_to.rb | 11 - ...00584_assign_creditcard_txns_to_payment.rb | 23 - .../20120327000585_sti_for_transactions.rb | 15 - ...0120327000586_drop_billing_integrations.rb | 16 - ...27000587_deleted_at_for_payment_methods.rb | 14 - .../20120327000588_add_adjustments_index.rb | 6 - .../20120327000589_fix_by_popularity.rb | 9 - .../20120327000590_add_alt_text_to_images.rb | 5 - ...20327000591_fix_existing_coupon_credits.rb | 13 - ...27000592_add_display_to_payment_methods.rb | 5 - ...7000593_add_addresses_checkouts_indexes.rb | 8 - .../20120327000594_add_icon_to_taxons.rb | 17 - ...0120327000595_add_description_to_taxons.rb | 11 - ...120327000596_index_for_shipments_number.rb | 5 - ...97_add_index_on_users_persistence_token.rb | 5 - ...327000598_add_default_to_tax_categories.rb | 5 - ...7000599_add_display_to_shipping_methods.rb | 5 - ...327000600_rename_payment_method_display.rb | 5 - ...20120327000601_rename_preferences_field.rb | 5 - db/migrate/20120327000602_add_guest_flag.rb | 5 - db/migrate/20120327000603_drop_order_token.rb | 9 - ...yments_state_and_assigned_to_order_only.rb | 14 - ...327000605_create_address_keys_for_order.rb | 6 - ...20120327000606_payment_total_for_orders.rb | 5 - ...327000607_shipping_method_id_for_orders.rb | 5 - ...27000608_add_shipment_and_payment_state.rb | 6 - .../20120327000609_refactor_adjustments.rb | 29 -- ...onse_code_and_avs_response_for_payments.rb | 6 - ...27000611_change_guest_flag_to_anonymous.rb | 5 - db/migrate/20120327000612_email_for_orders.rb | 5 - .../20120327000613_create_mail_methods.rb | 10 - .../20120327000614_rename_frozen_to_locked.rb | 5 - ...615_move_special_instructions_to_orders.rb | 10 - .../20120327000616_create_log_entries.rb | 11 - ...7_migrate_transactions_to_payment_state.rb | 98 ---- ...0120327000618_delete_in_progress_orders.rb | 19 - ...120327000619_migrate_checkout_to_orders.rb | 23 - .../20120327000620_remove_shipped_state.rb | 12 - ...0120327000621_prevent_nil_payment_total.rb | 8 - .../20120327000622_prevent_nil_email.rb | 9 - ...20120327000623_generate_anonymous_users.rb | 20 - .../20120327000624_update_order_state.rb | 12 - .../20120327000625_cleanup_legacy_tables.rb | 11 - ...26_remove_number_and_cvv_from_credicard.rb | 11 - ...327000627_drop_anonymous_field_for_user.rb | 9 - ...20327000628_renamed_rma_cancelled_state.rb | 9 - ...20327000629_fix_problematic_index_names.rb | 13 - ...20120327000630_add_position_to_variants.rb | 5 - ...27000631_add_next_state_to_state_events.rb | 5 - ...0327000632_add_position_to_option_types.rb | 5 - ...ve_trailing_slashes_in_taxon_permalinks.rb | 19 - .../20120327000634_create_activators.rb | 14 - ...20120327000635_eligible_for_adjustments.rb | 5 - ...120327000636_namespace_top_level_models.rb | 52 -- ...7_migrate_namespaced_polymorphic_models.rb | 52 -- ...0327000638_make_adjustments_polymorphic.rb | 9 - ...20120327000639_add_company_to_addresses.rb | 5 - ...20120327000640_add_inc_tax_to_tax_rates.rb | 5 - ...120327000641_rename_inc_price_attribute.rb | 5 - .../20120327000642_add_default_tax_zone.rb | 5 - ...hipping_methods_and_shipping_categories.rb | 7 - ...644_add_match_rules_to_shipping_methods.rb | 7 - db/migrate/20120327000645_new_preferences.rb | 81 --- ...27000646_add_deleted_at_to_tax_category.rb | 5 - ...0120327000647_rename_columns_for_devise.rb | 39 -- ...20327000648_convert_user_remember_field.rb | 11 - ...0327000649_create_tokenized_permissions.rb | 13 - ...20120327000650_tokens_for_legacy_orders.rb | 16 - ...27000651_namespace_tokenized_permission.rb | 5 - ...327000652_migrate_tokenized_permissions.rb | 24 - .../20120327000653_add_api_key_to_users.rb | 5 - ...0327000654_rename_coupons_to_promotions.rb | 10 - .../20120327000655_create_promotion_rules.rb | 24 - ...20327000656_match_policy_for_promotions.rb | 5 - ...0327000657_create_promotion_rules_users.rb | 14 - .../20120327000658_name_for_promotions.rb | 5 - ...9_update_calculable_type_for_promotions.rb | 9 - .../20120327000660_migrate_adjustments.rb | 9 - ...motion_changes_to_subclass_of_activator.rb | 22 - ...20120327000662_create_promotion_actions.rb | 9 - ...0663_create_promotion_action_line_items.rb | 10 - .../20120327000664_namespace_promo_tables.rb | 85 --- ...7000665_create_spree_pending_promotions.rb | 11 - .../20120327000666_content_visited_event.rb | 29 -- ...120327000667_create_skrill_transactions.rb | 14 - .../20120331051742_create_distributors.rb | 18 - ...20120407065132_add_distributor_to_order.rb | 5 - ...add_extra_address_fields_to_distributor.rb | 7 - ...20120409004831_add_state_to_distributor.rb | 5 - db/migrate/20120422042134_add_supplier.rb | 16 - .../20120425065453_add_supplier_to_product.rb | 5 - ...654_replace_spree_address_from_supplier.rb | 12 - ...ame_state_events_to_state_changes.spree.rb | 10 - ..._images_from_products_to_variants.spree.rb | 36 -- ...ment_size_to_attachment_file_size.spree.rb | 6 - ..._move_distributor_from_order_to_product.rb | 26 - ...20621064227_add_distributor_id_to_order.rb | 5 - ...r_and_supplier_address_to_spree_address.rb | 92 ---- ...utors_products_to_product_distributions.rb | 27 - ...increase_scale_of_tax_rate_amount.spree.rb | 10 - ...sword_sent_at_to_spree_users.spree_auth.rb | 6 - ...29043045_resize_api_key_field.spree_api.rb | 6 - ...te_paypal_accounts.spree_paypal_express.rb | 15 - ...ce_paypal_accounts.spree_paypal_express.rb | 6 - ..._add_next_collection_at_to_distributors.rb | 5 - .../20120802031147_add_group_buy_fields.rb | 6 - ..._convert_sales_tax_to_default_tax.spree.rb | 10 - ...eted_at_to_spree_shipping_methods.spree.rb | 6 - ...659_make_users_email_index_unique.spree.rb | 11 - ...add_counter_cache_to_zone_members.spree.rb | 15 - ...13335_add_shipping_method_to_line_items.rb | 20 - ..._populate_order_default_shipping_method.rb | 10 - db/migrate/20121009232513_create_cms.rb | 137 ----- ...scription_to_distributors_and_suppliers.rb | 6 - ...907_add_group_buy_unit_size_to_products.rb | 5 - ...liers_and_distributors_into_enterprises.rb | 69 --- ..._remove_pickup_address_from_enterprises.rb | 21 - ...roup_buy_unit_size_from_string_to_float.rb | 21 - ...22403_remove_suppliers_and_distributors.rb | 37 -- .../20121115010717_create_enterprise_fees.rb | 11 - .../20121125232613_create_order_cycles.rb | 35 -- ...0_change_exchange_pickup_time_to_string.rb | 9 - ...0130204355_add_order_cycle_id_to_orders.rb | 5 - ...reate_tokenized_permissions_table.spree.rb | 17 - ...ename_creditcards_to_credit_cards.spree.rb | 12 - ...8_remove_credit_total_from_orders.spree.rb | 6 - ...20130207043039_add_tax_rate_label.spree.rb | 6 - ...43040_add_toggle_tax_rate_display.spree.rb | 6 - ...43041_add_lock_version_to_variant.spree.rb | 6 - ..._constraint_from_products_on_hand.spree.rb | 12 - ...043043_add_position_to_taxonomies.spree.rb | 6 - ..._add_identifier_to_spree_payments.spree.rb | 6 - ...name_api_key_to_spree_api_key.spree_api.rb | 8 - .../20130207043047_create_users.spree_auth.rb | 30 -- .../20130207043541_spree_one_two.spree.rb | 482 ------------------ ..._remove_unused_preference_columns.spree.rb | 9 - ..._add_states_required_to_countries.spree.rb | 6 - ..._on_demand_to_product_and_variant.spree.rb | 7 - ...043545_split_prices_from_variants.spree.rb | 32 -- ...not_null_from_spree_prices_amount.spree.rb | 10 - ...043547_add_currency_to_line_items.spree.rb | 6 - ...0207043548_add_currency_to_orders.spree.rb | 6 - ...549_add_cost_currency_to_variants.spree.rb | 6 - ...e_display_on_from_payment_methods.spree.rb | 10 - ...43551_add_last_ip_to_spree_orders.spree.rb | 6 - ...splay_on_to_spree_payment_methods.spree.rb | 10 - ...dd_position_to_product_properties.spree.rb | 7 - ...54_add_api_key_to_spree_users.spree_api.rb | 8 - ...7043555_spree_promo_one_two.spree_promo.rb | 46 -- ...ises_distributor_info_rich_text_feature.rb | 6 - ...33_add_order_id_index_to_payments.spree.rb | 10 - ..._primary_to_spree_products_taxons.spree.rb | 6 - ...5_add_order_id_index_to_shipments.spree.rb | 6 - ...ription_on_spree_products_to_text.spree.rb | 6 - ..._variant_id_index_to_spree_prices.spree.rb | 6 - ...638_change_orders_total_precision.spree.rb | 9 - ...e_spree_payments_amount_precision.spree.rb | 8 - ...rn_authorization_amount_precision.spree.rb | 8 - ...ange_adjustments_amount_precision.spree.rb | 8 - ...629120642_add_seo_metas_to_taxons.spree.rb | 10 - ..._result_message_to_spree_payments.spree.rb | 7 - ...ex_to_permalink_on_spree_products.spree.rb | 6 - ...ers_shipments_and_stock_transfers.spree.rb | 7 - ...4_make_order_cycle_coordinator_fees_mtm.rb | 19 - .../20130729030515_add_enterprise_role.rb | 8 - ...130801005801_create_landing_page_images.rb | 7 - ..._attachment_photo_to_landing_page_image.rb | 15 - ...20130805050109_update_line_item_caching.rb | 47 -- ...enterprise_fee_to_product_distributions.rb | 5 - db/migrate/20130806055125_create_suburbs.rb | 11 - ...add_latitude_and_longitude_to_addresses.rb | 6 - ...57_add_distributor_id_to_payment_method.rb | 5 - db/migrate/20130807230834_add_cart.rb | 9 - ...e_fee_records_for_product_distributions.rb | 26 - ...130809075103_create_adjustment_metadata.rb | 13 - ...ipping_method_from_product_distribution.rb | 9 - ...pping_methods_using_itemwise_calculator.rb | 15 - ..._add_distributor_id_to_shipping_methods.rb | 6 - ...553_create_distributors_payment_methods.rb | 20 - ...move_distributor_id_from_payment_method.rb | 12 - ...sure_shipping_methods_have_distributors.rb | 20 - ..._shipping_methods_distributors_to_habtm.rb | 37 -- ...20131024005253_create_enterprise_groups.rb | 13 - ...31125_add_position_to_enterprise_groups.rb | 5 - ...28034556_setup_product_units_and_values.rb | 14 - ...238_make_unit_description_default_blank.rb | 10 - ...30500_add_attachment_logo_to_enterprise.rb | 15 - ...dd_attachment_promo_image_to_enterprise.rb | 15 - .../20140204011203_add_notes_to_products.rb | 5 - ...equire_ship_address_to_shipping_methods.rb | 6 - ...0140324025840_add_incoming_to_exchanges.rb | 25 - .../20140402032034_add_missing_indexes.rb | 38 -- db/migrate/20140402033428_add_foreign_keys.rb | 188 ------- ...25055718_add_active_flag_to_enterprises.rb | 5 - ...rename_active_to_visible_on_enterprises.rb | 5 - ...4044959_create_enterprise_relationships.rb | 16 - ...achment_promo_image_to_enterprise_group.rb | 15 - .../20140516044750_add_fields_to_groups.rb | 6 - ...add_attachment_logo_to_enterprise_group.rb | 15 - ...2015012_add_social_media_to_enterprises.rb | 7 - ...522044009_add_primary_taxon_to_products.rb | 20 - ...y_name_and_display_as_to_spree_variants.rb | 6 - ...move_deleted_variants_from_order_cycles.rb | 10 - ...140613004344_create_producer_properties.rb | 18 - ...230121_change_suburb_postcode_to_string.rb | 9 - ...fields_to_distributors_shipping_methods.rb | 23 - ...20140716051214_drop_landing_page_images.rb | 16 - ..._express_checkouts.spree_paypal_express.rb | 9 - ..._express_checkouts.spree_paypal_express.rb | 7 - ..._express_checkouts.spree_paypal_express.rb | 6 - ..._express_checkouts.spree_paypal_express.rb | 9 - .../20140723023713_switch_paypal_methods.rb | 13 - ...d_unique_constraint_to_enterprise_roles.rb | 5 - .../20140815065014_add_type_to_enterprises.rb | 10 - ...ate_enterprise_relationship_permissions.rb | 11 - ...3521_prevent_duplicate_enterprise_roles.rb | 5 - .../20140828023619_add_owner_to_enterprise.rb | 22 - ...026_add_enterprise_limit_to_spree_users.rb | 18 - ...0927005000_add_dummy_for_missing_emails.rb | 7 - ...140927005043_enterprise_config_refactor.rb | 57 --- ...060622_add_standard_variant_to_products.rb | 63 --- ...010043405_add_confirmable_to_enterprise.rb | 16 - ...dd_shop_trial_start_date_to_enterprises.rb | 5 - ...dd_producer_profile_only_to_enterprises.rb | 5 - ...20141113053004_create_variant_overrides.rb | 15 - ..._not_null_to_variant_override_relations.rb | 11 - ...1219034321_add_permalink_to_enterprises.rb | 25 - ...229094516_add_receival_time_to_exchange.rb | 6 - ..._add_addresses_ref_to_enterprise_groups.rb | 6 - ...instances_to_existing_enterprise_groups.rb | 19 - ...27_add_web_contact_to_enterprise_groups.rb | 10 - db/migrate/20150122145607_create_customers.rb | 18 - ...02000203_add_owner_to_enterprise_groups.rb | 6 - ...controlled_to_spree_shipping_categories.rb | 5 - ...42_add_owner_index_to_enterprise_groups.rb | 5 - ...d_address_id_index_to_enterprise_groups.rb | 5 - ...1538_add_tax_category_to_enterprise_fee.rb | 7 - ...5232938_add_included_tax_to_adjustments.rb | 5 - ...20150305004846_add_weight_to_line_items.rb | 5 - ...39_add_charges_sales_tax_to_enterprises.rb | 5 - .../20150410043302_create_delayed_jobs.rb | 22 - ...4819_add_inherits_properties_to_product.rb | 5 - ...ot_null_to_producer_properties_position.rb | 9 - ...424151117_populate_line_item_unit_value.rb | 9 - ...on_migration.acts_as_taggable_on_engine.rb | 31 -- ...ique_indices.acts_as_taggable_on_engine.rb | 20 - ...ache_to_tags.acts_as_taggable_on_engine.rb | 15 - ...ggable_index.acts_as_taggable_on_engine.rb | 10 - ...or_tag_names.acts_as_taggable_on_engine.rb | 10 - ...emove_customer_code_not_null_constraint.rb | 9 - .../20150508072938_add_customer_to_orders.rb | 16 - .../20150527004427_add_permalink_to_groups.rb | 26 - ...dd_unique_index_to_enterprise_permalink.rb | 16 - .../20150604045725_add_sessions_table.rb | 12 - ...16_dependent_delete_adjustment_metadata.rb | 11 - ...0612045544_make_enterprises_name_unique.rb | 20 - db/migrate/20150619020711_create_versions.rb | 13 - .../20150619100137_create_bill_items.rb | 15 - ...8_rename_bill_items_to_billable_periods.rb | 9 - ...4055_add_timestamps_to_billable_periods.rb | 8 - ..._add_default_stock_to_variant_overrides.rb | 5 - ...50719153136_rename_line_item_unit_value.rb | 5 - ...cision_on_line_item_final_weight_volume.rb | 11 - ...ate_spree_line_item_final_weight_volume.rb | 9 - ...2_add_enable_reset_to_variant_overrides.rb | 5 - .../20150916012814_create_account_invoices.rb | 18 - ...add_account_invoice_to_billable_periods.rb | 7 - ...add_option_values_line_items_join_table.rb | 14 - ...sure_address_for_account_invoice_orders.rb | 15 - ...nge_receival_time_receival_instructions.rb | 9 - ..._on_demand_and_sku_to_variant_overrides.rb | 6 - ...85900_rename_enable_reset_to_resettable.rb | 3 - .../20160114001844_create_inventory_items.rb | 13 - ...0160116024333_create_column_preferences.rb | 13 - ...160204013914_add_id_to_coordinator_fees.rb | 5 - ...nherits_tax_category_to_enterprise_fees.rb | 5 - ...044930_add_email_address_to_enterprises.rb | 5 - ...0212092908_set_enterprise_email_address.rb | 8 - .../20160218235221_populate_inventories.rb | 22 - ...t_explicit_variant_override_permissions.rb | 30 -- ...mission_revoked_at_to_variant_overrides.rb | 21 - .../20160302044850_repopulate_inventories.rb | 30 -- db/migrate/20160303004210_create_tag_rules.rb | 10 - ...6051131_add_require_login_to_enterprise.rb | 5 - ...7_change_value_type_of_paypal_passwords.rb | 15 - ...160520065217_add_is_default_to_tag_rule.rb | 5 - ...20160527012603_add_priority_to_tag_rule.rb | 5 - db/migrate/20160630052453_create_schedules.rb | 8 - ...0630055825_create_order_cycle_schedules.rb | 14 - db/migrate/20160707023818_drop_cms.rb | 154 ------ ...ll_address_and_ship_address_to_customer.rb | 12 - .../20160713013358_add_name_to_customer.rb | 5 - .../20160819045727_create_standing_orders.rb | 25 - ...wap_calculator_to_flat_percent_per_item.rb | 29 -- ...160824013751_create_standing_line_items.rb | 16 - .../20160828115018_create_stripe_accounts.rb | 12 - ...35_add_state_to_spree_adjustments.spree.rb | 7 - ...42_add_allow_guest_orders_to_enterprise.rb | 5 - ...2_add_allow_order_changes_to_enterprise.rb | 5 - ...hip_and_bill_address_to_standing_orders.rb | 12 - ...1020012017_create_standing_order_orders.rb | 16 - ...anding_orders_placed_at_to_order_cycles.rb | 5 - ...d_price_estimate_to_standing_line_items.rb | 5 - ...2009_add_canceled_at_to_standing_orders.rb | 5 - ...name_standing_order_orders_cancelled_at.rb | 7 - ...042153_add_paused_at_to_standing_orders.rb | 5 - ...ing_orders_confirmed_at_to_order_cycles.rb | 5 - ...e_standing_order_orders_to_proxy_orders.rb | 9 - ...5939_add_order_cycle_id_to_proxy_orders.rb | 20 - ...e_proxy_order_order_not_null_constraint.rb | 9 - ...d_enable_standing_orders_to_enterprises.rb | 5 - ...ce_text_and_invoice_logo_to_enterprises.rb | 6 - ...ced_at_and_confirmed_at_to_proxy_orders.rb | 6 - ...03658_add_user_id_to_spree_credit_cards.rb | 8 - ...dd_payment_method_to_spree_credit_cards.rb | 8 - ...31746_add_import_date_to_spree_variants.rb | 5 - ...01_add_import_date_to_variant_overrides.rb | 5 - ...me_payment_methods.spree_paypal_express.rb | 14 - ...ing_url_to_spree_shipping_methods.spree.rb | 6 - ...0170512115519_add_locale_to_spree_users.rb | 5 - .../20170710145821_add_confirmable_to_user.rb | 16 - ...120_remove_confirmable_from_enterprises.rb | 16 - ...eives_notifications_to_enterprise_roles.rb | 5 - ...728140134_remove_email_from_enterprises.rb | 48 -- ...t_value_of_spree_users_enterprise_limit.rb | 9 - ...21065259_update_adjustment_states.spree.rb | 17 - ...5930_add_credit_card_to_standing_orders.rb | 7 - ...rename_standing_orders_to_subscriptions.rb | 99 ---- ...g_line_items_to_subscription_line_items.rb | 27 - ...nd_payment_fee_estimate_to_subscription.rb | 6 - ...d_at_and_confirmed_at_from_order_cycles.rb | 11 - ...045821_add_charges_allowed_to_customers.rb | 5 - ...418025217_add_is_default_to_credit_card.rb | 5 - ...26145630_create_spree_stock_items.spree.rb | 15 - ...5631_create_spree_stock_locations.spree.rb | 12 - ...180426145632_create_default_stock.spree.rb | 34 -- ...ck_location_id_to_spree_shipments.spree.rb | 6 - ...634_add_pending_to_inventory_unit.spree.rb | 7 - ...n_demand_from_product_and_variant.spree.rb | 7 - ...45636_create_shipping_method_zone.spree.rb | 23 - ..._category_id_from_shipping_method.spree.rb | 6 - ...create_shipping_method_categories.spree.rb | 14 - ...45639_create_spree_shipping_rates.spree.rb | 25 - ...h_attributes_from_shipping_method.spree.rb | 8 - ...0426145641_create_stock_movements.spree.rb | 13 - ..._address_fields_to_stock_location.spree.rb | 23 - ...d_active_field_to_stock_locations.spree.rb | 6 - ...4_add_backorderable_to_stock_item.spree.rb | 6 - ...efault_quantity_to_stock_movement.spree.rb | 6 - ...nd_destination_to_stock_movements.spree.rb | 9 - ..._add_originator_to_stock_movement.spree.rb | 8 - ...d_destination_from_stock_movement.spree.rb | 16 - ...te_inventory_unit_sold_to_on_hand.spree.rb | 10 - ...6145650_add_stock_location_to_rma.spree.rb | 6 - ...hipment_state_for_canceled_orders.spree.rb | 16 - ...emove_stock_item_and_variant_lock.spree.rb | 15 - ...3_add_shipping_rates_to_shipments.spree.rb | 16 - ...5654_create_spree_stock_transfers.spree.rb | 15 - ...45655_drop_products_count_on_hand.spree.rb | 6 - ...56_set_default_shipping_rate_cost.spree.rb | 6 - ...5657_add_number_to_stock_transfer.spree.rb | 24 - ...8_add_sku_index_to_spree_variants.spree.rb | 6 - ...e_default_to_spree_stock_location.spree.rb | 6 - ..._variants_to_spree_stock_location.spree.rb | 6 - ...s_to_spree_shipping_methods_zones.spree.rb | 6 - ...add_deleted_at_to_spree_tax_rates.spree.rb | 6 - ...lock_version_from_inventory_units.spree.rb | 7 - ...45664_add_cost_price_to_line_item.spree.rb | 6 - ...backorderable_to_default_to_false.spree.rb | 7 - ...add_created_by_id_to_spree_orders.spree.rb | 6 - ...ndex_completed_at_on_spree_orders.spree.rb | 6 - ...x_category_id_to_spree_line_items.spree.rb | 6 - ...rate_tax_categories_to_line_items.spree.rb | 14 - ...0_remove_credit_card_from_subscriptions.rb | 13 - db/migrate/20180812214434_drop_carts.rb | 7 - ...ness_of_variant_id_to_spree_stock_items.rb | 8 - ...iqueness_of_order_id_to_spree_shipments.rb | 92 ---- ...pping_method_name_from_spree_line_items.rb | 9 - .../20181008201815_update_instagram_data.rb | 8 - ...0093850_fix_variants_missing_unit_value.rb | 49 -- ...ke_variant_overrideswithout_permissions.rb | 17 - ...low_all_suppliers_own_variant_overrides.rb | 12 - ...pdate_weight_calculator_type_class_name.rb | 9 - ...1123012635_associate_customers_to_users.rb | 42 -- .../20181128054803_old_migrations_removed.rb | 11 + ...implify_variant_override_stock_settings.rb | 165 ------ 417 files changed, 11 insertions(+), 7125 deletions(-) delete mode 100644 db/migrate/20120327000552_spree_zero_nine_zero.rb delete mode 100644 db/migrate/20120327000553_create_indexes_for_inventory_units.rb delete mode 100644 db/migrate/20120327000554_add_count_on_hand_to_variants_and_products.rb delete mode 100644 db/migrate/20120327000555_change_taxons_to_nested_set.rb delete mode 100644 db/migrate/20120327000556_move_to_configurable_gateways.rb delete mode 100644 db/migrate/20120327000557_product_groups_and_scopes.rb delete mode 100644 db/migrate/20120327000558_add_open_id_authentication_tables.rb delete mode 100644 db/migrate/20120327000559_add_openid_field_to_users.rb delete mode 100644 db/migrate/20120327000560_change_preference_value_type.rb delete mode 100644 db/migrate/20120327000561_create_billing_integrations.rb delete mode 100644 db/migrate/20120327000562_charge_refactoring.rb delete mode 100644 db/migrate/20120327000563_add_some_indexes.rb delete mode 100644 db/migrate/20120327000564_checkout_state_machine.rb delete mode 100644 db/migrate/20120327000565_state_for_shipments.rb delete mode 100644 db/migrate/20120327000566_make_state_events_polymorphic.rb delete mode 100644 db/migrate/20120327000567_ship_address_id_for_checkouts.rb delete mode 100644 db/migrate/20120327000568_shipping_method_id_for_checkouts.rb delete mode 100644 db/migrate/20120327000569_creditcard_last_four_digits.rb delete mode 100644 db/migrate/20120327000570_populate_legacy_shipment_state.rb delete mode 100644 db/migrate/20120327000571_add_cost_price.rb delete mode 100644 db/migrate/20120327000572_shipment_id_for_inventory_units.rb delete mode 100644 db/migrate/20120327000573_cim_fields_for_creditcards.rb delete mode 100644 db/migrate/20120327000574_create_return_authorizations.rb delete mode 100644 db/migrate/20120327000575_add_return_authorization_to_inventory_units.rb delete mode 100644 db/migrate/20120327000576_create_trackers.rb delete mode 100644 db/migrate/20120327000577_creditcard_id_for_creditcard_txns.rb delete mode 100644 db/migrate/20120327000578_original_creditcard_txn_id_for_creditcard_txns.rb delete mode 100644 db/migrate/20120327000579_add_test_mode_to_billing_integration.rb delete mode 100644 db/migrate/20120327000580_create_products_product_groups.rb delete mode 100644 db/migrate/20120327000581_create_payment_methods.rb delete mode 100644 db/migrate/20120327000582_polymorphic_payments.rb delete mode 100644 db/migrate/20120327000583_change_payments_payment_method_to_belongs_to.rb delete mode 100644 db/migrate/20120327000584_assign_creditcard_txns_to_payment.rb delete mode 100644 db/migrate/20120327000585_sti_for_transactions.rb delete mode 100644 db/migrate/20120327000586_drop_billing_integrations.rb delete mode 100644 db/migrate/20120327000587_deleted_at_for_payment_methods.rb delete mode 100644 db/migrate/20120327000588_add_adjustments_index.rb delete mode 100644 db/migrate/20120327000589_fix_by_popularity.rb delete mode 100644 db/migrate/20120327000590_add_alt_text_to_images.rb delete mode 100644 db/migrate/20120327000591_fix_existing_coupon_credits.rb delete mode 100644 db/migrate/20120327000592_add_display_to_payment_methods.rb delete mode 100644 db/migrate/20120327000593_add_addresses_checkouts_indexes.rb delete mode 100644 db/migrate/20120327000594_add_icon_to_taxons.rb delete mode 100644 db/migrate/20120327000595_add_description_to_taxons.rb delete mode 100644 db/migrate/20120327000596_index_for_shipments_number.rb delete mode 100644 db/migrate/20120327000597_add_index_on_users_persistence_token.rb delete mode 100644 db/migrate/20120327000598_add_default_to_tax_categories.rb delete mode 100644 db/migrate/20120327000599_add_display_to_shipping_methods.rb delete mode 100644 db/migrate/20120327000600_rename_payment_method_display.rb delete mode 100644 db/migrate/20120327000601_rename_preferences_field.rb delete mode 100644 db/migrate/20120327000602_add_guest_flag.rb delete mode 100644 db/migrate/20120327000603_drop_order_token.rb delete mode 100644 db/migrate/20120327000604_payments_state_and_assigned_to_order_only.rb delete mode 100644 db/migrate/20120327000605_create_address_keys_for_order.rb delete mode 100644 db/migrate/20120327000606_payment_total_for_orders.rb delete mode 100644 db/migrate/20120327000607_shipping_method_id_for_orders.rb delete mode 100644 db/migrate/20120327000608_add_shipment_and_payment_state.rb delete mode 100644 db/migrate/20120327000609_refactor_adjustments.rb delete mode 100644 db/migrate/20120327000610_response_code_and_avs_response_for_payments.rb delete mode 100644 db/migrate/20120327000611_change_guest_flag_to_anonymous.rb delete mode 100644 db/migrate/20120327000612_email_for_orders.rb delete mode 100644 db/migrate/20120327000613_create_mail_methods.rb delete mode 100644 db/migrate/20120327000614_rename_frozen_to_locked.rb delete mode 100644 db/migrate/20120327000615_move_special_instructions_to_orders.rb delete mode 100644 db/migrate/20120327000616_create_log_entries.rb delete mode 100644 db/migrate/20120327000617_migrate_transactions_to_payment_state.rb delete mode 100644 db/migrate/20120327000618_delete_in_progress_orders.rb delete mode 100644 db/migrate/20120327000619_migrate_checkout_to_orders.rb delete mode 100644 db/migrate/20120327000620_remove_shipped_state.rb delete mode 100644 db/migrate/20120327000621_prevent_nil_payment_total.rb delete mode 100644 db/migrate/20120327000622_prevent_nil_email.rb delete mode 100644 db/migrate/20120327000623_generate_anonymous_users.rb delete mode 100644 db/migrate/20120327000624_update_order_state.rb delete mode 100644 db/migrate/20120327000625_cleanup_legacy_tables.rb delete mode 100644 db/migrate/20120327000626_remove_number_and_cvv_from_credicard.rb delete mode 100644 db/migrate/20120327000627_drop_anonymous_field_for_user.rb delete mode 100644 db/migrate/20120327000628_renamed_rma_cancelled_state.rb delete mode 100644 db/migrate/20120327000629_fix_problematic_index_names.rb delete mode 100644 db/migrate/20120327000630_add_position_to_variants.rb delete mode 100644 db/migrate/20120327000631_add_next_state_to_state_events.rb delete mode 100644 db/migrate/20120327000632_add_position_to_option_types.rb delete mode 100644 db/migrate/20120327000633_remove_trailing_slashes_in_taxon_permalinks.rb delete mode 100644 db/migrate/20120327000634_create_activators.rb delete mode 100644 db/migrate/20120327000635_eligible_for_adjustments.rb delete mode 100644 db/migrate/20120327000636_namespace_top_level_models.rb delete mode 100644 db/migrate/20120327000637_migrate_namespaced_polymorphic_models.rb delete mode 100644 db/migrate/20120327000638_make_adjustments_polymorphic.rb delete mode 100644 db/migrate/20120327000639_add_company_to_addresses.rb delete mode 100644 db/migrate/20120327000640_add_inc_tax_to_tax_rates.rb delete mode 100644 db/migrate/20120327000641_rename_inc_price_attribute.rb delete mode 100644 db/migrate/20120327000642_add_default_tax_zone.rb delete mode 100644 db/migrate/20120327000643_associate_shipping_methods_and_shipping_categories.rb delete mode 100644 db/migrate/20120327000644_add_match_rules_to_shipping_methods.rb delete mode 100644 db/migrate/20120327000645_new_preferences.rb delete mode 100644 db/migrate/20120327000646_add_deleted_at_to_tax_category.rb delete mode 100644 db/migrate/20120327000647_rename_columns_for_devise.rb delete mode 100644 db/migrate/20120327000648_convert_user_remember_field.rb delete mode 100644 db/migrate/20120327000649_create_tokenized_permissions.rb delete mode 100644 db/migrate/20120327000650_tokens_for_legacy_orders.rb delete mode 100644 db/migrate/20120327000651_namespace_tokenized_permission.rb delete mode 100644 db/migrate/20120327000652_migrate_tokenized_permissions.rb delete mode 100644 db/migrate/20120327000653_add_api_key_to_users.rb delete mode 100644 db/migrate/20120327000654_rename_coupons_to_promotions.rb delete mode 100644 db/migrate/20120327000655_create_promotion_rules.rb delete mode 100644 db/migrate/20120327000656_match_policy_for_promotions.rb delete mode 100644 db/migrate/20120327000657_create_promotion_rules_users.rb delete mode 100644 db/migrate/20120327000658_name_for_promotions.rb delete mode 100644 db/migrate/20120327000659_update_calculable_type_for_promotions.rb delete mode 100644 db/migrate/20120327000660_migrate_adjustments.rb delete mode 100644 db/migrate/20120327000661_promotion_changes_to_subclass_of_activator.rb delete mode 100644 db/migrate/20120327000662_create_promotion_actions.rb delete mode 100644 db/migrate/20120327000663_create_promotion_action_line_items.rb delete mode 100644 db/migrate/20120327000664_namespace_promo_tables.rb delete mode 100644 db/migrate/20120327000665_create_spree_pending_promotions.rb delete mode 100644 db/migrate/20120327000666_content_visited_event.rb delete mode 100644 db/migrate/20120327000667_create_skrill_transactions.rb delete mode 100644 db/migrate/20120331051742_create_distributors.rb delete mode 100644 db/migrate/20120407065132_add_distributor_to_order.rb delete mode 100644 db/migrate/20120408081918_add_extra_address_fields_to_distributor.rb delete mode 100644 db/migrate/20120409004831_add_state_to_distributor.rb delete mode 100644 db/migrate/20120422042134_add_supplier.rb delete mode 100644 db/migrate/20120425065453_add_supplier_to_product.rb delete mode 100644 db/migrate/20120429071654_replace_spree_address_from_supplier.rb delete mode 100644 db/migrate/20120520062059_rename_state_events_to_state_changes.spree.rb delete mode 100644 db/migrate/20120520062060_migrate_images_from_products_to_variants.spree.rb delete mode 100644 db/migrate/20120520062061_rename_attachment_size_to_attachment_file_size.spree.rb delete mode 100644 db/migrate/20120618061537_move_distributor_from_order_to_product.rb delete mode 100644 db/migrate/20120621064227_add_distributor_id_to_order.rb delete mode 100644 db/migrate/20120626013846_extract_distributor_and_supplier_address_to_spree_address.rb delete mode 100644 db/migrate/20120626233350_rename_distributors_products_to_product_distributions.rb delete mode 100644 db/migrate/20120629043042_increase_scale_of_tax_rate_amount.spree.rb delete mode 100644 db/migrate/20120629043043_add_reset_password_sent_at_to_spree_users.spree_auth.rb delete mode 100644 db/migrate/20120629043045_resize_api_key_field.spree_api.rb delete mode 100644 db/migrate/20120629043647_create_paypal_accounts.spree_paypal_express.rb delete mode 100644 db/migrate/20120629043648_namespace_paypal_accounts.spree_paypal_express.rb delete mode 100644 db/migrate/20120702020402_add_next_collection_at_to_distributors.rb delete mode 100644 db/migrate/20120802031147_add_group_buy_fields.rb delete mode 100644 db/migrate/20120913054657_convert_sales_tax_to_default_tax.spree.rb delete mode 100644 db/migrate/20120913054658_add_deleted_at_to_spree_shipping_methods.spree.rb delete mode 100644 db/migrate/20120913054659_make_users_email_index_unique.spree.rb delete mode 100644 db/migrate/20120913054660_add_counter_cache_to_zone_members.spree.rb delete mode 100644 db/migrate/20120919013335_add_shipping_method_to_line_items.rb delete mode 100644 db/migrate/20121005015852_populate_order_default_shipping_method.rb delete mode 100644 db/migrate/20121009232513_create_cms.rb delete mode 100644 db/migrate/20121010004400_add_long_description_to_distributors_and_suppliers.rb delete mode 100644 db/migrate/20121018002907_add_group_buy_unit_size_to_products.rb delete mode 100644 db/migrate/20121025012233_combine_suppliers_and_distributors_into_enterprises.rb delete mode 100644 db/migrate/20121028070200_remove_pickup_address_from_enterprises.rb delete mode 100644 db/migrate/20121031203807_change_group_buy_unit_size_from_string_to_float.rb delete mode 100644 db/migrate/20121031222403_remove_suppliers_and_distributors.rb delete mode 100644 db/migrate/20121115010717_create_enterprise_fees.rb delete mode 100644 db/migrate/20121125232613_create_order_cycles.rb delete mode 100644 db/migrate/20130118031610_change_exchange_pickup_time_to_string.rb delete mode 100644 db/migrate/20130130204355_add_order_cycle_id_to_orders.rb delete mode 100644 db/migrate/20130207043036_create_tokenized_permissions_table.spree.rb delete mode 100644 db/migrate/20130207043037_rename_creditcards_to_credit_cards.spree.rb delete mode 100644 db/migrate/20130207043038_remove_credit_total_from_orders.spree.rb delete mode 100644 db/migrate/20130207043039_add_tax_rate_label.spree.rb delete mode 100644 db/migrate/20130207043040_add_toggle_tax_rate_display.spree.rb delete mode 100644 db/migrate/20130207043041_add_lock_version_to_variant.spree.rb delete mode 100644 db/migrate/20130207043042_remove_not_null_constraint_from_products_on_hand.spree.rb delete mode 100644 db/migrate/20130207043043_add_position_to_taxonomies.spree.rb delete mode 100644 db/migrate/20130207043044_add_identifier_to_spree_payments.spree.rb delete mode 100644 db/migrate/20130207043046_rename_api_key_to_spree_api_key.spree_api.rb delete mode 100644 db/migrate/20130207043047_create_users.spree_auth.rb delete mode 100644 db/migrate/20130207043541_spree_one_two.spree.rb delete mode 100644 db/migrate/20130207043542_remove_unused_preference_columns.spree.rb delete mode 100644 db/migrate/20130207043543_add_states_required_to_countries.spree.rb delete mode 100644 db/migrate/20130207043544_add_on_demand_to_product_and_variant.spree.rb delete mode 100644 db/migrate/20130207043545_split_prices_from_variants.spree.rb delete mode 100644 db/migrate/20130207043546_remove_not_null_from_spree_prices_amount.spree.rb delete mode 100644 db/migrate/20130207043547_add_currency_to_line_items.spree.rb delete mode 100644 db/migrate/20130207043548_add_currency_to_orders.spree.rb delete mode 100644 db/migrate/20130207043549_add_cost_currency_to_variants.spree.rb delete mode 100644 db/migrate/20130207043550_remove_display_on_from_payment_methods.spree.rb delete mode 100644 db/migrate/20130207043551_add_last_ip_to_spree_orders.spree.rb delete mode 100644 db/migrate/20130207043552_add_display_on_to_spree_payment_methods.spree.rb delete mode 100644 db/migrate/20130207043553_add_position_to_product_properties.spree.rb delete mode 100644 db/migrate/20130207043554_add_api_key_to_spree_users.spree_api.rb delete mode 100644 db/migrate/20130207043555_spree_promo_one_two.spree_promo.rb delete mode 100644 db/migrate/20130426023034_add_distributor_info_to_enterprises.enterprises_distributor_info_rich_text_feature.rb delete mode 100644 db/migrate/20130629120633_add_order_id_index_to_payments.spree.rb delete mode 100644 db/migrate/20130629120634_add_primary_to_spree_products_taxons.spree.rb delete mode 100644 db/migrate/20130629120635_add_order_id_index_to_shipments.spree.rb delete mode 100644 db/migrate/20130629120636_change_meta_description_on_spree_products_to_text.spree.rb delete mode 100644 db/migrate/20130629120637_add_variant_id_index_to_spree_prices.spree.rb delete mode 100644 db/migrate/20130629120638_change_orders_total_precision.spree.rb delete mode 100644 db/migrate/20130629120639_change_spree_payments_amount_precision.spree.rb delete mode 100644 db/migrate/20130629120640_change_spree_return_authorization_amount_precision.spree.rb delete mode 100644 db/migrate/20130629120641_change_adjustments_amount_precision.spree.rb delete mode 100644 db/migrate/20130629120642_add_seo_metas_to_taxons.spree.rb delete mode 100644 db/migrate/20130629120643_add_cvv_result_code_and_cvv_result_message_to_spree_payments.spree.rb delete mode 100644 db/migrate/20130629120644_add_unique_index_to_permalink_on_spree_products.spree.rb delete mode 100644 db/migrate/20130629120645_add_unique_index_to_orders_shipments_and_stock_transfers.spree.rb delete mode 100644 db/migrate/20130729021924_make_order_cycle_coordinator_fees_mtm.rb delete mode 100644 db/migrate/20130729030515_add_enterprise_role.rb delete mode 100644 db/migrate/20130801005801_create_landing_page_images.rb delete mode 100644 db/migrate/20130801012854_add_attachment_photo_to_landing_page_image.rb delete mode 100644 db/migrate/20130805050109_update_line_item_caching.rb delete mode 100644 db/migrate/20130805232516_add_enterprise_fee_to_product_distributions.rb delete mode 100644 db/migrate/20130806055125_create_suburbs.rb delete mode 100644 db/migrate/20130807002915_add_latitude_and_longitude_to_addresses.rb delete mode 100644 db/migrate/20130807062657_add_distributor_id_to_payment_method.rb delete mode 100644 db/migrate/20130807230834_add_cart.rb delete mode 100644 db/migrate/20130809045637_create_enterprise_fee_records_for_product_distributions.rb delete mode 100644 db/migrate/20130809075103_create_adjustment_metadata.rb delete mode 100644 db/migrate/20130812233634_remove_shipping_method_from_product_distribution.rb delete mode 100644 db/migrate/20130814010857_remove_shipping_methods_using_itemwise_calculator.rb delete mode 100644 db/migrate/20130830012138_add_distributor_id_to_shipping_methods.rb delete mode 100644 db/migrate/20130912021553_create_distributors_payment_methods.rb delete mode 100644 db/migrate/20130912021938_remove_distributor_id_from_payment_method.rb delete mode 100644 db/migrate/20130919010513_ensure_shipping_methods_have_distributors.rb delete mode 100644 db/migrate/20131016230055_convert_shipping_methods_distributors_to_habtm.rb delete mode 100644 db/migrate/20131024005253_create_enterprise_groups.rb delete mode 100644 db/migrate/20131030031125_add_position_to_enterprise_groups.rb delete mode 100644 db/migrate/20131128034556_setup_product_units_and_values.rb delete mode 100644 db/migrate/20140110040238_make_unit_description_default_blank.rb delete mode 100644 db/migrate/20140116030500_add_attachment_logo_to_enterprise.rb delete mode 100644 db/migrate/20140121050239_add_attachment_promo_image_to_enterprise.rb delete mode 100644 db/migrate/20140204011203_add_notes_to_products.rb delete mode 100644 db/migrate/20140213003443_add_require_ship_address_to_shipping_methods.rb delete mode 100644 db/migrate/20140324025840_add_incoming_to_exchanges.rb delete mode 100644 db/migrate/20140402032034_add_missing_indexes.rb delete mode 100644 db/migrate/20140402033428_add_foreign_keys.rb delete mode 100644 db/migrate/20140425055718_add_active_flag_to_enterprises.rb delete mode 100644 db/migrate/20140430020639_rename_active_to_visible_on_enterprises.rb delete mode 100644 db/migrate/20140514044959_create_enterprise_relationships.rb delete mode 100644 db/migrate/20140516042552_add_attachment_promo_image_to_enterprise_group.rb delete mode 100644 db/migrate/20140516044750_add_fields_to_groups.rb delete mode 100644 db/migrate/20140516045323_add_attachment_logo_to_enterprise_group.rb delete mode 100644 db/migrate/20140522015012_add_social_media_to_enterprises.rb delete mode 100644 db/migrate/20140522044009_add_primary_taxon_to_products.rb delete mode 100644 db/migrate/20140604051248_add_display_name_and_display_as_to_spree_variants.rb delete mode 100644 db/migrate/20140612020206_remove_deleted_variants_from_order_cycles.rb delete mode 100644 db/migrate/20140613004344_create_producer_properties.rb delete mode 100644 db/migrate/20140621230121_change_suburb_postcode_to_string.rb delete mode 100644 db/migrate/20140702053145_add_fields_to_distributors_shipping_methods.rb delete mode 100644 db/migrate/20140716051214_drop_landing_page_images.rb delete mode 100644 db/migrate/20140723021730_create_spree_paypal_express_checkouts.spree_paypal_express.rb delete mode 100644 db/migrate/20140723021731_add_transaction_id_to_spree_paypal_express_checkouts.spree_paypal_express.rb delete mode 100644 db/migrate/20140723021732_add_state_to_spree_paypal_express_checkouts.spree_paypal_express.rb delete mode 100644 db/migrate/20140723021733_add_refunded_fields_to_spree_paypal_express_checkouts.spree_paypal_express.rb delete mode 100644 db/migrate/20140723023713_switch_paypal_methods.rb delete mode 100644 db/migrate/20140815053659_add_unique_constraint_to_enterprise_roles.rb delete mode 100644 db/migrate/20140815065014_add_type_to_enterprises.rb delete mode 100644 db/migrate/20140825023227_create_enterprise_relationship_permissions.rb delete mode 100644 db/migrate/20140826043521_prevent_duplicate_enterprise_roles.rb delete mode 100644 db/migrate/20140828023619_add_owner_to_enterprise.rb delete mode 100644 db/migrate/20140904003026_add_enterprise_limit_to_spree_users.rb delete mode 100644 db/migrate/20140927005000_add_dummy_for_missing_emails.rb delete mode 100644 db/migrate/20140927005043_enterprise_config_refactor.rb delete mode 100644 db/migrate/20141003060622_add_standard_variant_to_products.rb delete mode 100644 db/migrate/20141010043405_add_confirmable_to_enterprise.rb delete mode 100644 db/migrate/20141022050659_add_shop_trial_start_date_to_enterprises.rb delete mode 100644 db/migrate/20141023050324_add_producer_profile_only_to_enterprises.rb delete mode 100644 db/migrate/20141113053004_create_variant_overrides.rb delete mode 100644 db/migrate/20141210233407_add_not_null_to_variant_override_relations.rb delete mode 100644 db/migrate/20141219034321_add_permalink_to_enterprises.rb delete mode 100644 db/migrate/20141229094516_add_receival_time_to_exchange.rb delete mode 100644 db/migrate/20150115050935_add_addresses_ref_to_enterprise_groups.rb delete mode 100644 db/migrate/20150115050936_add_address_instances_to_existing_enterprise_groups.rb delete mode 100644 db/migrate/20150121030627_add_web_contact_to_enterprise_groups.rb delete mode 100644 db/migrate/20150122145607_create_customers.rb delete mode 100644 db/migrate/20150202000203_add_owner_to_enterprise_groups.rb delete mode 100644 db/migrate/20150216075336_add_temperature_controlled_to_spree_shipping_categories.rb delete mode 100644 db/migrate/20150219021742_add_owner_index_to_enterprise_groups.rb delete mode 100644 db/migrate/20150220035501_add_address_id_index_to_enterprise_groups.rb delete mode 100644 db/migrate/20150225111538_add_tax_category_to_enterprise_fee.rb delete mode 100644 db/migrate/20150225232938_add_included_tax_to_adjustments.rb delete mode 100644 db/migrate/20150305004846_add_weight_to_line_items.rb delete mode 100644 db/migrate/20150407234739_add_charges_sales_tax_to_enterprises.rb delete mode 100644 db/migrate/20150410043302_create_delayed_jobs.rb delete mode 100644 db/migrate/20150422014819_add_inherits_properties_to_product.rb delete mode 100644 db/migrate/20150424025907_add_default_and_not_null_to_producer_properties_position.rb delete mode 100644 db/migrate/20150424151117_populate_line_item_unit_value.rb delete mode 100644 db/migrate/20150508030520_acts_as_taggable_on_migration.acts_as_taggable_on_engine.rb delete mode 100644 db/migrate/20150508030521_add_missing_unique_indices.acts_as_taggable_on_engine.rb delete mode 100644 db/migrate/20150508030522_add_taggings_counter_cache_to_tags.acts_as_taggable_on_engine.rb delete mode 100644 db/migrate/20150508030523_add_missing_taggable_index.acts_as_taggable_on_engine.rb delete mode 100644 db/migrate/20150508030524_change_collation_for_tag_names.acts_as_taggable_on_engine.rb delete mode 100644 db/migrate/20150508072454_remove_customer_code_not_null_constraint.rb delete mode 100644 db/migrate/20150508072938_add_customer_to_orders.rb delete mode 100644 db/migrate/20150527004427_add_permalink_to_groups.rb delete mode 100644 db/migrate/20150603001843_add_unique_index_to_enterprise_permalink.rb delete mode 100644 db/migrate/20150604045725_add_sessions_table.rb delete mode 100644 db/migrate/20150605052516_dependent_delete_adjustment_metadata.rb delete mode 100644 db/migrate/20150612045544_make_enterprises_name_unique.rb delete mode 100644 db/migrate/20150619020711_create_versions.rb delete mode 100644 db/migrate/20150619100137_create_bill_items.rb delete mode 100644 db/migrate/20150626090338_rename_bill_items_to_billable_periods.rb delete mode 100644 db/migrate/20150701034055_add_timestamps_to_billable_periods.rb delete mode 100644 db/migrate/20150719111807_add_default_stock_to_variant_overrides.rb delete mode 100644 db/migrate/20150719153136_rename_line_item_unit_value.rb delete mode 100644 db/migrate/20150719153732_update_precision_on_line_item_final_weight_volume.rb delete mode 100644 db/migrate/20150730160010_update_spree_line_item_final_weight_volume.rb delete mode 100644 db/migrate/20150827194622_add_enable_reset_to_variant_overrides.rb delete mode 100644 db/migrate/20150916012814_create_account_invoices.rb delete mode 100644 db/migrate/20150916061809_add_account_invoice_to_billable_periods.rb delete mode 100644 db/migrate/20150924054538_add_option_values_line_items_join_table.rb delete mode 100644 db/migrate/20151002020537_ensure_address_for_account_invoice_orders.rb delete mode 100644 db/migrate/20151125051510_combine_exchange_receival_time_receival_instructions.rb delete mode 100644 db/migrate/20151126235409_add_on_demand_and_sku_to_variant_overrides.rb delete mode 100644 db/migrate/20151128185900_rename_enable_reset_to_resettable.rb delete mode 100644 db/migrate/20160114001844_create_inventory_items.rb delete mode 100644 db/migrate/20160116024333_create_column_preferences.rb delete mode 100644 db/migrate/20160204013914_add_id_to_coordinator_fees.rb delete mode 100644 db/migrate/20160204031816_add_inherits_tax_category_to_enterprise_fees.rb delete mode 100644 db/migrate/20160205044930_add_email_address_to_enterprises.rb delete mode 100644 db/migrate/20160212092908_set_enterprise_email_address.rb delete mode 100644 db/migrate/20160218235221_populate_inventories.rb delete mode 100644 db/migrate/20160224034034_grant_explicit_variant_override_permissions.rb delete mode 100644 db/migrate/20160224230143_add_permission_revoked_at_to_variant_overrides.rb delete mode 100644 db/migrate/20160302044850_repopulate_inventories.rb delete mode 100644 db/migrate/20160303004210_create_tag_rules.rb delete mode 100644 db/migrate/20160316051131_add_require_login_to_enterprise.rb delete mode 100644 db/migrate/20160401043927_change_value_type_of_paypal_passwords.rb delete mode 100644 db/migrate/20160520065217_add_is_default_to_tag_rule.rb delete mode 100644 db/migrate/20160527012603_add_priority_to_tag_rule.rb delete mode 100644 db/migrate/20160630052453_create_schedules.rb delete mode 100644 db/migrate/20160630055825_create_order_cycle_schedules.rb delete mode 100644 db/migrate/20160707023818_drop_cms.rb delete mode 100644 db/migrate/20160713003535_add_bill_address_and_ship_address_to_customer.rb delete mode 100644 db/migrate/20160713013358_add_name_to_customer.rb delete mode 100644 db/migrate/20160819045727_create_standing_orders.rb delete mode 100644 db/migrate/20160819065331_swap_calculator_to_flat_percent_per_item.rb delete mode 100644 db/migrate/20160824013751_create_standing_line_items.rb delete mode 100644 db/migrate/20160828115018_create_stripe_accounts.rb delete mode 100644 db/migrate/20160916024535_add_state_to_spree_adjustments.spree.rb delete mode 100644 db/migrate/20160921060442_add_allow_guest_orders_to_enterprise.rb delete mode 100644 db/migrate/20161012022142_add_allow_order_changes_to_enterprise.rb delete mode 100644 db/migrate/20161014000216_add_ship_and_bill_address_to_standing_orders.rb delete mode 100644 db/migrate/20161020012017_create_standing_order_orders.rb delete mode 100644 db/migrate/20161110002554_add_standing_orders_placed_at_to_order_cycles.rb delete mode 100644 db/migrate/20161130001339_add_price_estimate_to_standing_line_items.rb delete mode 100644 db/migrate/20161206232009_add_canceled_at_to_standing_orders.rb delete mode 100644 db/migrate/20161207040232_rename_standing_order_orders_cancelled_at.rb delete mode 100644 db/migrate/20161207042153_add_paused_at_to_standing_orders.rb delete mode 100644 db/migrate/20161208233703_add_standing_orders_confirmed_at_to_order_cycles.rb delete mode 100644 db/migrate/20161210225156_rename_standing_order_orders_to_proxy_orders.rb delete mode 100644 db/migrate/20161210235939_add_order_cycle_id_to_proxy_orders.rb delete mode 100644 db/migrate/20161211210859_remove_proxy_order_order_not_null_constraint.rb delete mode 100644 db/migrate/20161215032136_add_enable_standing_orders_to_enterprises.rb delete mode 100644 db/migrate/20161215230219_add_invoice_text_and_invoice_logo_to_enterprises.rb delete mode 100644 db/migrate/20161222022340_add_placed_at_and_confirmed_at_to_proxy_orders.rb delete mode 100644 db/migrate/20170225203658_add_user_id_to_spree_credit_cards.rb delete mode 100644 db/migrate/20170304151129_add_payment_method_to_spree_credit_cards.rb delete mode 100644 db/migrate/20170310231746_add_import_date_to_spree_variants.rb delete mode 100644 db/migrate/20170314132401_add_import_date_to_variant_overrides.rb delete mode 100644 db/migrate/20170413074528_rename_payment_methods.spree_paypal_express.rb delete mode 100644 db/migrate/20170413083148_add_tracking_url_to_spree_shipping_methods.spree.rb delete mode 100644 db/migrate/20170512115519_add_locale_to_spree_users.rb delete mode 100644 db/migrate/20170710145821_add_confirmable_to_user.rb delete mode 100644 db/migrate/20170719125120_remove_confirmable_from_enterprises.rb delete mode 100644 db/migrate/20170727104900_add_receives_notifications_to_enterprise_roles.rb delete mode 100644 db/migrate/20170728140134_remove_email_from_enterprises.rb delete mode 100644 db/migrate/20170913205345_change_default_value_of_spree_users_enterprise_limit.rb delete mode 100644 db/migrate/20170921065259_update_adjustment_states.spree.rb delete mode 100644 db/migrate/20171027005930_add_credit_card_to_standing_orders.rb delete mode 100644 db/migrate/20180202024104_rename_standing_orders_to_subscriptions.rb delete mode 100644 db/migrate/20180204235108_rename_standing_line_items_to_subscription_line_items.rb delete mode 100644 db/migrate/20180222231639_add_shipping_fee_estimate_and_payment_fee_estimate_to_subscription.rb delete mode 100644 db/migrate/20180316034336_remove_placed_at_and_confirmed_at_from_order_cycles.rb delete mode 100644 db/migrate/20180406045821_add_charges_allowed_to_customers.rb delete mode 100644 db/migrate/20180418025217_add_is_default_to_credit_card.rb delete mode 100644 db/migrate/20180426145630_create_spree_stock_items.spree.rb delete mode 100644 db/migrate/20180426145631_create_spree_stock_locations.spree.rb delete mode 100644 db/migrate/20180426145632_create_default_stock.spree.rb delete mode 100644 db/migrate/20180426145633_add_stock_location_id_to_spree_shipments.spree.rb delete mode 100644 db/migrate/20180426145634_add_pending_to_inventory_unit.spree.rb delete mode 100644 db/migrate/20180426145635_remove_on_demand_from_product_and_variant.spree.rb delete mode 100644 db/migrate/20180426145636_create_shipping_method_zone.spree.rb delete mode 100644 db/migrate/20180426145637_remove_shipping_category_id_from_shipping_method.spree.rb delete mode 100644 db/migrate/20180426145638_create_shipping_method_categories.spree.rb delete mode 100644 db/migrate/20180426145639_create_spree_shipping_rates.spree.rb delete mode 100644 db/migrate/20180426145640_remove_category_match_attributes_from_shipping_method.spree.rb delete mode 100644 db/migrate/20180426145641_create_stock_movements.spree.rb delete mode 100644 db/migrate/20180426145642_add_address_fields_to_stock_location.spree.rb delete mode 100644 db/migrate/20180426145643_add_active_field_to_stock_locations.spree.rb delete mode 100644 db/migrate/20180426145644_add_backorderable_to_stock_item.spree.rb delete mode 100644 db/migrate/20180426145645_add_default_quantity_to_stock_movement.spree.rb delete mode 100644 db/migrate/20180426145646_add_source_and_destination_to_stock_movements.spree.rb delete mode 100644 db/migrate/20180426145647_add_originator_to_stock_movement.spree.rb delete mode 100644 db/migrate/20180426145648_drop_source_and_destination_from_stock_movement.spree.rb delete mode 100644 db/migrate/20180426145649_migrate_inventory_unit_sold_to_on_hand.spree.rb delete mode 100644 db/migrate/20180426145650_add_stock_location_to_rma.spree.rb delete mode 100644 db/migrate/20180426145651_update_shipment_state_for_canceled_orders.spree.rb delete mode 100644 db/migrate/20180426145652_remove_stock_item_and_variant_lock.spree.rb delete mode 100644 db/migrate/20180426145653_add_shipping_rates_to_shipments.spree.rb delete mode 100644 db/migrate/20180426145654_create_spree_stock_transfers.spree.rb delete mode 100644 db/migrate/20180426145655_drop_products_count_on_hand.spree.rb delete mode 100644 db/migrate/20180426145656_set_default_shipping_rate_cost.spree.rb delete mode 100644 db/migrate/20180426145657_add_number_to_stock_transfer.spree.rb delete mode 100644 db/migrate/20180426145658_add_sku_index_to_spree_variants.spree.rb delete mode 100644 db/migrate/20180426145659_add_backorderable_default_to_spree_stock_location.spree.rb delete mode 100644 db/migrate/20180426145660_add_propage_all_variants_to_spree_stock_location.spree.rb delete mode 100644 db/migrate/20180426145661_rename_shipping_methods_zones_to_spree_shipping_methods_zones.spree.rb delete mode 100644 db/migrate/20180426145662_add_deleted_at_to_spree_tax_rates.spree.rb delete mode 100644 db/migrate/20180426145663_remove_lock_version_from_inventory_units.spree.rb delete mode 100644 db/migrate/20180426145664_add_cost_price_to_line_item.spree.rb delete mode 100644 db/migrate/20180426145665_set_backorderable_to_default_to_false.spree.rb delete mode 100644 db/migrate/20180426145666_add_created_by_id_to_spree_orders.spree.rb delete mode 100644 db/migrate/20180426145667_index_completed_at_on_spree_orders.spree.rb delete mode 100644 db/migrate/20180426145668_add_tax_category_id_to_spree_line_items.spree.rb delete mode 100644 db/migrate/20180426145669_migrate_tax_categories_to_line_items.spree.rb delete mode 100644 db/migrate/20180510083800_remove_credit_card_from_subscriptions.rb delete mode 100644 db/migrate/20180812214434_drop_carts.rb delete mode 100644 db/migrate/20180906094641_add_uniqueness_of_variant_id_to_spree_stock_items.rb delete mode 100644 db/migrate/20180910155506_add_uniqueness_of_order_id_to_spree_shipments.rb delete mode 100644 db/migrate/20180919102548_remove_shipping_method_name_from_spree_line_items.rb delete mode 100644 db/migrate/20181008201815_update_instagram_data.rb delete mode 100644 db/migrate/20181010093850_fix_variants_missing_unit_value.rb delete mode 100644 db/migrate/20181020103501_revoke_variant_overrideswithout_permissions.rb delete mode 100644 db/migrate/20181031105158_allow_all_suppliers_own_variant_overrides.rb delete mode 100644 db/migrate/20181106162211_update_weight_calculator_type_class_name.rb delete mode 100644 db/migrate/20181123012635_associate_customers_to_users.rb create mode 100644 db/migrate/20181128054803_old_migrations_removed.rb delete mode 100644 db/migrate/20181128054803_simplify_variant_override_stock_settings.rb diff --git a/db/migrate/20120327000552_spree_zero_nine_zero.rb b/db/migrate/20120327000552_spree_zero_nine_zero.rb deleted file mode 100644 index bd40ead315..0000000000 --- a/db/migrate/20120327000552_spree_zero_nine_zero.rb +++ /dev/null @@ -1,389 +0,0 @@ -class SpreeZeroNineZero < ActiveRecord::Migration - # This is a legacy migration consolidating all of the database changes needed as of Spree 0.9.0 - # (See http://railsdog.lighthouseapp.com/projects/31096-spree/tickets/772) - - def change - create_table :addresses, :force => true do |t| - t.string :firstname, :lastname, :address1, :address2, :city, - :zipcode, :phone, :state_name, :alternative_phone - t.references :state - t.references :country - - t.timestamps - end - - create_table :adjustments, :force => true do |t| - t.integer :position, :adjustment_source_id - t.decimal :amount, :precision => 8, :scale => 2, :default => 0.0, :null => false - t.string :type, :description, :adjustment_source_type, :secondary_type - t.references :order - - t.timestamps - end - - create_table :assets, :force => true do |t| - t.integer :viewable_id, :attachment_width, :attachment_height, - :attachment_size, :position - t.string :viewable_type, :limit => 50 - t.string :attachment_content_type, :attachment_file_name - t.string :type, :limit => 75 - t.datetime :attachment_updated_at - end - - create_table :calculators, :force => true do |t| - t.string :type - t.integer :calculable_id, :null => false - t.string :calculable_type, :null => false - - t.timestamps - end - - create_table :checkouts, :force => true do |t| - t.references :order - t.string :email, :ip_address - t.text :special_instructions - t.integer :bill_address_id - t.datetime :completed_at - - t.timestamps - end - - create_table :configurations, :force => true do |t| - t.string :name - t.string :type, :limit => 50 - - t.timestamps - end - - add_index :configurations, [:name, :type], :name => 'index_configurations_on_name_and_type' - - create_table :countries, :force => true do |t| - t.string :iso_name, :iso, :iso3, :name - t.integer :numcode - end - - create_table :coupons, :force => true do |t| - t.string :code, :description - t.integer :usage_limit - t.boolean :combine - t.datetime :expires_at, :starts_at - - t.timestamps - end - - create_table :creditcard_txns, :force => true do |t| - t.integer :creditcard_payment_id, :txn_type - t.decimal :amount, :precision => 8, :scale => 2, :default => 0.0, :null => false - t.string :response_code - t.text :avs_response, :cvv_response - - t.timestamps - end - - create_table :creditcards, :force => true do |t| - t.text :number, :verification_value - t.string :month, :year, :cc_type, :display_number, :first_name, - :last_name, :start_month, :start_year, :issue_number - t.references :address - t.references :checkout - - t.timestamps - end - - create_table :gateway_configurations, :force => true do |t| - t.references :gateway - - t.timestamps - end - - create_table :gateway_option_values, :force => true do |t| - t.references :gateway_configuration - t.references :gateway_option - t.text :value - - t.timestamps - end - - create_table :gateway_options, :force => true do |t| - t.string :name - t.text :description - t.boolean :textarea, :default => false - t.references :gateway - - t.timestamps - end - - create_table :gateways, :force => true do |t| - t.string :clazz, :name - t.text :description - t.boolean :active - - t.timestamps - end - - create_table :inventory_units, :force => true do |t| - t.integer :lock_version, :default => 0 - t.string :state - t.references :variant - t.references :order - - t.timestamps - end - - create_table :line_items, :force => true do |t| - t.references :order - t.references :variant - t.integer :quantity, :null => false - t.decimal :price, :precision => 8, :scale => 2, :null => false - - t.timestamps - end - - add_index :line_items, :order_id, :name => 'index_line_items_on_order_id' - add_index :line_items, :variant_id, :name => 'index_line_items_on_variant_id' - - create_table :option_types, :force => true do |t| - t.string :name, :limit => 100 - t.string :presentation, :limit => 100 - - t.timestamps - end - - create_table :option_types_prototypes, :id => false, :force => true do |t| - t.references :prototype - t.references :option_type - end - - create_table :option_values, :force => true do |t| - t.integer :position - t.string :name, :presentation - t.references :option_type - - t.timestamps - end - - create_table :option_values_variants, :id => false, :force => true do |t| - t.integer :variant_id - t.integer :option_value_id - end - - add_index :option_values_variants, :variant_id, :name => 'index_option_values_variants_on_variant_id' - - create_table :orders, :force => true do |t| - t.string :number, :limit => 15 - t.decimal :item_total, :precision => 8, :scale => 2, :default => 0.0, :null => false - t.decimal :total, :precision => 8, :scale => 2, :default => 0.0, :null => false - t.string :state - t.string :token - t.decimal :adjustment_total, :precision => 8, :scale => 2, :default => 0.0, :null => false - t.decimal :credit_total, :precision => 8, :scale => 2, :default => 0.0, :null => false - t.references :user - - t.timestamps - end - - add_index :orders, :number, :name => 'index_orders_on_number' - - create_table :payments, :force => true do |t| - t.decimal :amount, :precision => 8, :scale => 2, :default => 0.0, :null => false - t.string :type - t.references :order - t.references :creditcard - - t.timestamps - end - - create_table :preferences, :force => true do |t| - t.string :attribute, :null => false, :limit => 100 - t.integer :owner_id, :null => false, :limit => 30 - t.string :owner_type, :null => false, :limit => 50 - t.integer :group_id - t.string :group_type, :limit => 50 - t.string :value - - t.timestamps - end - - add_index :preferences, [:owner_id, :owner_type, :attribute, :group_id, :group_type], :name => 'index_preferences_on_owner_and_attribute_and_preference', :unique => true - - create_table :product_option_types, :force => true do |t| - t.integer :position - t.references :product - t.references :option_type - - t.timestamps - end - - create_table :product_properties, :force => true do |t| - t.string :value - t.references :product - t.references :property - - t.timestamps - end - - create_table :products, :force => true do |t| - t.string :name, :default => '', :null => false - t.text :description - t.datetime :available_on, :deleted_at - t.string :permalink, :meta_description, :meta_keywords - t.references :tax_category - t.references :shipping_category - - t.timestamps - end - - add_index :products, :available_on, :name => 'index_products_on_available_on' - add_index :products, :deleted_at, :name => 'index_products_on_deleted_at' - add_index :products, :name, :name => 'index_products_on_name' - add_index :products, :permalink, :name => 'index_products_on_permalink' - - create_table :products_taxons, :id => false, :force => true do |t| - t.references :product - t.references :taxon - end - - add_index :products_taxons, :product_id, :name => 'index_products_taxons_on_product_id' - add_index :products_taxons, :taxon_id, :name => 'index_products_taxons_on_taxon_id' - - create_table :properties, :force => true do |t| - t.string :name - t.string :presentation, :null => false - - t.timestamps - end - - create_table :properties_prototypes, :id => false, :force => true do |t| - t.references :prototype - t.references :property - end - - create_table :prototypes, :force => true do |t| - t.string :name - - t.timestamps - end - - create_table :roles, :force => true do |t| - t.string :name - end - - create_table :roles_users, :id => false, :force => true do |t| - t.references :role - t.references :user - end - - add_index :roles_users, :role_id, :name => 'index_roles_users_on_role_id' - add_index :roles_users, :user_id, :name => 'index_roles_users_on_user_id' - - create_table :shipments, :force => true do |t| - t.string :tracking, :number - t.decimal :cost, :precision => 8, :scale => 2 - t.datetime :shipped_at - t.references :order - t.references :shipping_method - t.references :address - - t.timestamps - end - - create_table :shipping_categories, :force => true do |t| - t.string :name - - t.timestamps - end - - create_table :shipping_methods, :force => true do |t| - t.string :name - t.references :zone - - t.timestamps - end - - create_table :state_events, :force => true do |t| - t.string :name, :previous_state - t.references :order - t.references :user - - t.timestamps - end - - create_table :states, :force => true do |t| - t.string :name - t.string :abbr - t.references :country - end - - create_table :tax_categories, :force => true do |t| - t.string :name, :description - - t.timestamps - end - - create_table :tax_rates, :force => true do |t| - t.decimal :amount, :precision => 8, :scale => 4 - t.references :zone - t.references :tax_category - - t.timestamps - end - - create_table :taxonomies, :force => true do |t| - t.string :name, :null => false - - t.timestamps - end - - create_table :taxons, :force => true do |t| - t.integer :parent_id - t.integer :position, :default => 0 - t.string :name, :null => false - t.string :permalink - t.references :taxonomy - - t.timestamps - end - - create_table :users, :force => true do |t| - t.string :crypted_password, :limit => 128, :default => '', :null => false - t.string :salt, :limit => 128, :default => '', :null => false - t.string :email, :remember_token, :remember_token_expires_at, - :persistence_token, :single_access_token, :perishable_token - t.integer :login_count, :default => 0, :null => false - t.integer :failed_login_count, :default => 0, :null => false - t.datetime :last_request_at, :current_login_at, :last_login_at - t.string :current_login_ip, :last_login_ip, :login - t.integer :ship_address_id, :bill_address_id - - t.timestamps - end - - create_table :variants, :force => true do |t| - t.string :sku, :default => '', :null => false - t.decimal :price, :precision => 8, :scale => 2, :null => false - t.decimal :weight, :precision => 8, :scale => 2 - t.decimal :height, :precision => 8, :scale => 2 - t.decimal :width, :precision => 8, :scale => 2 - t.decimal :depth, :precision => 8, :scale => 2 - t.datetime :deleted_at - t.boolean :is_master, :default => false - t.references :product - end - - add_index :variants, :product_id, :name => 'index_variants_on_product_id' - - create_table :zone_members, :force => true do |t| - t.integer :zoneable_id - t.string :zoneable_type - t.references :zone - - t.timestamps - end - - create_table :zones, :force => true do |t| - t.string :name, :description - - t.timestamps - end - end -end diff --git a/db/migrate/20120327000553_create_indexes_for_inventory_units.rb b/db/migrate/20120327000553_create_indexes_for_inventory_units.rb deleted file mode 100644 index 6ce5048610..0000000000 --- a/db/migrate/20120327000553_create_indexes_for_inventory_units.rb +++ /dev/null @@ -1,6 +0,0 @@ -class CreateIndexesForInventoryUnits < ActiveRecord::Migration - def change - add_index :inventory_units, :variant_id - add_index :inventory_units, :order_id - end -end diff --git a/db/migrate/20120327000554_add_count_on_hand_to_variants_and_products.rb b/db/migrate/20120327000554_add_count_on_hand_to_variants_and_products.rb deleted file mode 100644 index 7341e5e268..0000000000 --- a/db/migrate/20120327000554_add_count_on_hand_to_variants_and_products.rb +++ /dev/null @@ -1,49 +0,0 @@ -class AddCountOnHandToVariantsAndProducts < ActiveRecord::Migration - def up - add_column :variants, :count_on_hand, :integer, :default => 0, :null => false - add_column :products, :count_on_hand, :integer, :default => 0, :null => false - - # Due to our namespacing changes, this migration (from earlier Spree versions) is broken - # To fix it, temporarily set table name on each of the models involved - # And then... - Spree::Variant.table_name = 'variants' - Spree::Product.table_name = 'products' - Spree::InventoryUnit.table_name = 'inventory_units' - - # In some cases needed to reflect changes in table structure - Spree::Variant.reset_column_information - Spree::Product.reset_column_information - - say_with_time 'Transfering inventory units with status on_hand to variants table...' do - Spree::Variant.all.each do |v| - v.update_attribute(:count_on_hand, v.inventory_units.with_state('on_hand').size) - Spree::InventoryUnit.destroy_all(:variant_id => v.id, :state => 'on_hand') - end - end - - say_with_time 'Updating products count on hand' do - Spree::Product.all.each do |p| - product_count_on_hand = p.has_variants? ? - p.variants.inject(0) { |acc, v| acc + v.count_on_hand } : - (p.master ? p.master.count_on_hand : 0) - p.update_attribute(:count_on_hand, product_count_on_hand) - end - end - - # ... Switch things back at the end of the migration - Spree::Variant.table_name = 'spree_variants' - Spree::Product.table_name = 'spree_products' - Spree::InventoryUnit.table_name = 'spree_inventory_units' - end - - def down - Spree::Variant.all.each do |v| - v.count_on_hand.times do - Spree::InventoryUnit.create(:variant => variant, :state => 'on_hand') - end - end - - remove_column :variants, :count_on_hand - remove_column :products, :count_on_hand - end -end diff --git a/db/migrate/20120327000555_change_taxons_to_nested_set.rb b/db/migrate/20120327000555_change_taxons_to_nested_set.rb deleted file mode 100644 index d00944142c..0000000000 --- a/db/migrate/20120327000555_change_taxons_to_nested_set.rb +++ /dev/null @@ -1,46 +0,0 @@ -class ChangeTaxonsToNestedSet < ActiveRecord::Migration - def up - add_column :taxons, :lft, :integer - add_column :taxons, :rgt, :integer - - Spree::Taxon.reset_column_information # So the new root ids get saved - - # Temporarily set the table back to taxons - Spree::Taxon.table_name = 'taxons' - - Spree::Taxon.class_eval do - # adapted from awesome nested set to use 'position' information - indices = {} - - left_column_name = 'lft' - right_column_name = 'rgt' - quoted_parent_column_name = 'parent_id' - scope = lambda{|node|} - - set_left_and_rights = lambda do |node| - # set left - node[left_column_name] = indices[scope.call(node)] += 1 - # find - where("#{quoted_parent_column_name} = ?", node).order('position ASC').each{ |n| set_left_and_rights.call(n) } - # set right - node[right_column_name] = indices[scope.call(node)] += 1 - node.save! - end - - # Find root node(s) - where("#{quoted_parent_column_name}" => nil).order('position ASC').each do |root_node| - # setup index for this scope - indices[scope.call(root_node)] ||= 0 - set_left_and_rights.call(root_node) - end - end - - # Set it back after the migration - Spree::Taxon.table_name = 'spree_taxons' - end - - def down - remove_column :taxons, :lft - remove_column :taxons, :rgt - end -end diff --git a/db/migrate/20120327000556_move_to_configurable_gateways.rb b/db/migrate/20120327000556_move_to_configurable_gateways.rb deleted file mode 100644 index a598cce828..0000000000 --- a/db/migrate/20120327000556_move_to_configurable_gateways.rb +++ /dev/null @@ -1,54 +0,0 @@ -class MoveToConfigurableGateways < ActiveRecord::Migration - def up - drop_table :gateways - drop_table :gateway_options - drop_table :gateway_option_values - drop_table :gateway_configurations - - create_table :gateways, :force => true do |t| - t.string :type, :name - t.text :description - t.boolean :active, :default => true - t.string :environment, :default => 'development' - t.string :server, :default => 'test' - t.boolean :test_mode, :default => true - - t.timestamps - end - end - - def down - drop_table :gateways - - create_table :gateway_configurations, :force => true do |t| - t.references :gateway - - t.timestamps - end - - create_table :gateway_option_values, :force => true do |t| - t.text :value - t.references :gateway_configuration - t.references :gateway_option - - t.timestamps - end - - create_table :gateway_options, :force => true do |t| - t.string :name - t.text :description - t.boolean :textarea, :default => false - t.references :gateway - - t.timestamps - end - - create_table :gateways, :force => true do |t| - t.string :clazz, :name - t.text :description - t.boolean :active - - t.timestamps - end - end -end diff --git a/db/migrate/20120327000557_product_groups_and_scopes.rb b/db/migrate/20120327000557_product_groups_and_scopes.rb deleted file mode 100644 index 00a82d0a2b..0000000000 --- a/db/migrate/20120327000557_product_groups_and_scopes.rb +++ /dev/null @@ -1,18 +0,0 @@ -class ProductGroupsAndScopes < ActiveRecord::Migration - def change - create_table :product_groups do |t| - t.string :name, :permalink, :order - end - - create_table :product_scopes do |t| - t.string :name - t.text :arguments - t.references :product_group - end - - add_index :product_groups, :name - add_index :product_groups, :permalink - add_index :product_scopes, :name - add_index :product_scopes, :product_group_id - end -end diff --git a/db/migrate/20120327000558_add_open_id_authentication_tables.rb b/db/migrate/20120327000558_add_open_id_authentication_tables.rb deleted file mode 100644 index fe20ab3ec2..0000000000 --- a/db/migrate/20120327000558_add_open_id_authentication_tables.rb +++ /dev/null @@ -1,15 +0,0 @@ -class AddOpenIdAuthenticationTables < ActiveRecord::Migration - def change - create_table :open_id_authentication_associations, :force => true do |t| - t.integer :issued, :lifetime - t.string :handle, :assoc_type - t.binary :server_url, :secret - end - - create_table :open_id_authentication_nonces, :force => true do |t| - t.integer :timestamp, :null => false - t.string :server_url, :null => true - t.string :salt, :null => false - end - end -end diff --git a/db/migrate/20120327000559_add_openid_field_to_users.rb b/db/migrate/20120327000559_add_openid_field_to_users.rb deleted file mode 100644 index 3ee6288692..0000000000 --- a/db/migrate/20120327000559_add_openid_field_to_users.rb +++ /dev/null @@ -1,24 +0,0 @@ -class AddOpenidFieldToUsers < ActiveRecord::Migration - def up - add_column :users, :openid_identifier, :string - add_index :users, :openid_identifier - - change_column :users, :login, :string, :default => nil, :null => true - change_column :users, :crypted_password, :string, :default => nil, :null => true - change_column :users, :salt, :string, :default => nil, :null => true - end - - def down - remove_column :users, :openid_identifier - - # Due to namespacing change, temporarily set the table back to users - Spree::User.table_name = 'users' - - [:login, :crypted_password, :salt].each do |field| - Spree::User.where(field => nil).each { |user| user.update_attribute(field, '') if user.send(field).nil? } - change_column :users, field, :string, :default => '', :null => false - end - - Spree::User.table_name = 'spree_users' - end -end diff --git a/db/migrate/20120327000560_change_preference_value_type.rb b/db/migrate/20120327000560_change_preference_value_type.rb deleted file mode 100644 index b0e1d07bab..0000000000 --- a/db/migrate/20120327000560_change_preference_value_type.rb +++ /dev/null @@ -1,10 +0,0 @@ -class ChangePreferenceValueType < ActiveRecord::Migration - def up - remove_index :preferences, :name => 'index_preferences_on_owner_and_attribute_and_preference' - change_column :preferences, :value, :text - end - - def down - change_column :preferences, :value, :string - end -end diff --git a/db/migrate/20120327000561_create_billing_integrations.rb b/db/migrate/20120327000561_create_billing_integrations.rb deleted file mode 100644 index c61e2e8932..0000000000 --- a/db/migrate/20120327000561_create_billing_integrations.rb +++ /dev/null @@ -1,12 +0,0 @@ -class CreateBillingIntegrations < ActiveRecord::Migration - def change - create_table :billing_integrations do |t| - t.string :type, :name - t.text :description - t.boolean :active, :default => true - t.string :environment, :default => 'development' - - t.timestamps - end - end -end diff --git a/db/migrate/20120327000562_charge_refactoring.rb b/db/migrate/20120327000562_charge_refactoring.rb deleted file mode 100644 index fdcd31abb0..0000000000 --- a/db/migrate/20120327000562_charge_refactoring.rb +++ /dev/null @@ -1,39 +0,0 @@ -class Checkout < ActiveRecord::Base; end; - -# Hack to prevent issues with legacy migrations -class Order < ActiveRecord::Base - has_one :checkout -end - -class ChargeRefactoring < ActiveRecord::Migration - def up - # Temporarily set table name for legacy support - Spree::Adjustment.table_name = 'adjustments' - - add_column :orders, :completed_at, :timestamp - Order.reset_column_information - Order.all.each { |o| o.update_attribute(:completed_at, o.checkout && o.checkout.read_attribute(:completed_at)) } - remove_column :checkouts, :completed_at - - change_column :adjustments, :amount, :decimal, :null => true, :default => nil, :precision => 8, :scale => 2 - Spree::Adjustment.update_all :type => 'secondary_type' - Spree::Adjustment.where(:type => 'Credit').update_all(:type => 'CouponCredit') - remove_column :adjustments, :secondary_type - - # Reset table name - Spree::Adjustment.table_name = 'spree_adjustments' - end - - def down - add_column :checkouts, :completed_at, :timestamp - Spree::Checkout.reset_column_information - Spree::Checkout.all.each { |c| c.update_attribute(:completed_at, c.order && c.order.completed_at) } - remove_column :orders, :completed_at - - add_column :adjustments, :secondary_type, :string - Spree::Adjustment.update_all :secondary_type => 'type' - Spree::Adjustment.where('type LIKE ?', '%Charge').update_all(:type => 'Charge') - Spree::Adjustment.where('type LIKE ?', '%Credit').update_all(:type => 'Credit') - change_column :adjustments, :amount, :decimal, :null => false, :default => 0, :precision => 8, :scale => 2 - end -end diff --git a/db/migrate/20120327000563_add_some_indexes.rb b/db/migrate/20120327000563_add_some_indexes.rb deleted file mode 100644 index ffb8495876..0000000000 --- a/db/migrate/20120327000563_add_some_indexes.rb +++ /dev/null @@ -1,11 +0,0 @@ -class AddSomeIndexes < ActiveRecord::Migration - def change - add_index :taxons, :permalink - add_index :taxons, :parent_id - add_index :taxons, :taxonomy_id - add_index :assets, :viewable_id - add_index :assets, [:viewable_type, :type] - add_index :product_properties, :product_id - add_index :option_values_variants, [:variant_id, :option_value_id] - end -end diff --git a/db/migrate/20120327000564_checkout_state_machine.rb b/db/migrate/20120327000564_checkout_state_machine.rb deleted file mode 100644 index c80323b30e..0000000000 --- a/db/migrate/20120327000564_checkout_state_machine.rb +++ /dev/null @@ -1,5 +0,0 @@ -class CheckoutStateMachine < ActiveRecord::Migration - def change - add_column :checkouts, :state, :string - end -end diff --git a/db/migrate/20120327000565_state_for_shipments.rb b/db/migrate/20120327000565_state_for_shipments.rb deleted file mode 100644 index b7a3bc4bba..0000000000 --- a/db/migrate/20120327000565_state_for_shipments.rb +++ /dev/null @@ -1,5 +0,0 @@ -class StateForShipments < ActiveRecord::Migration - def change - add_column :shipments, :state, :string - end -end diff --git a/db/migrate/20120327000566_make_state_events_polymorphic.rb b/db/migrate/20120327000566_make_state_events_polymorphic.rb deleted file mode 100644 index ed8cef3659..0000000000 --- a/db/migrate/20120327000566_make_state_events_polymorphic.rb +++ /dev/null @@ -1,12 +0,0 @@ -class MakeStateEventsPolymorphic < ActiveRecord::Migration - def up - rename_column :state_events, :order_id, :stateful_id - add_column :state_events, :stateful_type, :string - execute "UPDATE state_events SET stateful_type = 'Order'" - end - - def down - rename_column :state_events, :stateful_id, :order_id - remove_column :state_events, :stateful_type - end -end diff --git a/db/migrate/20120327000567_ship_address_id_for_checkouts.rb b/db/migrate/20120327000567_ship_address_id_for_checkouts.rb deleted file mode 100644 index c16f4c82c0..0000000000 --- a/db/migrate/20120327000567_ship_address_id_for_checkouts.rb +++ /dev/null @@ -1,5 +0,0 @@ -class ShipAddressIdForCheckouts < ActiveRecord::Migration - def change - add_column :checkouts, :ship_address_id, :integer - end -end diff --git a/db/migrate/20120327000568_shipping_method_id_for_checkouts.rb b/db/migrate/20120327000568_shipping_method_id_for_checkouts.rb deleted file mode 100644 index 6f8edd588a..0000000000 --- a/db/migrate/20120327000568_shipping_method_id_for_checkouts.rb +++ /dev/null @@ -1,5 +0,0 @@ -class ShippingMethodIdForCheckouts < ActiveRecord::Migration - def change - add_column :checkouts, :shipping_method_id, :integer - end -end diff --git a/db/migrate/20120327000569_creditcard_last_four_digits.rb b/db/migrate/20120327000569_creditcard_last_four_digits.rb deleted file mode 100644 index 922df48f8d..0000000000 --- a/db/migrate/20120327000569_creditcard_last_four_digits.rb +++ /dev/null @@ -1,14 +0,0 @@ -class CreditcardLastFourDigits < ActiveRecord::Migration - def up - rename_column :creditcards, :display_number, :last_digits - - creditcards = select_all "SELECT * FROM creditcards" - creditcards.each do |card| - execute "UPDATE creditcards SET last_digits = '#{card['last_digits'].gsub('XXXX-XXXX-XXXX-', '')}' WHERE id = #{card['id']}" if card['last_digits'].present? - end - end - - def down - rename_column :creditcards, :last_digits, :display_number - end -end diff --git a/db/migrate/20120327000570_populate_legacy_shipment_state.rb b/db/migrate/20120327000570_populate_legacy_shipment_state.rb deleted file mode 100644 index 2008e38817..0000000000 --- a/db/migrate/20120327000570_populate_legacy_shipment_state.rb +++ /dev/null @@ -1,15 +0,0 @@ -class PopulateLegacyShipmentState < ActiveRecord::Migration - def up - shipments = select_all "SELECT * FROM shipments" - shipments.each do |shipment| - if shipment['shipped_at'] - execute "UPDATE shipments SET state = 'shipped'" - else - execute "UPDATE shipments SET state = 'pending'" - end - end - end - - def down - end -end diff --git a/db/migrate/20120327000571_add_cost_price.rb b/db/migrate/20120327000571_add_cost_price.rb deleted file mode 100644 index 81dc8d25cb..0000000000 --- a/db/migrate/20120327000571_add_cost_price.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddCostPrice < ActiveRecord::Migration - def change - add_column :variants, :cost_price, :decimal, :null => true, :default => nil, :precision => 8, :scale => 2 - end -end diff --git a/db/migrate/20120327000572_shipment_id_for_inventory_units.rb b/db/migrate/20120327000572_shipment_id_for_inventory_units.rb deleted file mode 100644 index 93aec53f7e..0000000000 --- a/db/migrate/20120327000572_shipment_id_for_inventory_units.rb +++ /dev/null @@ -1,25 +0,0 @@ -class ShipmentIdForInventoryUnits < ActiveRecord::Migration - def up - add_column :inventory_units, :shipment_id, :integer - add_index :inventory_units, :shipment_id - - # migrate legacy shipments - Spree::Shipment.table_name = 'shipments' - - Spree::Shipment.all.each do |shipment| - unless shipment.order - puts "Warning: shipment has invalid order - #{shipment.id}" - next - end - shipment.order.inventory_units.each do |unit| - unit.update_attribute('shipment_id', shipment.id) - end - end - - Spree::Shipment.table_name = 'spree_shipments' - end - - def down - remove_column :inventory_units, :shipment_id - end -end diff --git a/db/migrate/20120327000573_cim_fields_for_creditcards.rb b/db/migrate/20120327000573_cim_fields_for_creditcards.rb deleted file mode 100644 index 417a9613c0..0000000000 --- a/db/migrate/20120327000573_cim_fields_for_creditcards.rb +++ /dev/null @@ -1,6 +0,0 @@ -class CimFieldsForCreditcards < ActiveRecord::Migration - def change - add_column :creditcards, :gateway_customer_profile_id, :string - add_column :creditcards, :gateway_payment_profile_id, :string - end -end diff --git a/db/migrate/20120327000574_create_return_authorizations.rb b/db/migrate/20120327000574_create_return_authorizations.rb deleted file mode 100644 index bb9fed3e00..0000000000 --- a/db/migrate/20120327000574_create_return_authorizations.rb +++ /dev/null @@ -1,12 +0,0 @@ -class CreateReturnAuthorizations < ActiveRecord::Migration - def change - create_table :return_authorizations do |t| - t.string :number, :state - t.decimal :amount, :precision => 8, :scale => 2, :default => 0.0, :null => false - t.references :order - t.text :reason - - t.timestamps - end - end -end diff --git a/db/migrate/20120327000575_add_return_authorization_to_inventory_units.rb b/db/migrate/20120327000575_add_return_authorization_to_inventory_units.rb deleted file mode 100644 index 49a55bc026..0000000000 --- a/db/migrate/20120327000575_add_return_authorization_to_inventory_units.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddReturnAuthorizationToInventoryUnits < ActiveRecord::Migration - def change - add_column :inventory_units, :return_authorization_id, :integer - end -end diff --git a/db/migrate/20120327000576_create_trackers.rb b/db/migrate/20120327000576_create_trackers.rb deleted file mode 100644 index e4e216213b..0000000000 --- a/db/migrate/20120327000576_create_trackers.rb +++ /dev/null @@ -1,10 +0,0 @@ -class CreateTrackers < ActiveRecord::Migration - def change - create_table :trackers do |t| - t.string :environment, :analytics_id - t.boolean :active, :default => true - - t.timestamps - end - end -end diff --git a/db/migrate/20120327000577_creditcard_id_for_creditcard_txns.rb b/db/migrate/20120327000577_creditcard_id_for_creditcard_txns.rb deleted file mode 100644 index 7190e0e711..0000000000 --- a/db/migrate/20120327000577_creditcard_id_for_creditcard_txns.rb +++ /dev/null @@ -1,5 +0,0 @@ -class CreditcardIdForCreditcardTxns < ActiveRecord::Migration - def change - add_column :creditcard_txns, :creditcard_id, :integer - end -end diff --git a/db/migrate/20120327000578_original_creditcard_txn_id_for_creditcard_txns.rb b/db/migrate/20120327000578_original_creditcard_txn_id_for_creditcard_txns.rb deleted file mode 100644 index 54160feac4..0000000000 --- a/db/migrate/20120327000578_original_creditcard_txn_id_for_creditcard_txns.rb +++ /dev/null @@ -1,5 +0,0 @@ -class OriginalCreditcardTxnIdForCreditcardTxns < ActiveRecord::Migration - def change - add_column :creditcard_txns, :original_creditcard_txn_id, :integer - end -end diff --git a/db/migrate/20120327000579_add_test_mode_to_billing_integration.rb b/db/migrate/20120327000579_add_test_mode_to_billing_integration.rb deleted file mode 100644 index aa1be7912b..0000000000 --- a/db/migrate/20120327000579_add_test_mode_to_billing_integration.rb +++ /dev/null @@ -1,6 +0,0 @@ -class AddTestModeToBillingIntegration < ActiveRecord::Migration - def change - add_column :billing_integrations, :test_mode, :boolean, :default => true - add_column :billing_integrations, :server, :string, :default => 'test' - end -end diff --git a/db/migrate/20120327000580_create_products_product_groups.rb b/db/migrate/20120327000580_create_products_product_groups.rb deleted file mode 100644 index aaa6533732..0000000000 --- a/db/migrate/20120327000580_create_products_product_groups.rb +++ /dev/null @@ -1,8 +0,0 @@ -class CreateProductsProductGroups < ActiveRecord::Migration - def change - create_table :product_groups_products, :id => false do |t| - t.references :product - t.references :product_group - end - end -end diff --git a/db/migrate/20120327000581_create_payment_methods.rb b/db/migrate/20120327000581_create_payment_methods.rb deleted file mode 100644 index 41145056e7..0000000000 --- a/db/migrate/20120327000581_create_payment_methods.rb +++ /dev/null @@ -1,16 +0,0 @@ -class CreatePaymentMethods < ActiveRecord::Migration - def change - create_table :payment_methods do |t| - t.string :type, :name - t.text :description - t.boolean :active, :default => true - t.string :environment, :default => 'development' - - t.timestamps - end - # TODO - also migrate any legacy configurations for gateways and billing integrations before dropping the old tables - # we probably also need to do this inside the payment_gateway extension b/c table won't exist yet in fresh bootstrap - #drop_table :billing_integrations - #drop_table :gateways - end -end diff --git a/db/migrate/20120327000582_polymorphic_payments.rb b/db/migrate/20120327000582_polymorphic_payments.rb deleted file mode 100644 index 33787c3d26..0000000000 --- a/db/migrate/20120327000582_polymorphic_payments.rb +++ /dev/null @@ -1,43 +0,0 @@ -# Legacy table support -class Checkout < ActiveRecord::Base; end; -class Spree::Creditcard < ActiveRecord::Base; end; - -class PolymorphicPayments < ActiveRecord::Migration - def up - remove_column :payments, :type - remove_column :payments, :creditcard_id - rename_column :payments, :order_id, :payable_id - change_table :payments do |t| - t.string :payable_type, :payment_method - t.references :source, :polymorphic => true - end - execute "UPDATE payments SET payable_type = 'Order'" - - Spree::Creditcard.table_name = 'creditcards' - - Spree::Creditcard.all.each do |creditcard| - if checkout = Checkout.find_by_id(creditcard.checkout_id) and checkout.order - if payment = checkout.order.payments.first - execute "UPDATE payments SET source_type = 'Creditcard', source_id = #{creditcard.id} WHERE id = #{payment.id}" - end - end - end - - Spree::Creditcard.table_name = 'spree_creditcards' - - remove_column :creditcards, :checkout_id - end - - def down - add_column :creditcards, :checkout_id, :integer - change_table :payments do |t| - t.remove :payable_type - t.remove :payment_method - t.remove :source_id - t.remove :source_type - end - rename_column :payments, :payable_id, :order_id - add_column :payments, :creditcard_id, :integer - add_column :payments, :type, :string - end -end diff --git a/db/migrate/20120327000583_change_payments_payment_method_to_belongs_to.rb b/db/migrate/20120327000583_change_payments_payment_method_to_belongs_to.rb deleted file mode 100644 index 456dace6e2..0000000000 --- a/db/migrate/20120327000583_change_payments_payment_method_to_belongs_to.rb +++ /dev/null @@ -1,11 +0,0 @@ -class ChangePaymentsPaymentMethodToBelongsTo < ActiveRecord::Migration - def up - remove_column :payments, :payment_method - add_column :payments, :payment_method_id, :integer - end - - def down - add_column :payments, :payment_method, :string - remove_column :payments, :payment_method_id - end -end diff --git a/db/migrate/20120327000584_assign_creditcard_txns_to_payment.rb b/db/migrate/20120327000584_assign_creditcard_txns_to_payment.rb deleted file mode 100644 index 562f60c7b0..0000000000 --- a/db/migrate/20120327000584_assign_creditcard_txns_to_payment.rb +++ /dev/null @@ -1,23 +0,0 @@ -class AssignCreditcardTxnsToPayment < ActiveRecord::Migration - def up - add_column :creditcard_txns, :payment_id, :integer - - # Temporarily set back to creditcards - Spree::Creditcard.table_name = 'creditcards' - - ActiveRecord::Base.connection.select_all('SELECT * FROM creditcard_txns').each do |txn_attrs| - if creditcard = Spree::Creditcard.find_by_id(txn_attrs['creditcard_id']) and creditcard.payments.first - execute "UPDATE creditcard_txns SET payment_id = #{creditcard.payments.first.id} WHERE id = #{txn_attrs['id']}" - end - end - - Spree::Creditcard.table_name = 'spree_creditcards' - - remove_column :creditcard_txns, :creditcard_payment_id - end - - def down - remove_column :creditcard_txns, :payment_id - add_column :creditcard_txns, :creditcard_payment_id, :integer - end -end diff --git a/db/migrate/20120327000585_sti_for_transactions.rb b/db/migrate/20120327000585_sti_for_transactions.rb deleted file mode 100644 index 5d44f725e9..0000000000 --- a/db/migrate/20120327000585_sti_for_transactions.rb +++ /dev/null @@ -1,15 +0,0 @@ -class StiForTransactions < ActiveRecord::Migration - def up - rename_table :creditcard_txns, :transactions - add_column :transactions, :type, :string - remove_column :transactions, :creditcard_id - - execute "UPDATE transactions SET type = 'CreditcardTxn'" - end - - def down - rename_table :transactions, :creditcard_txns - remove_column :transactions, :type - add_column :transactions, :creditcard_id, :integer - end -end diff --git a/db/migrate/20120327000586_drop_billing_integrations.rb b/db/migrate/20120327000586_drop_billing_integrations.rb deleted file mode 100644 index 362a4f6904..0000000000 --- a/db/migrate/20120327000586_drop_billing_integrations.rb +++ /dev/null @@ -1,16 +0,0 @@ -class DropBillingIntegrations < ActiveRecord::Migration - def up - drop_table :billing_integrations - end - - def down - create_table :billing_integrations do |t| - t.string :type, :name - t.text :description - t.boolean :active, :default => true - t.string :environment, :default => 'development' - - t.timestamps - end - end -end diff --git a/db/migrate/20120327000587_deleted_at_for_payment_methods.rb b/db/migrate/20120327000587_deleted_at_for_payment_methods.rb deleted file mode 100644 index 6283733f58..0000000000 --- a/db/migrate/20120327000587_deleted_at_for_payment_methods.rb +++ /dev/null @@ -1,14 +0,0 @@ -class DeletedAtForPaymentMethods < ActiveRecord::Migration - def up - change_table :payment_methods do |t| - t.timestamp :deleted_at, :default => nil - end - end - - def down - remove_column :payments_methods, :column_name - change_table :payment_methods do |t| - t.remove :deleted_at - end - end -end \ No newline at end of file diff --git a/db/migrate/20120327000588_add_adjustments_index.rb b/db/migrate/20120327000588_add_adjustments_index.rb deleted file mode 100644 index 559766d9bd..0000000000 --- a/db/migrate/20120327000588_add_adjustments_index.rb +++ /dev/null @@ -1,6 +0,0 @@ -class AddAdjustmentsIndex < ActiveRecord::Migration - def change - add_index :adjustments, :order_id - end -end - diff --git a/db/migrate/20120327000589_fix_by_popularity.rb b/db/migrate/20120327000589_fix_by_popularity.rb deleted file mode 100644 index 756b725bbe..0000000000 --- a/db/migrate/20120327000589_fix_by_popularity.rb +++ /dev/null @@ -1,9 +0,0 @@ -class FixByPopularity < ActiveRecord::Migration - def up - execute("UPDATE product_scopes SET name='descend_by_popularity' WHERE name='by_popularity'") - end - - def down - execute("UPDATE product_scopes SET name='by_popularity' WHERE name='descend_by_popularity'") - end -end diff --git a/db/migrate/20120327000590_add_alt_text_to_images.rb b/db/migrate/20120327000590_add_alt_text_to_images.rb deleted file mode 100644 index 69b9ce2e72..0000000000 --- a/db/migrate/20120327000590_add_alt_text_to_images.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddAltTextToImages < ActiveRecord::Migration - def change - add_column :assets, :alt, :text - end -end diff --git a/db/migrate/20120327000591_fix_existing_coupon_credits.rb b/db/migrate/20120327000591_fix_existing_coupon_credits.rb deleted file mode 100644 index 1f04087051..0000000000 --- a/db/migrate/20120327000591_fix_existing_coupon_credits.rb +++ /dev/null @@ -1,13 +0,0 @@ -class Adjustment < ActiveRecord::Base; end; - -class FixExistingCouponCredits < ActiveRecord::Migration - def up - execute("UPDATE adjustments SET type='PromotionCredit' WHERE type='CouponCredit'") - execute("UPDATE adjustments SET adjustment_source_type='Promotion' WHERE adjustment_source_type='Coupon'") - end - - def down - execute("UPDATE adjustments SET adjustment_source_type='Coupon' WHERE adjustment_source_type='Promotion'") - execute("UPDATE adjustments SET type='CouponCredit' WHERE type='PromotionCredit'") - end -end diff --git a/db/migrate/20120327000592_add_display_to_payment_methods.rb b/db/migrate/20120327000592_add_display_to_payment_methods.rb deleted file mode 100644 index a7097add2f..0000000000 --- a/db/migrate/20120327000592_add_display_to_payment_methods.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddDisplayToPaymentMethods < ActiveRecord::Migration - def change - add_column :payment_methods, :display, :string, :default => nil - end -end diff --git a/db/migrate/20120327000593_add_addresses_checkouts_indexes.rb b/db/migrate/20120327000593_add_addresses_checkouts_indexes.rb deleted file mode 100644 index 4a1c460bae..0000000000 --- a/db/migrate/20120327000593_add_addresses_checkouts_indexes.rb +++ /dev/null @@ -1,8 +0,0 @@ -class AddAddressesCheckoutsIndexes < ActiveRecord::Migration - def change - add_index :addresses, :firstname - add_index :addresses, :lastname - add_index :checkouts, :order_id - add_index :checkouts, :bill_address_id - end -end diff --git a/db/migrate/20120327000594_add_icon_to_taxons.rb b/db/migrate/20120327000594_add_icon_to_taxons.rb deleted file mode 100644 index 625c253779..0000000000 --- a/db/migrate/20120327000594_add_icon_to_taxons.rb +++ /dev/null @@ -1,17 +0,0 @@ -class AddIconToTaxons < ActiveRecord::Migration - def up - # skip this migration if the attribute already exists because of advanced taxon extension - return if column_exists?(:taxons, :icon_file_name) - add_column :taxons, :icon_file_name, :string - add_column :taxons, :icon_content_type, :string - add_column :taxons, :icon_file_size, :integer - add_column :taxons, :icon_updated_at, :datetime - end - - def down - remove_column :taxons, :icon_file_name - remove_column :taxons, :icon_content_type - remove_column :taxons, :icon_file_size - remove_column :taxons, :icon_updated_at - end -end diff --git a/db/migrate/20120327000595_add_description_to_taxons.rb b/db/migrate/20120327000595_add_description_to_taxons.rb deleted file mode 100644 index 287daad048..0000000000 --- a/db/migrate/20120327000595_add_description_to_taxons.rb +++ /dev/null @@ -1,11 +0,0 @@ -class AddDescriptionToTaxons < ActiveRecord::Migration - def up - # skip this migration if the attribute already exists because of advanced taxon extension - return if column_exists?(:taxons, :description) - add_column :taxons, :description, :text - end - - def down - remove_column :taxons, :description - end -end diff --git a/db/migrate/20120327000596_index_for_shipments_number.rb b/db/migrate/20120327000596_index_for_shipments_number.rb deleted file mode 100644 index c1a85d1d23..0000000000 --- a/db/migrate/20120327000596_index_for_shipments_number.rb +++ /dev/null @@ -1,5 +0,0 @@ -class IndexForShipmentsNumber < ActiveRecord::Migration - def change - add_index :shipments, :number - end -end diff --git a/db/migrate/20120327000597_add_index_on_users_persistence_token.rb b/db/migrate/20120327000597_add_index_on_users_persistence_token.rb deleted file mode 100644 index 9b4d65cb63..0000000000 --- a/db/migrate/20120327000597_add_index_on_users_persistence_token.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddIndexOnUsersPersistenceToken < ActiveRecord::Migration - def change - add_index :users, :persistence_token - end -end diff --git a/db/migrate/20120327000598_add_default_to_tax_categories.rb b/db/migrate/20120327000598_add_default_to_tax_categories.rb deleted file mode 100644 index 9845b90449..0000000000 --- a/db/migrate/20120327000598_add_default_to_tax_categories.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddDefaultToTaxCategories < ActiveRecord::Migration - def change - add_column :tax_categories, :is_default, :boolean, :default => false - end -end diff --git a/db/migrate/20120327000599_add_display_to_shipping_methods.rb b/db/migrate/20120327000599_add_display_to_shipping_methods.rb deleted file mode 100644 index ba3aa011ac..0000000000 --- a/db/migrate/20120327000599_add_display_to_shipping_methods.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddDisplayToShippingMethods < ActiveRecord::Migration - def change - add_column :shipping_methods, :display_on, :string, :default => nil - end -end diff --git a/db/migrate/20120327000600_rename_payment_method_display.rb b/db/migrate/20120327000600_rename_payment_method_display.rb deleted file mode 100644 index 1cc727bf9f..0000000000 --- a/db/migrate/20120327000600_rename_payment_method_display.rb +++ /dev/null @@ -1,5 +0,0 @@ -class RenamePaymentMethodDisplay < ActiveRecord::Migration - def change - rename_column :payment_methods, :display, :display_on - end -end diff --git a/db/migrate/20120327000601_rename_preferences_field.rb b/db/migrate/20120327000601_rename_preferences_field.rb deleted file mode 100644 index 19d67680c1..0000000000 --- a/db/migrate/20120327000601_rename_preferences_field.rb +++ /dev/null @@ -1,5 +0,0 @@ -class RenamePreferencesField < ActiveRecord::Migration - def change - rename_column :preferences, :attribute, :name - end -end diff --git a/db/migrate/20120327000602_add_guest_flag.rb b/db/migrate/20120327000602_add_guest_flag.rb deleted file mode 100644 index ec8cbf1156..0000000000 --- a/db/migrate/20120327000602_add_guest_flag.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddGuestFlag < ActiveRecord::Migration - def change - add_column :users, :guest, :boolean - end -end diff --git a/db/migrate/20120327000603_drop_order_token.rb b/db/migrate/20120327000603_drop_order_token.rb deleted file mode 100644 index 5738228ac0..0000000000 --- a/db/migrate/20120327000603_drop_order_token.rb +++ /dev/null @@ -1,9 +0,0 @@ -class DropOrderToken < ActiveRecord::Migration - def up - remove_column :orders, :token - end - - def down - add_column :orders, :token, :string - end -end diff --git a/db/migrate/20120327000604_payments_state_and_assigned_to_order_only.rb b/db/migrate/20120327000604_payments_state_and_assigned_to_order_only.rb deleted file mode 100644 index 69ee291859..0000000000 --- a/db/migrate/20120327000604_payments_state_and_assigned_to_order_only.rb +++ /dev/null @@ -1,14 +0,0 @@ -class PaymentsStateAndAssignedToOrderOnly < ActiveRecord::Migration - def up - # TODO: migrate existing payments - rename_column :payments, :payable_id, :order_id - remove_column :payments, :payable_type - add_column :payments, :state, :string - end - - def down - remove_column :payments, :state - add_column :payments, :payable_type, :string - rename_column :payments, :order_id, :payable_id - end -end diff --git a/db/migrate/20120327000605_create_address_keys_for_order.rb b/db/migrate/20120327000605_create_address_keys_for_order.rb deleted file mode 100644 index ee794c3e50..0000000000 --- a/db/migrate/20120327000605_create_address_keys_for_order.rb +++ /dev/null @@ -1,6 +0,0 @@ -class CreateAddressKeysForOrder < ActiveRecord::Migration - def change - add_column :orders, :bill_address_id, :integer - add_column :orders, :ship_address_id, :integer - end -end \ No newline at end of file diff --git a/db/migrate/20120327000606_payment_total_for_orders.rb b/db/migrate/20120327000606_payment_total_for_orders.rb deleted file mode 100644 index 9190e090af..0000000000 --- a/db/migrate/20120327000606_payment_total_for_orders.rb +++ /dev/null @@ -1,5 +0,0 @@ -class PaymentTotalForOrders < ActiveRecord::Migration - def change - add_column :orders, :payment_total, :decimal, :precision => 8, :scale => 2, :default => 0.0 - end -end diff --git a/db/migrate/20120327000607_shipping_method_id_for_orders.rb b/db/migrate/20120327000607_shipping_method_id_for_orders.rb deleted file mode 100644 index ec0bafb1be..0000000000 --- a/db/migrate/20120327000607_shipping_method_id_for_orders.rb +++ /dev/null @@ -1,5 +0,0 @@ -class ShippingMethodIdForOrders < ActiveRecord::Migration - def change - add_column :orders, :shipping_method_id, :integer - end -end diff --git a/db/migrate/20120327000608_add_shipment_and_payment_state.rb b/db/migrate/20120327000608_add_shipment_and_payment_state.rb deleted file mode 100644 index 240dc95776..0000000000 --- a/db/migrate/20120327000608_add_shipment_and_payment_state.rb +++ /dev/null @@ -1,6 +0,0 @@ -class AddShipmentAndPaymentState < ActiveRecord::Migration - def change - add_column :orders, :shipment_state, :string - add_column :orders, :payment_state, :string - end -end \ No newline at end of file diff --git a/db/migrate/20120327000609_refactor_adjustments.rb b/db/migrate/20120327000609_refactor_adjustments.rb deleted file mode 100644 index 77e01fc904..0000000000 --- a/db/migrate/20120327000609_refactor_adjustments.rb +++ /dev/null @@ -1,29 +0,0 @@ -class RefactorAdjustments < ActiveRecord::Migration - def up - change_table :adjustments do |t| - t.boolean :mandatory - t.boolean :frozen - t.rename :adjustment_source_id, :source_id - t.rename :adjustment_source_type, :source_type - t.references :originator - t.string :originator_type - t.remove :type - t.rename :description, :label - t.remove :position - end - end - - def down - change_table :adjustments do |t| - t.integer :position - t.rename :label, :description - t.string :type - t.remove :originator_type - t.remove :originator_id - t.rename :source_type, :adjustment_source_type - t.rename :source_id, :adjustment_source_id - t.remove :frozen - t.remove :mandatory - end - end -end diff --git a/db/migrate/20120327000610_response_code_and_avs_response_for_payments.rb b/db/migrate/20120327000610_response_code_and_avs_response_for_payments.rb deleted file mode 100644 index cc0f6c4164..0000000000 --- a/db/migrate/20120327000610_response_code_and_avs_response_for_payments.rb +++ /dev/null @@ -1,6 +0,0 @@ -class ResponseCodeAndAvsResponseForPayments < ActiveRecord::Migration - def change - add_column :payments, :response_code, :string - add_column :payments, :avs_response, :string - end -end diff --git a/db/migrate/20120327000611_change_guest_flag_to_anonymous.rb b/db/migrate/20120327000611_change_guest_flag_to_anonymous.rb deleted file mode 100644 index ca8ae7a3f7..0000000000 --- a/db/migrate/20120327000611_change_guest_flag_to_anonymous.rb +++ /dev/null @@ -1,5 +0,0 @@ -class ChangeGuestFlagToAnonymous < ActiveRecord::Migration - def change - rename_column :users, :guest, :anonymous - end -end diff --git a/db/migrate/20120327000612_email_for_orders.rb b/db/migrate/20120327000612_email_for_orders.rb deleted file mode 100644 index f766dca878..0000000000 --- a/db/migrate/20120327000612_email_for_orders.rb +++ /dev/null @@ -1,5 +0,0 @@ -class EmailForOrders < ActiveRecord::Migration - def change - add_column :orders, :email, :string - end -end diff --git a/db/migrate/20120327000613_create_mail_methods.rb b/db/migrate/20120327000613_create_mail_methods.rb deleted file mode 100644 index 0860607aa7..0000000000 --- a/db/migrate/20120327000613_create_mail_methods.rb +++ /dev/null @@ -1,10 +0,0 @@ -class CreateMailMethods < ActiveRecord::Migration - def change - create_table :mail_methods do |t| - t.string :environment - t.boolean :active, :default => true - - t.timestamps - end - end -end diff --git a/db/migrate/20120327000614_rename_frozen_to_locked.rb b/db/migrate/20120327000614_rename_frozen_to_locked.rb deleted file mode 100644 index fef534ab16..0000000000 --- a/db/migrate/20120327000614_rename_frozen_to_locked.rb +++ /dev/null @@ -1,5 +0,0 @@ -class RenameFrozenToLocked < ActiveRecord::Migration - def change - rename_column :adjustments, :frozen, :locked - end -end diff --git a/db/migrate/20120327000615_move_special_instructions_to_orders.rb b/db/migrate/20120327000615_move_special_instructions_to_orders.rb deleted file mode 100644 index 4d6b1f4aba..0000000000 --- a/db/migrate/20120327000615_move_special_instructions_to_orders.rb +++ /dev/null @@ -1,10 +0,0 @@ -class MoveSpecialInstructionsToOrders < ActiveRecord::Migration - def up - add_column :orders, :special_instructions, :text - execute "UPDATE orders SET special_instructions = (SELECT special_instructions FROM checkouts WHERE order_id = orders.id)" - end - - def down - remove_column :orders, :special_instructions, :text - end -end diff --git a/db/migrate/20120327000616_create_log_entries.rb b/db/migrate/20120327000616_create_log_entries.rb deleted file mode 100644 index 8a0d7f8d8a..0000000000 --- a/db/migrate/20120327000616_create_log_entries.rb +++ /dev/null @@ -1,11 +0,0 @@ -class CreateLogEntries < ActiveRecord::Migration - def change - create_table :log_entries do |t| - t.integer :source_id - t.string :source_type - t.text :details - - t.timestamps - end - end -end diff --git a/db/migrate/20120327000617_migrate_transactions_to_payment_state.rb b/db/migrate/20120327000617_migrate_transactions_to_payment_state.rb deleted file mode 100644 index 185953157b..0000000000 --- a/db/migrate/20120327000617_migrate_transactions_to_payment_state.rb +++ /dev/null @@ -1,98 +0,0 @@ -class Transaction < ActiveRecord::Base; end -class CreditcardTxn < Transaction; end - -class MigrateTransactionsToPaymentState < ActiveRecord::Migration - - AUTHORIZED=1 - COMPLETED=2 - PURCHASED=3 - VOIDED = 4 - CREDITED =5 - - PAYMENT_COMPLETE = 'completed' - PAYMENT_VOID = 'void' - PAYMENT_PENDING = 'pending' - - # Temporarily set the table back to payments - Spree::Payment.table_name = 'payments' - - def up - migrate_authorized_only_transactions - migrate_voided_transactions - migrate_completed_transactions - migrate_purchased_transactions - migrate_credited_transactions - - Spree::Payment.table_name = 'spree_payments' - end - - def migrate_credited_transactions - credited = Transaction.find_by_sql("SELECT * FROM transactions WHERE txn_type = #{CREDITED}") - credited.each do |tx| - payment = Spree::Payment.find(tx) - order = payment.order - order.create_payment( - :amount => tx.amount, - :source_id => payment.source_id, :source_type => 'Creditcard', - :payment_method_id => payment.payment_method_id, :state => PAYMENT_COMPLETE, - :avs_response => tx.avs_response, :response_code => tx.response_code - ) - end - credited.each { |rec| rec.destroy } - end - - def migrate_voided_transactions - voided = Transaction.find_by_sql("SELECT * FROM transactions WHERE txn_type = #{VOIDED}") - voided.each do |tx| - update_payment(tx, PAYMENT_VOID) - end - unless voided.empty? - all_but_credited = [AUTHORIZED, COMPLETED, PURCHASED, VOIDED] - voided_and_subsequent_transactions = Transaction.find_by_sql("SELECT * FROM transactions WHERE payment_id IN (#{voided.map(&:payment_id).join(',')}) AND txn_type IN (#{all_but_credited.join(',')})") - voided_and_subsequent_transactions.each { |rec| rec.destroy } - end - end - - def migrate_purchased_transactions - migrate_transactions(PURCHASED) - end - - def migrate_completed_transactions - migrate_transactions(COMPLETED) - end - - def migrate_transactions(type) - txs = Transaction.find_by_sql("SELECT * FROM transactions WHERE txn_type = #{type}") - txs.each do |tx| - update_payment(tx, PAYMENT_COMPLETE) - end - txs.each { |rec| rec.destroy } - end - - def migrate_authorized_only_transactions - if (ActiveRecord::Base.connection.adapter_name == 'PostgreSQL') - group_by_clause = 'GROUP BY transactions.' + Transaction.column_names.join(', transactions.') - else - group_by_clause = 'GROUP BY payment_id' - end - authorized_only = Transaction.find_by_sql("SELECT * FROM transactions #{group_by_clause} HAVING COUNT(payment_id) = 1 AND txn_type = #{AUTHORIZED}") - authorized_only.each do |tx| - update_payment(tx, PAYMENT_PENDING) - end - authorized_only.each { |rec| rec.destroy } - end - - def update_payment(tx, state) - payment = Spree::Payment.find(tx.payment_id) - payment.update_attributes_without_callbacks({ - :state => state, - :source_type => 'Creditcard', - :amount => tx.amount, - :response_code => tx.response_code, - :avs_response => tx.avs_response - }) - end - - def down - end -end diff --git a/db/migrate/20120327000618_delete_in_progress_orders.rb b/db/migrate/20120327000618_delete_in_progress_orders.rb deleted file mode 100644 index 3a32449b9c..0000000000 --- a/db/migrate/20120327000618_delete_in_progress_orders.rb +++ /dev/null @@ -1,19 +0,0 @@ -class DeleteInProgressOrders < ActiveRecord::Migration - def up - execute("DELETE FROM orders WHERE orders.state = 'in_progress'") - delete_orphans('adjustments') - delete_orphans('checkouts') - delete_orphans('shipments') - delete_orphans('payments') - delete_orphans('line_items') - delete_orphans('inventory_units') - end - - def down - end - - private - def delete_orphans(table_name) - execute "DELETE FROM #{table_name} WHERE order_id NOT IN (SELECT id FROM orders)" - end -end diff --git a/db/migrate/20120327000619_migrate_checkout_to_orders.rb b/db/migrate/20120327000619_migrate_checkout_to_orders.rb deleted file mode 100644 index 16963fa046..0000000000 --- a/db/migrate/20120327000619_migrate_checkout_to_orders.rb +++ /dev/null @@ -1,23 +0,0 @@ -class MigrateCheckoutToOrders < ActiveRecord::Migration - def up - orders = select_all "SELECT * FROM orders" - - orders.each do |order| - checkout = update_order(order) - execute "DELETE FROM checkouts WHERE id = #{checkout['id']}" if checkout - end - end - - def down - end - - private - def update_order(order) - checkout = select_one "SELECT * FROM checkouts WHERE order_id = #{order['id']}" - - if checkout - execute "UPDATE orders SET email='#{checkout['email']}', bill_address_id = #{checkout['bill_address_id']}, ship_address_id = #{checkout['ship_address_id']} WHERE id = #{checkout['id']}" - end - checkout - end -end diff --git a/db/migrate/20120327000620_remove_shipped_state.rb b/db/migrate/20120327000620_remove_shipped_state.rb deleted file mode 100644 index 2da2eee433..0000000000 --- a/db/migrate/20120327000620_remove_shipped_state.rb +++ /dev/null @@ -1,12 +0,0 @@ -class RemoveShippedState < ActiveRecord::Migration - def up - execute "UPDATE orders SET state = 'complete' WHERE state = 'shipped'" - shipments = select_all "SELECT shipments.id FROM shipments WHERE order_id IN (SELECT orders.id FROM orders WHERE orders.state = 'shipped')" - shipments.each do |shipment| - execute "UPDATE shipments SET state='shipped' WHERE id = #{shipment[:id]}" - end - end - - def down - end -end diff --git a/db/migrate/20120327000621_prevent_nil_payment_total.rb b/db/migrate/20120327000621_prevent_nil_payment_total.rb deleted file mode 100644 index 101a26dc1b..0000000000 --- a/db/migrate/20120327000621_prevent_nil_payment_total.rb +++ /dev/null @@ -1,8 +0,0 @@ -class PreventNilPaymentTotal < ActiveRecord::Migration - def up - execute "UPDATE orders SET payment_total = 0.0 WHERE payment_total IS NULL" - end - - def down - end -end diff --git a/db/migrate/20120327000622_prevent_nil_email.rb b/db/migrate/20120327000622_prevent_nil_email.rb deleted file mode 100644 index 6bb09984c2..0000000000 --- a/db/migrate/20120327000622_prevent_nil_email.rb +++ /dev/null @@ -1,9 +0,0 @@ -class PreventNilEmail < ActiveRecord::Migration - def up - execute "UPDATE orders SET email = 'guest@example.com' WHERE email IS NULL" - execute "UPDATE orders SET email = 'guest@example.com' WHERE email = ''" - end - - def down - end -end diff --git a/db/migrate/20120327000623_generate_anonymous_users.rb b/db/migrate/20120327000623_generate_anonymous_users.rb deleted file mode 100644 index 47509d8778..0000000000 --- a/db/migrate/20120327000623_generate_anonymous_users.rb +++ /dev/null @@ -1,20 +0,0 @@ -class GenerateAnonymousUsers < ActiveRecord::Migration - def up - Spree::User.table_name = 'users' - Spree::Order.table_name = 'orders' - - Spree::User.reset_column_information - Spree::Order.where(:user_id => nil).each do |order| - user = Spree::User.anonymous! - user.email ||= order.email - order.user = user - order.save! - end - - Spree::User.table_name = 'spree_users' - Spree::Order.table_name = 'spree_orders' - end - - def down - end -end diff --git a/db/migrate/20120327000624_update_order_state.rb b/db/migrate/20120327000624_update_order_state.rb deleted file mode 100644 index 174adbc565..0000000000 --- a/db/migrate/20120327000624_update_order_state.rb +++ /dev/null @@ -1,12 +0,0 @@ -class UpdateOrderState < ActiveRecord::Migration - def up - Spree::Order.table_name = 'orders' - - Spree::Order.all.map(&:update!) - - Spree::Order.table_name = 'spree_orders' - end - - def down - end -end diff --git a/db/migrate/20120327000625_cleanup_legacy_tables.rb b/db/migrate/20120327000625_cleanup_legacy_tables.rb deleted file mode 100644 index 7979409209..0000000000 --- a/db/migrate/20120327000625_cleanup_legacy_tables.rb +++ /dev/null @@ -1,11 +0,0 @@ -class CleanupLegacyTables < ActiveRecord::Migration - def up - drop_table :checkouts - drop_table :transactions - drop_table :open_id_authentication_associations - drop_table :open_id_authentication_nonces - end - - def down - end -end diff --git a/db/migrate/20120327000626_remove_number_and_cvv_from_credicard.rb b/db/migrate/20120327000626_remove_number_and_cvv_from_credicard.rb deleted file mode 100644 index 9bfcf2bd7d..0000000000 --- a/db/migrate/20120327000626_remove_number_and_cvv_from_credicard.rb +++ /dev/null @@ -1,11 +0,0 @@ -class RemoveNumberAndCvvFromCredicard < ActiveRecord::Migration - def up - remove_column :creditcards, :number - remove_column :creditcards, :verification_value - end - - def down - add_column :creditcards, :verification_value, :text - add_column :creditcards, :number, :text - end -end diff --git a/db/migrate/20120327000627_drop_anonymous_field_for_user.rb b/db/migrate/20120327000627_drop_anonymous_field_for_user.rb deleted file mode 100644 index 6aadea72ff..0000000000 --- a/db/migrate/20120327000627_drop_anonymous_field_for_user.rb +++ /dev/null @@ -1,9 +0,0 @@ -class DropAnonymousFieldForUser < ActiveRecord::Migration - def up - remove_column :users, :anonymous - end - - def down - add_column :users, :anonymous, :boolean - end -end diff --git a/db/migrate/20120327000628_renamed_rma_cancelled_state.rb b/db/migrate/20120327000628_renamed_rma_cancelled_state.rb deleted file mode 100644 index 1675568cf2..0000000000 --- a/db/migrate/20120327000628_renamed_rma_cancelled_state.rb +++ /dev/null @@ -1,9 +0,0 @@ -class RenamedRmaCancelledState < ActiveRecord::Migration - def up - execute "UPDATE return_authorizations SET state = 'canceled' WHERE state = 'cancelled'" - end - - def down - execute "UPDATE return_authorizations SET state = 'cancelled' WHERE state = 'canceled'" - end -end diff --git a/db/migrate/20120327000629_fix_problematic_index_names.rb b/db/migrate/20120327000629_fix_problematic_index_names.rb deleted file mode 100644 index ec6eb98f57..0000000000 --- a/db/migrate/20120327000629_fix_problematic_index_names.rb +++ /dev/null @@ -1,13 +0,0 @@ -class FixProblematicIndexNames < ActiveRecord::Migration - def up - begin - remove_index :preferences, :name => 'index_preferences_on_owner_and_attribute_and_preference' - rescue ArgumentError - # ignore - already remove then - end - add_index :preferences, [:owner_id, :owner_type, :name, :group_id, :group_type], :name => 'ix_prefs_on_owner_attr_pref', :unique => true - end - - def down - end -end diff --git a/db/migrate/20120327000630_add_position_to_variants.rb b/db/migrate/20120327000630_add_position_to_variants.rb deleted file mode 100644 index 84a4ab5972..0000000000 --- a/db/migrate/20120327000630_add_position_to_variants.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddPositionToVariants < ActiveRecord::Migration - def change - add_column :variants, :position, :integer - end -end diff --git a/db/migrate/20120327000631_add_next_state_to_state_events.rb b/db/migrate/20120327000631_add_next_state_to_state_events.rb deleted file mode 100644 index 4ea7479a72..0000000000 --- a/db/migrate/20120327000631_add_next_state_to_state_events.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddNextStateToStateEvents < ActiveRecord::Migration - def change - add_column :state_events, :next_state, :string - end -end diff --git a/db/migrate/20120327000632_add_position_to_option_types.rb b/db/migrate/20120327000632_add_position_to_option_types.rb deleted file mode 100644 index 61cdf87344..0000000000 --- a/db/migrate/20120327000632_add_position_to_option_types.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddPositionToOptionTypes < ActiveRecord::Migration - def change - add_column :option_types, :position, :integer, :null => false, :default => 0 - end -end diff --git a/db/migrate/20120327000633_remove_trailing_slashes_in_taxon_permalinks.rb b/db/migrate/20120327000633_remove_trailing_slashes_in_taxon_permalinks.rb deleted file mode 100644 index cb2a016fbb..0000000000 --- a/db/migrate/20120327000633_remove_trailing_slashes_in_taxon_permalinks.rb +++ /dev/null @@ -1,19 +0,0 @@ -class RemoveTrailingSlashesInTaxonPermalinks < ActiveRecord::Migration - def up - taxons = select_all "SELECT * FROM taxons" - taxons.each do |taxon| - if taxon['permalink'] && taxon['permalink'][-1..-1] == '/' - execute "UPDATE taxons SET permalink = '#{taxon['permalink'][0...-1]}' WHERE id = #{taxon['id']}" - end - end - end - - def down - taxons = select_all "SELECT * FROM taxons" - taxons.each do |taxon| - if taxon['permalink'] && taxon['permalink'][-1..-1] != '/' - execute "UPDATE taxons SET permalink = '#{taxon['permalink'] + '/'}' WHERE id = #{taxon['id']}" - end - end - end -end diff --git a/db/migrate/20120327000634_create_activators.rb b/db/migrate/20120327000634_create_activators.rb deleted file mode 100644 index 81448f3025..0000000000 --- a/db/migrate/20120327000634_create_activators.rb +++ /dev/null @@ -1,14 +0,0 @@ -class CreateActivators < ActiveRecord::Migration - def change - create_table :activators, :force => true do |t| - t.string :description - t.datetime :expires_at - t.datetime :created_at - t.datetime :updated_at - t.datetime :starts_at - t.string :name - t.string :event_name - t.string :type - end - end -end diff --git a/db/migrate/20120327000635_eligible_for_adjustments.rb b/db/migrate/20120327000635_eligible_for_adjustments.rb deleted file mode 100644 index 0f669ed30e..0000000000 --- a/db/migrate/20120327000635_eligible_for_adjustments.rb +++ /dev/null @@ -1,5 +0,0 @@ -class EligibleForAdjustments < ActiveRecord::Migration - def change - add_column :adjustments, :eligible, :boolean, :default => true - end -end diff --git a/db/migrate/20120327000636_namespace_top_level_models.rb b/db/migrate/20120327000636_namespace_top_level_models.rb deleted file mode 100644 index 88abe8a139..0000000000 --- a/db/migrate/20120327000636_namespace_top_level_models.rb +++ /dev/null @@ -1,52 +0,0 @@ -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 diff --git a/db/migrate/20120327000637_migrate_namespaced_polymorphic_models.rb b/db/migrate/20120327000637_migrate_namespaced_polymorphic_models.rb deleted file mode 100644 index ec82863a4f..0000000000 --- a/db/migrate/20120327000637_migrate_namespaced_polymorphic_models.rb +++ /dev/null @@ -1,52 +0,0 @@ -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 diff --git a/db/migrate/20120327000638_make_adjustments_polymorphic.rb b/db/migrate/20120327000638_make_adjustments_polymorphic.rb deleted file mode 100644 index 62ba67cb64..0000000000 --- a/db/migrate/20120327000638_make_adjustments_polymorphic.rb +++ /dev/null @@ -1,9 +0,0 @@ -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 diff --git a/db/migrate/20120327000639_add_company_to_addresses.rb b/db/migrate/20120327000639_add_company_to_addresses.rb deleted file mode 100644 index 60a819ea70..0000000000 --- a/db/migrate/20120327000639_add_company_to_addresses.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddCompanyToAddresses < ActiveRecord::Migration - def change - add_column :spree_addresses, :company, :string - end -end diff --git a/db/migrate/20120327000640_add_inc_tax_to_tax_rates.rb b/db/migrate/20120327000640_add_inc_tax_to_tax_rates.rb deleted file mode 100644 index 715b0b4357..0000000000 --- a/db/migrate/20120327000640_add_inc_tax_to_tax_rates.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddIncTaxToTaxRates < ActiveRecord::Migration - def change - add_column :spree_tax_rates, :inc_tax, :boolean, :default => false - end -end diff --git a/db/migrate/20120327000641_rename_inc_price_attribute.rb b/db/migrate/20120327000641_rename_inc_price_attribute.rb deleted file mode 100644 index 8657f63a58..0000000000 --- a/db/migrate/20120327000641_rename_inc_price_attribute.rb +++ /dev/null @@ -1,5 +0,0 @@ -class RenameIncPriceAttribute < ActiveRecord::Migration - def change - rename_column :spree_tax_rates, :inc_tax, :included_in_price - end -end diff --git a/db/migrate/20120327000642_add_default_tax_zone.rb b/db/migrate/20120327000642_add_default_tax_zone.rb deleted file mode 100644 index d0e831800f..0000000000 --- a/db/migrate/20120327000642_add_default_tax_zone.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddDefaultTaxZone < ActiveRecord::Migration - def change - add_column :spree_zones, :default_tax, :boolean, :default => false - end -end diff --git a/db/migrate/20120327000643_associate_shipping_methods_and_shipping_categories.rb b/db/migrate/20120327000643_associate_shipping_methods_and_shipping_categories.rb deleted file mode 100644 index f7f62b7201..0000000000 --- a/db/migrate/20120327000643_associate_shipping_methods_and_shipping_categories.rb +++ /dev/null @@ -1,7 +0,0 @@ -class AssociateShippingMethodsAndShippingCategories < ActiveRecord::Migration - def change - change_table :spree_shipping_methods do |t| - t.references :shipping_category - end - end -end diff --git a/db/migrate/20120327000644_add_match_rules_to_shipping_methods.rb b/db/migrate/20120327000644_add_match_rules_to_shipping_methods.rb deleted file mode 100644 index e5b5ea32a2..0000000000 --- a/db/migrate/20120327000644_add_match_rules_to_shipping_methods.rb +++ /dev/null @@ -1,7 +0,0 @@ -class AddMatchRulesToShippingMethods < ActiveRecord::Migration - def change - add_column :spree_shipping_methods, :match_none, :boolean - add_column :spree_shipping_methods, :match_all, :boolean - add_column :spree_shipping_methods, :match_one, :boolean - end -end diff --git a/db/migrate/20120327000645_new_preferences.rb b/db/migrate/20120327000645_new_preferences.rb deleted file mode 100644 index 86e5dbbf57..0000000000 --- a/db/migrate/20120327000645_new_preferences.rb +++ /dev/null @@ -1,81 +0,0 @@ -# Spree 1.3.6.beta preference rescue implementation, required for the new -# preferences migration, which is broken since commit ab707cf due to the -# absence of this file. -# -# Migration: db/migrate/20120327000645_new_preferences.rb -# Source: https://raw.githubusercontent.com/spree/spree/1-3-stable/core/lib/spree/core/preference_rescue.rb -# -# rubocop:disable all -module Spree - class OldPrefs < ActiveRecord::Base - self.table_name = "spree_preferences" - belongs_to :owner, :polymorphic => true - attr_accessor :owner_klass - end - - class PreferenceRescue - def self.try - OldPrefs.where(:key => nil).each do |old_pref| - next unless owner = (old_pref.owner rescue nil) - unless old_pref.owner_type == "Spree::Activator" || old_pref.owner_type == "Spree::Configuration" - begin - old_pref.key = [owner.class.name, old_pref.name, owner.id].join('::').underscore - old_pref.value_type = owner.preference_type(old_pref.name) - puts "Migrating Preference: #{old_pref.key}" - old_pref.save - rescue NoMethodError => ex - puts ex.message - end - end - end - end - end -end -# rubocop:enable all - -class NewPreferences < ActiveRecord::Migration - - def up - add_column :spree_preferences, :key, :string - add_column :spree_preferences, :value_type, :string - add_index :spree_preferences, :key, :unique => true - - remove_index :spree_preferences, :name => 'ix_prefs_on_owner_attr_pref' - - # remove old constraints for migration - change_column :spree_preferences, :name, :string, :null => true - change_column :spree_preferences, :owner_id, :integer, :null => true - change_column :spree_preferences, :owner_type, :string, :null => true - change_column :spree_preferences, :group_id, :integer, :null => true - change_column :spree_preferences, :group_type, :string, :null => true - - cfgs = execute("select id, type from spree_configurations").to_a - execute("select id, owner_id, name from spree_preferences where owner_type = 'Spree::Configuration'").each do |pref| - configuration = cfgs.detect { |c| c[0].to_s == pref[1].to_s } - - value_type = configuration[1].constantize.new.send "preferred_#{pref[2]}_type" rescue 'string' - - execute "UPDATE spree_preferences set `key` = '#{configuration[1].underscore}/#{pref[2]}', `value_type` = '#{value_type}' where id = #{pref[0]}" rescue nil - end - - # remove orphaned calculator preferences - Spree::Preference.where(:owner_type => 'Spree::Calculator').each do |preference| - preference.destroy unless Spree::Calculator.exists? preference.owner_id - end - - Spree::PreferenceRescue.try - - Spree::Preference.where(:value_type => nil).update_all(:value_type => 'string') - end - - def down - remove_column :spree_preferences, :key - remove_column :spree_preferences, :value_type - - add_column :spree_preferences, :name, :string - add_column :spree_preferences, :owner_id, :integer - add_column :spree_preferences, :owner_type, :string - add_column :spree_preferences, :group_id, :integer - add_column :spree_preferences, :group_type, :string - end -end diff --git a/db/migrate/20120327000646_add_deleted_at_to_tax_category.rb b/db/migrate/20120327000646_add_deleted_at_to_tax_category.rb deleted file mode 100644 index be24f6b4d0..0000000000 --- a/db/migrate/20120327000646_add_deleted_at_to_tax_category.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddDeletedAtToTaxCategory < ActiveRecord::Migration - def change - add_column :spree_tax_categories, :deleted_at, :datetime - end -end diff --git a/db/migrate/20120327000647_rename_columns_for_devise.rb b/db/migrate/20120327000647_rename_columns_for_devise.rb deleted file mode 100644 index cfd893edee..0000000000 --- a/db/migrate/20120327000647_rename_columns_for_devise.rb +++ /dev/null @@ -1,39 +0,0 @@ -class RenameColumnsForDevise < ActiveRecord::Migration - def up - return if column_exists?(:spree_users, :password_salt) - rename_column :spree_users, :crypted_password, :encrypted_password - rename_column :spree_users, :salt, :password_salt - rename_column :spree_users, :remember_token_expires_at, :remember_created_at - rename_column :spree_users, :login_count, :sign_in_count - rename_column :spree_users, :failed_login_count, :failed_attempts - rename_column :spree_users, :single_access_token, :reset_password_token - rename_column :spree_users, :current_login_at, :current_sign_in_at - rename_column :spree_users, :last_login_at, :last_sign_in_at - rename_column :spree_users, :current_login_ip, :current_sign_in_ip - rename_column :spree_users, :last_login_ip, :last_sign_in_ip - add_column :spree_users, :authentication_token, :string - add_column :spree_users, :unlock_token, :string - add_column :spree_users, :locked_at, :datetime - remove_column :spree_users, :api_key if column_exists?(:spree_users, :api_key) - remove_column :spree_users, :openid_identifier - end - - def down - remove_column :spree_users, :authentication_token - remove_column :spree_users, :locked_at - remove_column :spree_users, :unlock_token - rename_column :table_name, :new_column_name, :column_name - rename_column :spree_users, :last_sign_in_ip, :last_login_ip - rename_column :spree_users, :current_sign_in_ip, :current_login_ip - rename_column :spree_users, :last_sign_in_at, :last_login_at - rename_column :spree_users, :current_sign_in_at, :current_login_at - rename_column :spree_users, :reset_password_token, :single_access_token - rename_column :spree_users, :failed_attempts, :failed_login_count - rename_column :spree_users, :sign_in_count, :login_count - rename_column :spree_users, :remember_created_at, :remember_token_expires_at - rename_column :spree_users, :password_salt, :salt - rename_column :spree_users, :encrypted_password, :crypted_password - add_column :spree_users, :unlock_token, :string - add_column :spree_users, :openid_identifier, :string - end -end diff --git a/db/migrate/20120327000648_convert_user_remember_field.rb b/db/migrate/20120327000648_convert_user_remember_field.rb deleted file mode 100644 index 4514fc5b47..0000000000 --- a/db/migrate/20120327000648_convert_user_remember_field.rb +++ /dev/null @@ -1,11 +0,0 @@ -class ConvertUserRememberField < ActiveRecord::Migration - def up - remove_column :spree_users, :remember_created_at - add_column :spree_users, :remember_created_at, :datetime - end - - def down - remove_column :spree_users, :remember_created_at - add_column :spree_users, :remember_created_at, :string - end -end diff --git a/db/migrate/20120327000649_create_tokenized_permissions.rb b/db/migrate/20120327000649_create_tokenized_permissions.rb deleted file mode 100644 index e7d8df4d60..0000000000 --- a/db/migrate/20120327000649_create_tokenized_permissions.rb +++ /dev/null @@ -1,13 +0,0 @@ -class CreateTokenizedPermissions < ActiveRecord::Migration - def change - create_table :tokenized_permissions do |t| - t.integer :permissable_id - t.string :permissable_type - t.string :token - - t.timestamps - end - - add_index :tokenized_permissions, [:permissable_id, :permissable_type], :name => 'index_tokenized_name_and_type' - end -end diff --git a/db/migrate/20120327000650_tokens_for_legacy_orders.rb b/db/migrate/20120327000650_tokens_for_legacy_orders.rb deleted file mode 100644 index 009177b4e8..0000000000 --- a/db/migrate/20120327000650_tokens_for_legacy_orders.rb +++ /dev/null @@ -1,16 +0,0 @@ -class TokensForLegacyOrders < ActiveRecord::Migration - def up - Spree::TokenizedPermission.table_name = 'tokenized_permissions' - - # add token permissions for legacy orders (stop relying on user persistence token) - Spree::Order.all.each do |order| - next unless order.user - order.create_tokenized_permission(:token => order.user.persistence_token) - end - - Spree::TokenizedPermission.table_name = 'spree_tokenized_permissions' - end - - def down - end -end diff --git a/db/migrate/20120327000651_namespace_tokenized_permission.rb b/db/migrate/20120327000651_namespace_tokenized_permission.rb deleted file mode 100644 index 3eb8baa7b0..0000000000 --- a/db/migrate/20120327000651_namespace_tokenized_permission.rb +++ /dev/null @@ -1,5 +0,0 @@ -class NamespaceTokenizedPermission < ActiveRecord::Migration - def change - rename_table :tokenized_permissions, :spree_tokenized_permissions - end -end diff --git a/db/migrate/20120327000652_migrate_tokenized_permissions.rb b/db/migrate/20120327000652_migrate_tokenized_permissions.rb deleted file mode 100644 index 2fb4e6e155..0000000000 --- a/db/migrate/20120327000652_migrate_tokenized_permissions.rb +++ /dev/null @@ -1,24 +0,0 @@ -class MigrateTokenizedPermissions < 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 up - execute "UPDATE spree_tokenized_permissions SET permissable_type = #{concat("'Spree::'", "permissable_type")}" + - " WHERE permissable_type NOT LIKE 'Spree::%' AND permissable_type IS NOT NULL" - end - - def down - execute "UPDATE spree_tokenized_permissions SET permissable_type = REPLACE(permissable_type, 'Spree::', '')" + - " WHERE permissable_type LIKE 'Spree::%'" - end -end diff --git a/db/migrate/20120327000653_add_api_key_to_users.rb b/db/migrate/20120327000653_add_api_key_to_users.rb deleted file mode 100644 index 32d98fabba..0000000000 --- a/db/migrate/20120327000653_add_api_key_to_users.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddApiKeyToUsers < ActiveRecord::Migration - def change - add_column :spree_users, :api_key, :string, :limit => 40 - end -end diff --git a/db/migrate/20120327000654_rename_coupons_to_promotions.rb b/db/migrate/20120327000654_rename_coupons_to_promotions.rb deleted file mode 100644 index a5d6bb39e5..0000000000 --- a/db/migrate/20120327000654_rename_coupons_to_promotions.rb +++ /dev/null @@ -1,10 +0,0 @@ -class RenameCouponsToPromotions < ActiveRecord::Migration - def up - drop_table :promotions if table_exists?(:promotions) - rename_table :coupons, :promotions - end - - def down - rename_table :promotions, :coupons - end -end diff --git a/db/migrate/20120327000655_create_promotion_rules.rb b/db/migrate/20120327000655_create_promotion_rules.rb deleted file mode 100644 index f94030b7a4..0000000000 --- a/db/migrate/20120327000655_create_promotion_rules.rb +++ /dev/null @@ -1,24 +0,0 @@ -class CreatePromotionRules < ActiveRecord::Migration - def up - create_table :promotion_rules do |t| - t.references :promotion, :user, :product_group - t.string :type - - t.timestamps - end - add_index :promotion_rules, :product_group_id - add_index :promotion_rules, :user_id - - create_table :products_promotion_rules do |t| - t.integer :product_id, :promotion_rule_id - end - remove_column :products_promotion_rules, :id - add_index :products_promotion_rules, :product_id - add_index :products_promotion_rules, :promotion_rule_id - end - - def down - drop_table :promotion_rules - drop_table :products_promotion_rules - end -end diff --git a/db/migrate/20120327000656_match_policy_for_promotions.rb b/db/migrate/20120327000656_match_policy_for_promotions.rb deleted file mode 100644 index f6c580e452..0000000000 --- a/db/migrate/20120327000656_match_policy_for_promotions.rb +++ /dev/null @@ -1,5 +0,0 @@ -class MatchPolicyForPromotions < ActiveRecord::Migration - def change - add_column :promotions, :match_policy, :string, :default => 'all' - end -end diff --git a/db/migrate/20120327000657_create_promotion_rules_users.rb b/db/migrate/20120327000657_create_promotion_rules_users.rb deleted file mode 100644 index f6c33350e6..0000000000 --- a/db/migrate/20120327000657_create_promotion_rules_users.rb +++ /dev/null @@ -1,14 +0,0 @@ -class CreatePromotionRulesUsers < ActiveRecord::Migration - def up - create_table :promotion_rules_users do |t| - t.integer :user_id, :promotion_rule_id - end - remove_column :promotion_rules_users, :id - add_index :promotion_rules_users, :user_id - add_index :promotion_rules_users, :promotion_rule_id - end - - def down - drop_table :promotion_rules_users - end -end diff --git a/db/migrate/20120327000658_name_for_promotions.rb b/db/migrate/20120327000658_name_for_promotions.rb deleted file mode 100644 index 1a26126e9b..0000000000 --- a/db/migrate/20120327000658_name_for_promotions.rb +++ /dev/null @@ -1,5 +0,0 @@ -class NameForPromotions < ActiveRecord::Migration - def change - add_column :promotions, :name, :string - end -end diff --git a/db/migrate/20120327000659_update_calculable_type_for_promotions.rb b/db/migrate/20120327000659_update_calculable_type_for_promotions.rb deleted file mode 100644 index ccdb8bef84..0000000000 --- a/db/migrate/20120327000659_update_calculable_type_for_promotions.rb +++ /dev/null @@ -1,9 +0,0 @@ -class UpdateCalculableTypeForPromotions < ActiveRecord::Migration - def up - execute "UPDATE spree_calculators SET calculable_type = 'Promotion' WHERE calculable_type = 'Coupon'" - end - - def down - execute "UPDATE spree_calculators SET calculable_type = 'Coupon' WHERE calculable_type = 'Promotion'" - end -end diff --git a/db/migrate/20120327000660_migrate_adjustments.rb b/db/migrate/20120327000660_migrate_adjustments.rb deleted file mode 100644 index 398d23bbc8..0000000000 --- a/db/migrate/20120327000660_migrate_adjustments.rb +++ /dev/null @@ -1,9 +0,0 @@ -class MigrateAdjustments < ActiveRecord::Migration - def up - execute "UPDATE spree_adjustments SET amount = 0.0 WHERE amount IS NULL" - execute "UPDATE spree_adjustments SET mandatory = 't' WHERE locked = 't'" - end - - def down - end -end diff --git a/db/migrate/20120327000661_promotion_changes_to_subclass_of_activator.rb b/db/migrate/20120327000661_promotion_changes_to_subclass_of_activator.rb deleted file mode 100644 index feee9c754e..0000000000 --- a/db/migrate/20120327000661_promotion_changes_to_subclass_of_activator.rb +++ /dev/null @@ -1,22 +0,0 @@ -class PromotionChangesToSubclassOfActivator < ActiveRecord::Migration - def up - drop_table :promotions - rename_column :promotion_rules, :promotion_id, :activator_id - end - - def down - create_table :promotions, :force => true do |t| - t.string :name - t.string :code - t.string :description - t.integer :usage_limit - t.boolean :combine - t.datetime :expires_at - t.datetime :starts_at - t.string :match_policy, :default => 'all' - - t.timestamps - end - rename_column :promotion_rules, :activator_id, :promotion_id - end -end diff --git a/db/migrate/20120327000662_create_promotion_actions.rb b/db/migrate/20120327000662_create_promotion_actions.rb deleted file mode 100644 index 2283154611..0000000000 --- a/db/migrate/20120327000662_create_promotion_actions.rb +++ /dev/null @@ -1,9 +0,0 @@ -class CreatePromotionActions < ActiveRecord::Migration - def change - create_table :promotion_actions do |t| - t.integer :activator_id - t.integer :position - t.string :type - end - end -end diff --git a/db/migrate/20120327000663_create_promotion_action_line_items.rb b/db/migrate/20120327000663_create_promotion_action_line_items.rb deleted file mode 100644 index 9241d58fc3..0000000000 --- a/db/migrate/20120327000663_create_promotion_action_line_items.rb +++ /dev/null @@ -1,10 +0,0 @@ -class CreatePromotionActionLineItems < ActiveRecord::Migration - def change - create_table :promotion_action_line_items do |t| - t.integer :promotion_action_id, :variant_id - t.integer :quantity, :default => 1 - t.references :promotion_action - t.references :variant - end - end -end diff --git a/db/migrate/20120327000664_namespace_promo_tables.rb b/db/migrate/20120327000664_namespace_promo_tables.rb deleted file mode 100644 index 398e65ae16..0000000000 --- a/db/migrate/20120327000664_namespace_promo_tables.rb +++ /dev/null @@ -1,85 +0,0 @@ -require 'spree/core/preference_rescue' - -class NamespacePromoTables < 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 self.up - # namespace promo tables - rename_table :promotion_actions, :spree_promotion_actions - rename_table :promotion_rules, :spree_promotion_rules - rename_table :promotion_rules_users, :spree_promotion_rules_users - rename_table :promotion_action_line_items, :spree_promotion_action_line_items - rename_table :products_promotion_rules, :spree_products_promotion_rules - - update_column_data('spree_promotion_actions', 'type') - update_column_data('spree_promotion_rules', 'type') - - # add old promo preferences as columns - add_column :spree_activators, :usage_limit, :integer - add_column :spree_activators, :match_policy, :string, :default => 'all' - add_column :spree_activators, :code, :string - add_column :spree_activators, :advertise, :boolean, :default => false - - Spree::Activator.reset_column_information - - Spree::Preference.where(:owner_type => 'Spree::Activator').each do |preference| - unless Spree::Activator.exists? preference.owner_id - preference.destroy - next - end - - @activator = Spree::Activator.find(preference.owner_id) - @activator.update_attribute(preference.name, preference.raw_value) - preference.destroy - end - - Spree::PreferenceRescue.try - - # This *should* be in the new_preferences migration inside of Core but... - # This is migration needs to have these keys around so that - # we can convert the promotions over correctly. - # So they hang around until we're *finally* done with them, since promo's - # migrations are copied over *after* core, and then we ditch them. - remove_column :spree_preferences, :group_id - remove_column :spree_preferences, :group_type - end - - def self.down - replace_column_data('spree_promotion_actions', 'type') - replace_column_data('spree_promotion_rules', 'type') - - rename_table :spree_promotion_actions, :promotion_actions - rename_table :spree_promotion_rules, :promotion_rules - rename_table :spree_promotion_rules_users, :promotion_rules_users - rename_table :spree_promotion_action_line_items, :promotion_action_line_items - rename_table :spree_products_promotion_rules, :products_promotion_rules - end -end \ No newline at end of file diff --git a/db/migrate/20120327000665_create_spree_pending_promotions.rb b/db/migrate/20120327000665_create_spree_pending_promotions.rb deleted file mode 100644 index e6de8afdeb..0000000000 --- a/db/migrate/20120327000665_create_spree_pending_promotions.rb +++ /dev/null @@ -1,11 +0,0 @@ -class CreateSpreePendingPromotions < ActiveRecord::Migration - def change - create_table :spree_pending_promotions do |t| - t.references :user - t.references :promotion - end - - add_index :spree_pending_promotions, :user_id - add_index :spree_pending_promotions, :promotion_id - end -end diff --git a/db/migrate/20120327000666_content_visited_event.rb b/db/migrate/20120327000666_content_visited_event.rb deleted file mode 100644 index ea853b2c9b..0000000000 --- a/db/migrate/20120327000666_content_visited_event.rb +++ /dev/null @@ -1,29 +0,0 @@ -# LandingPage used to support static pages, we've moved to a static -# event. This adds path to promotions then migrates the old LandingPage rules -class ContentVisitedEvent < ActiveRecord::Migration - - # Removed Class for Migrations - class Spree::Promotion::Rules::LandingPage < Spree::PromotionRule - preference :path, :string - def eligible?(order, options = {}) - true - end - end - - def up - add_column :spree_activators, :path, :string - - Spree::Promotion::Rules::LandingPage.all.each do |promotion_rule| - promotion = promotion_rule.promotion - say "migrating #{promotion.name} promotion to use 'spree.content.visited' event" - promotion.event_name = 'spree.content.visited' - promotion.path = promotion_rule.preferred_path - promotion.promotion_rules.delete promotion_rule - promotion.save(:validate => false) - end - end - - def down - remove_column :spree_activators, :path - end -end \ No newline at end of file diff --git a/db/migrate/20120327000667_create_skrill_transactions.rb b/db/migrate/20120327000667_create_skrill_transactions.rb deleted file mode 100644 index 0af9924a0b..0000000000 --- a/db/migrate/20120327000667_create_skrill_transactions.rb +++ /dev/null @@ -1,14 +0,0 @@ -class CreateSkrillTransactions < ActiveRecord::Migration - def change - create_table :spree_skrill_transactions do |t| - t.string :email - t.float :amount - t.string :currency - t.integer :transaction_id - t.integer :customer_id - t.string :payment_type - t.timestamps - end - end -end - diff --git a/db/migrate/20120331051742_create_distributors.rb b/db/migrate/20120331051742_create_distributors.rb deleted file mode 100644 index f9096b4fb8..0000000000 --- a/db/migrate/20120331051742_create_distributors.rb +++ /dev/null @@ -1,18 +0,0 @@ -class CreateDistributors < ActiveRecord::Migration - def change - create_table :distributors do |t| - t.string :name - t.string :contact - t.string :phone - t.string :email - t.string :pickup_address - t.string :pickup_times - t.string :url - t.string :abn - t.string :acn - t.string :description - - t.timestamps - end - end -end diff --git a/db/migrate/20120407065132_add_distributor_to_order.rb b/db/migrate/20120407065132_add_distributor_to_order.rb deleted file mode 100644 index 9dd239d214..0000000000 --- a/db/migrate/20120407065132_add_distributor_to_order.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddDistributorToOrder < ActiveRecord::Migration - def change - add_column :spree_orders, :distributor_id, :integer - end -end diff --git a/db/migrate/20120408081918_add_extra_address_fields_to_distributor.rb b/db/migrate/20120408081918_add_extra_address_fields_to_distributor.rb deleted file mode 100644 index 91b65333d6..0000000000 --- a/db/migrate/20120408081918_add_extra_address_fields_to_distributor.rb +++ /dev/null @@ -1,7 +0,0 @@ -class AddExtraAddressFieldsToDistributor < ActiveRecord::Migration - def change - add_column :distributors, :city, :string - add_column :distributors, :post_code, :string - add_column :distributors, :country_id, :integer - end -end diff --git a/db/migrate/20120409004831_add_state_to_distributor.rb b/db/migrate/20120409004831_add_state_to_distributor.rb deleted file mode 100644 index 5480039a1a..0000000000 --- a/db/migrate/20120409004831_add_state_to_distributor.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddStateToDistributor < ActiveRecord::Migration - def change - add_column :distributors, :state_id, :integer - end -end diff --git a/db/migrate/20120422042134_add_supplier.rb b/db/migrate/20120422042134_add_supplier.rb deleted file mode 100644 index 85add9901a..0000000000 --- a/db/migrate/20120422042134_add_supplier.rb +++ /dev/null @@ -1,16 +0,0 @@ -class AddSupplier < ActiveRecord::Migration - def change - create_table :suppliers do |t| - t.string :name - t.string :description - t.string :url - t.string :email - t.string :twitter - t.string :website - - t.integer :address_id - - t.timestamps - end - end -end diff --git a/db/migrate/20120425065453_add_supplier_to_product.rb b/db/migrate/20120425065453_add_supplier_to_product.rb deleted file mode 100644 index 41653e7857..0000000000 --- a/db/migrate/20120425065453_add_supplier_to_product.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddSupplierToProduct < ActiveRecord::Migration - def change - add_column :spree_products, :supplier_id, :integer - end -end diff --git a/db/migrate/20120429071654_replace_spree_address_from_supplier.rb b/db/migrate/20120429071654_replace_spree_address_from_supplier.rb deleted file mode 100644 index e910b373c6..0000000000 --- a/db/migrate/20120429071654_replace_spree_address_from_supplier.rb +++ /dev/null @@ -1,12 +0,0 @@ -class ReplaceSpreeAddressFromSupplier < ActiveRecord::Migration - def change - remove_column :suppliers, :address_id - remove_column :suppliers, :url - - add_column :suppliers, :address, :string - add_column :suppliers, :city, :string - add_column :suppliers, :postcode, :string - add_column :suppliers, :state_id, :integer - add_column :suppliers, :country_id, :integer - end -end diff --git a/db/migrate/20120520062059_rename_state_events_to_state_changes.spree.rb b/db/migrate/20120520062059_rename_state_events_to_state_changes.spree.rb deleted file mode 100644 index 469e730d62..0000000000 --- a/db/migrate/20120520062059_rename_state_events_to_state_changes.spree.rb +++ /dev/null @@ -1,10 +0,0 @@ -# This migration comes from spree (originally 20120203001428) -class RenameStateEventsToStateChanges < ActiveRecord::Migration - def up - rename_table :spree_state_events, :spree_state_changes - end - - def down - rename_table :spree_state_changes, :spree_state_events - end -end diff --git a/db/migrate/20120520062060_migrate_images_from_products_to_variants.spree.rb b/db/migrate/20120520062060_migrate_images_from_products_to_variants.spree.rb deleted file mode 100644 index 5199cbd49d..0000000000 --- a/db/migrate/20120520062060_migrate_images_from_products_to_variants.spree.rb +++ /dev/null @@ -1,36 +0,0 @@ -# This migration comes from spree (originally 20120315064358) -class MigrateImagesFromProductsToVariants < ActiveRecord::Migration - def up - images = select_all("SELECT spree_assets.* FROM spree_assets - WHERE spree_assets.type IN ('Spree::Image') - AND spree_assets.viewable_type = 'Spree::Product'") - - images.each do |image| - master_variant_id = select_value("SELECT id FROM spree_variants - WHERE product_id = #{image['viewable_id']} - AND is_master = #{quoted_true}") - - execute("UPDATE spree_assets SET viewable_type = 'Spree::Variant', viewable_id = #{master_variant_id} - WHERE id = #{image['id']}") if master_variant_id - end - end - - def down - images = select_all("SELECT spree_assets.* FROM spree_assets - JOIN spree_variants - ON spree_variants.id = spree_assets.viewable_id - AND spree_variants.is_master = #{quoted_true} - WHERE spree_assets.type IN ('Spree::Image') - AND spree_assets.viewable_type = 'Spree::Variant'") - - images.each do |image| - product_id = select_value("SELECT spree_products.id FROM spree_products - JOIN spree_variants - ON spree_variants.id = #{image['viewable_id']} - AND spree_products.id = spree_variants.product_id") - - execute("UPDATE spree_assets SET viewable_type = 'Spree::Product', viewable_id = #{product_id} - WHERE id = #{image['id']}") if product_id - end - end -end diff --git a/db/migrate/20120520062061_rename_attachment_size_to_attachment_file_size.spree.rb b/db/migrate/20120520062061_rename_attachment_size_to_attachment_file_size.spree.rb deleted file mode 100644 index 2dec8f2115..0000000000 --- a/db/migrate/20120520062061_rename_attachment_size_to_attachment_file_size.spree.rb +++ /dev/null @@ -1,6 +0,0 @@ -# This migration comes from spree (originally 20120416233427) -class RenameAttachmentSizeToAttachmentFileSize < ActiveRecord::Migration - def change - rename_column :spree_assets, :attachment_size, :attachment_file_size - end -end diff --git a/db/migrate/20120618061537_move_distributor_from_order_to_product.rb b/db/migrate/20120618061537_move_distributor_from_order_to_product.rb deleted file mode 100644 index c5f0b18a59..0000000000 --- a/db/migrate/20120618061537_move_distributor_from_order_to_product.rb +++ /dev/null @@ -1,26 +0,0 @@ -class MoveDistributorFromOrderToProduct < ActiveRecord::Migration - class Distributor < ActiveRecord::Base; end - class Spree::Product < ActiveRecord::Base; end - - def up - remove_column :spree_orders, :distributor_id - - create_table :distributors_products, :id => false do |t| - t.references :product - t.references :distributor - end - - # Associate all products with the first distributor - distributor = Distributor.first - if distributor - Spree::Product.all.each do |product| - product.distributors << distributor - end - end - end - - def down - drop_table :distributors_products - add_column :spree_orders, :distributor_id, :integer - end -end diff --git a/db/migrate/20120621064227_add_distributor_id_to_order.rb b/db/migrate/20120621064227_add_distributor_id_to_order.rb deleted file mode 100644 index 3f6bb57acf..0000000000 --- a/db/migrate/20120621064227_add_distributor_id_to_order.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddDistributorIdToOrder < ActiveRecord::Migration - def change - add_column :spree_orders, :distributor_id, :integer - end -end diff --git a/db/migrate/20120626013846_extract_distributor_and_supplier_address_to_spree_address.rb b/db/migrate/20120626013846_extract_distributor_and_supplier_address_to_spree_address.rb deleted file mode 100644 index 89480427ea..0000000000 --- a/db/migrate/20120626013846_extract_distributor_and_supplier_address_to_spree_address.rb +++ /dev/null @@ -1,92 +0,0 @@ -class ExtractDistributorAndSupplierAddressToSpreeAddress < ActiveRecord::Migration - class Supplier < ActiveRecord::Base; end - class Distributor < ActiveRecord::Base; end - class Spree::Address < ActiveRecord::Base; end - - - def up - # -- Distributors - add_column :distributors, :pickup_address_id, :integer - Distributor.reset_column_information - - Distributor.all.each do |distributor| - pickup_address = Spree::Address.create!(:firstname => 'unused', - :lastname => 'unused', - :phone => 'unused', - :address1 => distributor[:pickup_address], - :city => distributor.city, - :zipcode => distributor.post_code, - :state_id => distributor.state_id, - :country_id => distributor.country_id) - distributor.pickup_address = pickup_address - distributor.save! - end - - %w(pickup_address city post_code state_id country_id).each do |column| - remove_column :distributors, column - end - - - # -- Suppliers - add_column :suppliers, :address_id, :integer - Supplier.reset_column_information - - Supplier.all.each do |supplier| - address = Spree::Address.create!(:firstname => 'unused', - :lastname => 'unused', - :phone => 'unused', - :address1 => supplier[:address], - :city => supplier.city, - :zipcode => supplier.postcode, - :state_id => supplier.state_id, - :country_id => supplier.country_id) - supplier.address = address - supplier.save! - end - - %w(address city postcode state_id country_id).each do |column| - remove_column :suppliers, column - end - end - - def down - # -- Distributors - add_column :distributors, :pickup_address, :string - add_column :distributors, :city, :string - add_column :distributors, :post_code, :string - add_column :distributors, :state_id, :integer - add_column :distributors, :country_id, :integer - Distributor.reset_column_information - - Distributor.all.each do |distributor| - distributor[:pickup_address] = distributor.pickup_address.address1 - distributor.city = distributor.pickup_address.city - distributor.post_code = distributor.pickup_address.zipcode - distributor.state_id = distributor.pickup_address.state_id - distributor.country_id = distributor.pickup_address.country_id - distributor.save! - end - - remove_column :distributors, :pickup_address_id - - - # -- Suppliers - add_column :suppliers, :address, :string - add_column :suppliers, :city, :string - add_column :suppliers, :postcode, :string - add_column :suppliers, :state_id, :integer - add_column :suppliers, :country_id, :integer - Supplier.reset_column_information - - Supplier.all.each do |supplier| - supplier[:address] = supplier.address.address1 - supplier.city = supplier.address.city - supplier.post_code = supplier.address.zipcode - supplier.state_id = supplier.address.state_id - supplier.country_id = supplier.address.country_id - supplier.save! - end - - remove_column :suppliers, :address_id - end -end diff --git a/db/migrate/20120626233350_rename_distributors_products_to_product_distributions.rb b/db/migrate/20120626233350_rename_distributors_products_to_product_distributions.rb deleted file mode 100644 index c2ecd94457..0000000000 --- a/db/migrate/20120626233350_rename_distributors_products_to_product_distributions.rb +++ /dev/null @@ -1,27 +0,0 @@ -class RenameDistributorsProductsToProductDistributions < ActiveRecord::Migration - class Spree::ShippingMethod < ActiveRecord::Base; end - class ProductDistribution < ActiveRecord::Base; end - - def up - # Convert m2m join table into explicit join model, and add a shipping method relation and timestamps - rename_table :distributors_products, :product_distributions - add_column :product_distributions, :id, :primary_key - change_table :product_distributions do |t| - t.references :shipping_method - t.timestamps - end - - # Set default shipping method on all product distributions - sm = Spree::ShippingMethod.unscoped.first - ProductDistribution.update_all(:shipping_method_id => sm.id) if sm - end - - def down - change_table :product_distributions do |t| - t.remove :id - t.remove :shipping_method_id - t.remove :created_at, :updated_at - end - rename_table :product_distributions, :distributors_products - end -end diff --git a/db/migrate/20120629043042_increase_scale_of_tax_rate_amount.spree.rb b/db/migrate/20120629043042_increase_scale_of_tax_rate_amount.spree.rb deleted file mode 100644 index f4725b09d9..0000000000 --- a/db/migrate/20120629043042_increase_scale_of_tax_rate_amount.spree.rb +++ /dev/null @@ -1,10 +0,0 @@ -# This migration comes from spree (originally 20120507232704) -class IncreaseScaleOfTaxRateAmount < ActiveRecord::Migration - def up - change_column :spree_tax_rates, :amount, :decimal, { :scale => 5, :precision => 8 } - end - - def down - change_column :spree_tax_rates, :amount, :decimal, { :scale => 4, :precision => 8 } - end -end diff --git a/db/migrate/20120629043043_add_reset_password_sent_at_to_spree_users.spree_auth.rb b/db/migrate/20120629043043_add_reset_password_sent_at_to_spree_users.spree_auth.rb deleted file mode 100644 index 7632ac3417..0000000000 --- a/db/migrate/20120629043043_add_reset_password_sent_at_to_spree_users.spree_auth.rb +++ /dev/null @@ -1,6 +0,0 @@ -# This migration comes from spree_auth (originally 20120203010234) -class AddResetPasswordSentAtToSpreeUsers < ActiveRecord::Migration - def change - add_column :spree_users, :reset_password_sent_at, :datetime - end -end diff --git a/db/migrate/20120629043045_resize_api_key_field.spree_api.rb b/db/migrate/20120629043045_resize_api_key_field.spree_api.rb deleted file mode 100644 index cdd4430364..0000000000 --- a/db/migrate/20120629043045_resize_api_key_field.spree_api.rb +++ /dev/null @@ -1,6 +0,0 @@ -# This migration comes from spree_api (originally 20120411123334) -class ResizeApiKeyField < ActiveRecord::Migration - def change - change_column :spree_users, :api_key, :string, :limit => 48 - end -end diff --git a/db/migrate/20120629043647_create_paypal_accounts.spree_paypal_express.rb b/db/migrate/20120629043647_create_paypal_accounts.spree_paypal_express.rb deleted file mode 100644 index 89ee02159b..0000000000 --- a/db/migrate/20120629043647_create_paypal_accounts.spree_paypal_express.rb +++ /dev/null @@ -1,15 +0,0 @@ -# This migration comes from spree_paypal_express (originally 20100224133156) -class CreatePaypalAccounts < ActiveRecord::Migration - def self.up - create_table :paypal_accounts do |t| - t.string :email - t.string :payer_id - t.string :payer_country - t.string :payer_status - end - end - - def self.down - drop_table :paypal_accounts - end -end diff --git a/db/migrate/20120629043648_namespace_paypal_accounts.spree_paypal_express.rb b/db/migrate/20120629043648_namespace_paypal_accounts.spree_paypal_express.rb deleted file mode 100644 index 12a2f0cc83..0000000000 --- a/db/migrate/20120629043648_namespace_paypal_accounts.spree_paypal_express.rb +++ /dev/null @@ -1,6 +0,0 @@ -# This migration comes from spree_paypal_express (originally 20120117182027) -class NamespacePaypalAccounts < ActiveRecord::Migration - def change - rename_table :paypal_accounts, :spree_paypal_accounts - end -end diff --git a/db/migrate/20120702020402_add_next_collection_at_to_distributors.rb b/db/migrate/20120702020402_add_next_collection_at_to_distributors.rb deleted file mode 100644 index 1e30199de8..0000000000 --- a/db/migrate/20120702020402_add_next_collection_at_to_distributors.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddNextCollectionAtToDistributors < ActiveRecord::Migration - def change - add_column :distributors, :next_collection_at, :string - end -end diff --git a/db/migrate/20120802031147_add_group_buy_fields.rb b/db/migrate/20120802031147_add_group_buy_fields.rb deleted file mode 100644 index 5cc9efe857..0000000000 --- a/db/migrate/20120802031147_add_group_buy_fields.rb +++ /dev/null @@ -1,6 +0,0 @@ -class AddGroupBuyFields < ActiveRecord::Migration - def change - add_column :spree_products, :group_buy, :boolean - add_column :spree_line_items, :max_quantity, :integer - end -end diff --git a/db/migrate/20120913054657_convert_sales_tax_to_default_tax.spree.rb b/db/migrate/20120913054657_convert_sales_tax_to_default_tax.spree.rb deleted file mode 100644 index a15416d63c..0000000000 --- a/db/migrate/20120913054657_convert_sales_tax_to_default_tax.spree.rb +++ /dev/null @@ -1,10 +0,0 @@ -# This migration comes from spree (originally 20120523061241) -class ConvertSalesTaxToDefaultTax < ActiveRecord::Migration - def up - execute "UPDATE spree_calculators SET type='Spree::Calculator::DefaultTax' WHERE type='Spree::Calculator::SalesTax'" - end - - def down - execute "UPDATE spree_calculators SET type='Spree::Calculator::SalesTax' WHERE type='Spree::Calculator::DefaultTax'" - end -end diff --git a/db/migrate/20120913054658_add_deleted_at_to_spree_shipping_methods.spree.rb b/db/migrate/20120913054658_add_deleted_at_to_spree_shipping_methods.spree.rb deleted file mode 100644 index 54c5978c24..0000000000 --- a/db/migrate/20120913054658_add_deleted_at_to_spree_shipping_methods.spree.rb +++ /dev/null @@ -1,6 +0,0 @@ -# This migration comes from spree (originally 20120604030249) -class AddDeletedAtToSpreeShippingMethods < ActiveRecord::Migration - def change - add_column :spree_shipping_methods, :deleted_at, :datetime - end -end diff --git a/db/migrate/20120913054659_make_users_email_index_unique.spree.rb b/db/migrate/20120913054659_make_users_email_index_unique.spree.rb deleted file mode 100644 index 4fd43f21d2..0000000000 --- a/db/migrate/20120913054659_make_users_email_index_unique.spree.rb +++ /dev/null @@ -1,11 +0,0 @@ -# This migration comes from spree (originally 20120605211305) -class MakeUsersEmailIndexUnique < ActiveRecord::Migration - def up - add_index "spree_users", ["email"], :name => "email_idx_unique", :unique => true - end - - def down - remove_index "spree_users", :name => "email_idx_unique" - add_index "spree_users", ["email"], :name => "email_idx_unique" - end -end diff --git a/db/migrate/20120913054660_add_counter_cache_to_zone_members.spree.rb b/db/migrate/20120913054660_add_counter_cache_to_zone_members.spree.rb deleted file mode 100644 index 669434e34d..0000000000 --- a/db/migrate/20120913054660_add_counter_cache_to_zone_members.spree.rb +++ /dev/null @@ -1,15 +0,0 @@ -# This migration comes from spree (originally 20120712172620) -class AddCounterCacheToZoneMembers < ActiveRecord::Migration - def up - add_column :spree_zones, :zone_members_count, :integer, :default => 0 - - Spree::Zone.reset_column_information - Spree::Zone.find(:all).each do |zone| - Spree::Zone.update_counters zone.id, :zone_members_count => zone.zone_members.length - end - end - - def down - remove_column :spree_zones, :zone_members_count - end -end diff --git a/db/migrate/20120919013335_add_shipping_method_to_line_items.rb b/db/migrate/20120919013335_add_shipping_method_to_line_items.rb deleted file mode 100644 index fd5974992d..0000000000 --- a/db/migrate/20120919013335_add_shipping_method_to_line_items.rb +++ /dev/null @@ -1,20 +0,0 @@ -class AddShippingMethodToLineItems < ActiveRecord::Migration - def up - add_column :spree_line_items, :shipping_method_id, :integer - - Spree::LineItem.all.each do |li| - begin - shipping_method = li.product.shipping_method_for_distributor(li.order.distributor) - rescue ArgumentError - shipping_method = Spree::ShippingMethod.find_by_name 'Producer Delivery' - say "Line item #{li.id} does not have a valid shipping method, setting to '#{shipping_method.name}'" - end - - Spree::LineItem.update_all("shipping_method_id = #{shipping_method.id}", "id = #{li.id}") - end - end - - def down - remove_column :spree_line_items, :shipping_method_id - end -end diff --git a/db/migrate/20121005015852_populate_order_default_shipping_method.rb b/db/migrate/20121005015852_populate_order_default_shipping_method.rb deleted file mode 100644 index 2184ee18b0..0000000000 --- a/db/migrate/20121005015852_populate_order_default_shipping_method.rb +++ /dev/null @@ -1,10 +0,0 @@ -class PopulateOrderDefaultShippingMethod < ActiveRecord::Migration - def up - Spree::Order.where(shipping_method_id: nil).each do |order| - order.send(:set_default_shipping_method) - end - end - - def down - end -end diff --git a/db/migrate/20121009232513_create_cms.rb b/db/migrate/20121009232513_create_cms.rb deleted file mode 100644 index d1c1700a5e..0000000000 --- a/db/migrate/20121009232513_create_cms.rb +++ /dev/null @@ -1,137 +0,0 @@ -class CreateCms < ActiveRecord::Migration - - def self.up - - text_limit = case ActiveRecord::Base.connection.adapter_name - when 'PostgreSQL' - { } - else - { :limit => 16777215 } - end - - # -- Sites -------------------------------------------------------------- - create_table :cms_sites do |t| - t.string :label, :null => false - t.string :identifier, :null => false - t.string :hostname, :null => false - t.string :path - t.string :locale, :null => false, :default => 'en' - t.boolean :is_mirrored, :null => false, :default => false - end - add_index :cms_sites, :hostname - add_index :cms_sites, :is_mirrored - - # -- Layouts ------------------------------------------------------------ - create_table :cms_layouts do |t| - t.integer :site_id, :null => false - t.integer :parent_id - t.string :app_layout - t.string :label, :null => false - t.string :identifier, :null => false - t.text :content, text_limit - t.text :css, text_limit - t.text :js, text_limit - t.integer :position, :null => false, :default => 0 - t.boolean :is_shared, :null => false, :default => false - t.timestamps - end - add_index :cms_layouts, [:parent_id, :position] - add_index :cms_layouts, [:site_id, :identifier], :unique => true - - # -- Pages -------------------------------------------------------------- - create_table :cms_pages do |t| - t.integer :site_id, :null => false - t.integer :layout_id - t.integer :parent_id - t.integer :target_page_id - t.string :label, :null => false - t.string :slug - t.string :full_path, :null => false - t.text :content, text_limit - t.integer :position, :null => false, :default => 0 - t.integer :children_count, :null => false, :default => 0 - t.boolean :is_published, :null => false, :default => true - t.boolean :is_shared, :null => false, :default => false - t.timestamps - end - add_index :cms_pages, [:site_id, :full_path] - add_index :cms_pages, [:parent_id, :position] - - # -- Page Blocks -------------------------------------------------------- - create_table :cms_blocks do |t| - t.integer :page_id, :null => false - t.string :identifier, :null => false - t.text :content - t.timestamps - end - add_index :cms_blocks, [:page_id, :identifier] - - # -- Snippets ----------------------------------------------------------- - create_table :cms_snippets do |t| - t.integer :site_id, :null => false - t.string :label, :null => false - t.string :identifier, :null => false - t.text :content, text_limit - t.integer :position, :null => false, :default => 0 - t.boolean :is_shared, :null => false, :default => false - t.timestamps - end - add_index :cms_snippets, [:site_id, :identifier], :unique => true - add_index :cms_snippets, [:site_id, :position] - - # -- Files -------------------------------------------------------------- - create_table :cms_files do |t| - t.integer :site_id, :null => false - t.integer :block_id - t.string :label, :null => false - t.string :file_file_name, :null => false - t.string :file_content_type, :null => false - t.integer :file_file_size, :null => false - t.string :description, :limit => 2048 - t.integer :position, :null => false, :default => 0 - t.timestamps - end - add_index :cms_files, [:site_id, :label] - add_index :cms_files, [:site_id, :file_file_name] - add_index :cms_files, [:site_id, :position] - add_index :cms_files, [:site_id, :block_id] - - # -- Revisions ----------------------------------------------------------- - create_table :cms_revisions, :force => true do |t| - t.string :record_type, :null => false - t.integer :record_id, :null => false - t.text :data, text_limit - t.datetime :created_at - end - add_index :cms_revisions, [:record_type, :record_id, :created_at] - - # -- Categories --------------------------------------------------------- - create_table :cms_categories, :force => true do |t| - t.integer :site_id, :null => false - t.string :label, :null => false - t.string :categorized_type, :null => false - end - add_index :cms_categories, [:site_id, :categorized_type, :label], :unique => true - - create_table :cms_categorizations, :force => true do |t| - t.integer :category_id, :null => false - t.string :categorized_type, :null => false - t.integer :categorized_id, :null => false - end - add_index :cms_categorizations, [:category_id, :categorized_type, :categorized_id], :unique => true, - :name => 'index_cms_categorizations_on_cat_id_and_catd_type_and_catd_id' - end - - def self.down - drop_table :cms_sites - drop_table :cms_layouts - drop_table :cms_pages - drop_table :cms_snippets - drop_table :cms_blocks - drop_table :cms_files - drop_table :cms_revisions - drop_table :cms_categories - drop_table :cms_categorizations - end -end - diff --git a/db/migrate/20121010004400_add_long_description_to_distributors_and_suppliers.rb b/db/migrate/20121010004400_add_long_description_to_distributors_and_suppliers.rb deleted file mode 100644 index 7b3e2aa9f1..0000000000 --- a/db/migrate/20121010004400_add_long_description_to_distributors_and_suppliers.rb +++ /dev/null @@ -1,6 +0,0 @@ -class AddLongDescriptionToDistributorsAndSuppliers < ActiveRecord::Migration - def change - add_column :distributors, :long_description, :text - add_column :suppliers, :long_description, :text - end -end diff --git a/db/migrate/20121018002907_add_group_buy_unit_size_to_products.rb b/db/migrate/20121018002907_add_group_buy_unit_size_to_products.rb deleted file mode 100644 index 4abc9e5923..0000000000 --- a/db/migrate/20121018002907_add_group_buy_unit_size_to_products.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddGroupBuyUnitSizeToProducts < ActiveRecord::Migration - def change - add_column :spree_products, :group_buy_unit_size, :string - end -end diff --git a/db/migrate/20121025012233_combine_suppliers_and_distributors_into_enterprises.rb b/db/migrate/20121025012233_combine_suppliers_and_distributors_into_enterprises.rb deleted file mode 100644 index 7eff3e6961..0000000000 --- a/db/migrate/20121025012233_combine_suppliers_and_distributors_into_enterprises.rb +++ /dev/null @@ -1,69 +0,0 @@ -class CombineSuppliersAndDistributorsIntoEnterprises < ActiveRecord::Migration - class Supplier < ActiveRecord::Base; end - class Distributor < ActiveRecord::Base; end - class Enterprise < ActiveRecord::Base; end - class ProductDistribution < ActiveRecord::Base; end - class Spree::Product < ActiveRecord::Base; end - class Spree::Order < ActiveRecord::Base; end - - - def up - # Create enterprises table - create_table :enterprises do |t| - t.string :name - t.string :description - t.text :long_description - t.boolean :is_primary_producer - t.boolean :is_distributor - t.string :contact - t.string :phone - t.string :email - t.string :website - t.string :twitter - t.string :abn - t.string :acn - t.integer :address_id - t.string :pickup_times - t.integer :pickup_address_id - t.string :next_collection_at - t.timestamps - end - - # Copy suppliers to enterprises table with primary producer flag set - updated_product_ids = [-1] - Supplier.all.each do |s| - attrs = s.attributes - attrs.reject! { |k| k == 'id' } - attrs.merge! is_primary_producer: true, is_distributor: false - e = Enterprise.create! attrs - - # Update supplier_id on product to point at the new enterprise - product_ids = Spree::Product.where(:supplier_id => s.id).pluck(:id) - Spree::Product.update_all("supplier_id=#{e.id}", "supplier_id=#{s.id} AND id NOT IN (#{updated_product_ids.join(', ')})") - updated_product_ids += product_ids - end - - # Copy distributors to enterprises table with distributor flag set - updated_product_distribution_ids = [-1] - updated_order_ids = [-1] - Distributor.all.each do |d| - attrs = d.attributes - attrs['website'] = attrs['url'] - attrs.reject! { |k| ['id', 'url'].include? k } - attrs.merge! is_primary_producer: false, is_distributor: true - e = Enterprise.create! attrs - - # Update distributor_id on product distribution and order to point at the new enterprise - product_distribution_ids = ProductDistribution.where(:distributor_id => d.id).pluck(:id) - order_ids = Spree::Order.where(:distributor_id => d.id).pluck(:id) - ProductDistribution.update_all("distributor_id=#{e.id}", "distributor_id=#{d.id} AND id NOT IN (#{updated_product_distribution_ids.join(', ')})") - Spree::Order.update_all("distributor_id=#{e.id}", "distributor_id=#{d.id} AND id NOT IN (#{updated_order_ids.join(', ')})") - updated_product_distribution_ids += product_distribution_ids - updated_order_ids += order_ids - end - end - - def down - drop_table :enterprises - end -end diff --git a/db/migrate/20121028070200_remove_pickup_address_from_enterprises.rb b/db/migrate/20121028070200_remove_pickup_address_from_enterprises.rb deleted file mode 100644 index d1c7fd0d56..0000000000 --- a/db/migrate/20121028070200_remove_pickup_address_from_enterprises.rb +++ /dev/null @@ -1,21 +0,0 @@ -class RemovePickupAddressFromEnterprises < ActiveRecord::Migration - class Enterprise < ActiveRecord::Base; end - - def up - Enterprise.all.each do |e| - e.address_id ||= e.pickup_address_id - e.save! - end - - remove_column :enterprises, :pickup_address_id - end - - def down - add_column :enterprises, :pickup_address_id, :integer - - Enterprise.all.each do |e| - e.pickup_address_id ||= e.address_id - e.save! - end - end -end diff --git a/db/migrate/20121031203807_change_group_buy_unit_size_from_string_to_float.rb b/db/migrate/20121031203807_change_group_buy_unit_size_from_string_to_float.rb deleted file mode 100644 index 44caf3beaa..0000000000 --- a/db/migrate/20121031203807_change_group_buy_unit_size_from_string_to_float.rb +++ /dev/null @@ -1,21 +0,0 @@ -class ChangeGroupBuyUnitSizeFromStringToFloat < ActiveRecord::Migration - class Spree::Product < ActiveRecord::Base; end - - def up - add_column :spree_products, :group_buy_unit_size_f, :float - Spree::Product.reset_column_information - - Spree::Product.all.each do |product| - product.group_buy_unit_size_f = product.group_buy_unit_size.to_f - product.save! - end - - remove_column :spree_products, :group_buy_unit_size - rename_column :spree_products, :group_buy_unit_size_f, :group_buy_unit_size - end - - def down - change_column :spree_products, :group_buy_unit_size, :string - end - -end diff --git a/db/migrate/20121031222403_remove_suppliers_and_distributors.rb b/db/migrate/20121031222403_remove_suppliers_and_distributors.rb deleted file mode 100644 index ece31be171..0000000000 --- a/db/migrate/20121031222403_remove_suppliers_and_distributors.rb +++ /dev/null @@ -1,37 +0,0 @@ -class RemoveSuppliersAndDistributors < ActiveRecord::Migration - def up - drop_table :suppliers - drop_table :distributors - end - - def down - create_table "distributors" do |t| - t.string :name - t.string :contact - t.string :phone - t.string :email - t.string :pickup_times - t.string :url - t.string :abn - t.string :acn - t.string :description - t.datetime :created_at - t.datetime :updated_at - t.integer :pickup_address_id - t.string :next_collection_at - t.text :long_description - end - - create_table "suppliers" do |t| - t.string :name - t.string :description - t.string :email - t.string :twitter - t.string :website - t.datetime :created_at - t.datetime :updated_at - t.integer :address_id - t.text :long_description - end - end -end diff --git a/db/migrate/20121115010717_create_enterprise_fees.rb b/db/migrate/20121115010717_create_enterprise_fees.rb deleted file mode 100644 index 00c3057bfb..0000000000 --- a/db/migrate/20121115010717_create_enterprise_fees.rb +++ /dev/null @@ -1,11 +0,0 @@ -class CreateEnterpriseFees < ActiveRecord::Migration - def change - create_table :enterprise_fees do |t| - t.references :enterprise - t.string :fee_type - t.string :name - - t.timestamps - end - end -end diff --git a/db/migrate/20121125232613_create_order_cycles.rb b/db/migrate/20121125232613_create_order_cycles.rb deleted file mode 100644 index 9d0e4bab90..0000000000 --- a/db/migrate/20121125232613_create_order_cycles.rb +++ /dev/null @@ -1,35 +0,0 @@ -class CreateOrderCycles < ActiveRecord::Migration - def change - create_table :order_cycles do |t| - t.string :name - t.datetime :orders_open_at - t.datetime :orders_close_at - t.references :coordinator - t.references :coordinator_admin_fee - t.references :coordinator_sales_fee - t.timestamps - end - - create_table :exchanges do |t| - t.references :order_cycle - t.references :sender - t.references :receiver - t.references :payment_enterprise - t.datetime :pickup_time - t.string :pickup_instructions - t.timestamps - end - - create_table :exchange_variants do |t| - t.references :exchange - t.references :variant - t.timestamps - end - - create_table :exchange_fees do |t| - t.references :exchange - t.references :enterprise_fee - t.timestamps - end - end -end diff --git a/db/migrate/20130118031610_change_exchange_pickup_time_to_string.rb b/db/migrate/20130118031610_change_exchange_pickup_time_to_string.rb deleted file mode 100644 index 1fca44c81b..0000000000 --- a/db/migrate/20130118031610_change_exchange_pickup_time_to_string.rb +++ /dev/null @@ -1,9 +0,0 @@ -class ChangeExchangePickupTimeToString < ActiveRecord::Migration - def up - change_column :exchanges, :pickup_time, :string - end - - def down - change_column :exchanges, :pickup_time, :datetime - end -end diff --git a/db/migrate/20130130204355_add_order_cycle_id_to_orders.rb b/db/migrate/20130130204355_add_order_cycle_id_to_orders.rb deleted file mode 100644 index 871cb2b2f7..0000000000 --- a/db/migrate/20130130204355_add_order_cycle_id_to_orders.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddOrderCycleIdToOrders < ActiveRecord::Migration - def change - add_column :spree_orders, :order_cycle_id, :integer - end -end diff --git a/db/migrate/20130207043036_create_tokenized_permissions_table.spree.rb b/db/migrate/20130207043036_create_tokenized_permissions_table.spree.rb deleted file mode 100644 index 91c8ad18ab..0000000000 --- a/db/migrate/20130207043036_create_tokenized_permissions_table.spree.rb +++ /dev/null @@ -1,17 +0,0 @@ -# This migration comes from spree (originally 20120509055454) -class CreateTokenizedPermissionsTable < ActiveRecord::Migration - def change - unless Spree::TokenizedPermission.table_exists? - create_table :spree_tokenized_permissions do |t| - t.integer :permissable_id - t.string :permissable_type - t.string :token - - t.timestamps - end - - add_index :spree_tokenized_permissions, [:permissable_id, :permissable_type], :name => 'index_tokenized_name_and_type' - end - end -end - diff --git a/db/migrate/20130207043037_rename_creditcards_to_credit_cards.spree.rb b/db/migrate/20130207043037_rename_creditcards_to_credit_cards.spree.rb deleted file mode 100644 index b6d61a8a8c..0000000000 --- a/db/migrate/20130207043037_rename_creditcards_to_credit_cards.spree.rb +++ /dev/null @@ -1,12 +0,0 @@ -# This migration comes from spree (originally 20120530012000) -class RenameCreditcardsToCreditCards < ActiveRecord::Migration - def change - rename_table :spree_creditcards, :spree_credit_cards - execute("UPDATE spree_payments SET source_type = 'Spree::CreditCard' WHERE source_type = 'Spree::Creditcard'") - end - - def down - execute("UPDATE spree_payments SET source_type = 'Spree::Creditcard' WHERE source_type = 'Spree::CreditCard'") - rename_table :spree_credit_cards, :spree_creditcards - end -end diff --git a/db/migrate/20130207043038_remove_credit_total_from_orders.spree.rb b/db/migrate/20130207043038_remove_credit_total_from_orders.spree.rb deleted file mode 100644 index 09559d50fa..0000000000 --- a/db/migrate/20130207043038_remove_credit_total_from_orders.spree.rb +++ /dev/null @@ -1,6 +0,0 @@ -# This migration comes from spree (originally 20120604203654) -class RemoveCreditTotalFromOrders < ActiveRecord::Migration - def change - remove_column :spree_orders, :credit_total - end -end diff --git a/db/migrate/20130207043039_add_tax_rate_label.spree.rb b/db/migrate/20130207043039_add_tax_rate_label.spree.rb deleted file mode 100644 index c39a83c5ee..0000000000 --- a/db/migrate/20130207043039_add_tax_rate_label.spree.rb +++ /dev/null @@ -1,6 +0,0 @@ -# This migration comes from spree (originally 20120905145253) -class AddTaxRateLabel < ActiveRecord::Migration - def change - add_column :spree_tax_rates, :name, :string - end -end diff --git a/db/migrate/20130207043040_add_toggle_tax_rate_display.spree.rb b/db/migrate/20130207043040_add_toggle_tax_rate_display.spree.rb deleted file mode 100644 index 83da18b4f4..0000000000 --- a/db/migrate/20130207043040_add_toggle_tax_rate_display.spree.rb +++ /dev/null @@ -1,6 +0,0 @@ -# This migration comes from spree (originally 20120905151823) -class AddToggleTaxRateDisplay < ActiveRecord::Migration - def change - add_column :spree_tax_rates, :show_rate_in_label, :boolean, :default => true - end -end diff --git a/db/migrate/20130207043041_add_lock_version_to_variant.spree.rb b/db/migrate/20130207043041_add_lock_version_to_variant.spree.rb deleted file mode 100644 index 0e8cc92328..0000000000 --- a/db/migrate/20130207043041_add_lock_version_to_variant.spree.rb +++ /dev/null @@ -1,6 +0,0 @@ -# This migration comes from spree (originally 20121009142519) -class AddLockVersionToVariant < ActiveRecord::Migration - def change - add_column :spree_variants, :lock_version, :integer, :default => 0 - end -end diff --git a/db/migrate/20130207043042_remove_not_null_constraint_from_products_on_hand.spree.rb b/db/migrate/20130207043042_remove_not_null_constraint_from_products_on_hand.spree.rb deleted file mode 100644 index acbebfc6cb..0000000000 --- a/db/migrate/20130207043042_remove_not_null_constraint_from_products_on_hand.spree.rb +++ /dev/null @@ -1,12 +0,0 @@ -# This migration comes from spree (originally 20121017010007) -class RemoveNotNullConstraintFromProductsOnHand < ActiveRecord::Migration - def up - change_column :spree_products, :count_on_hand, :integer, :null => true - change_column :spree_variants, :count_on_hand, :integer, :null => true - end - - def down - change_column :spree_products, :count_on_hand, :integer, :null => false - change_column :spree_variants, :count_on_hand, :integer, :null => false - end -end diff --git a/db/migrate/20130207043043_add_position_to_taxonomies.spree.rb b/db/migrate/20130207043043_add_position_to_taxonomies.spree.rb deleted file mode 100644 index 177870b42a..0000000000 --- a/db/migrate/20130207043043_add_position_to_taxonomies.spree.rb +++ /dev/null @@ -1,6 +0,0 @@ -# This migration comes from spree (originally 20121124203911) -class AddPositionToTaxonomies < ActiveRecord::Migration - def change - add_column :spree_taxonomies, :position, :integer, :default => 0 - end -end diff --git a/db/migrate/20130207043044_add_identifier_to_spree_payments.spree.rb b/db/migrate/20130207043044_add_identifier_to_spree_payments.spree.rb deleted file mode 100644 index 91a65d92cb..0000000000 --- a/db/migrate/20130207043044_add_identifier_to_spree_payments.spree.rb +++ /dev/null @@ -1,6 +0,0 @@ -# This migration comes from spree (originally 20130203232234) -class AddIdentifierToSpreePayments < ActiveRecord::Migration - def change - add_column :spree_payments, :identifier, :string - end -end diff --git a/db/migrate/20130207043046_rename_api_key_to_spree_api_key.spree_api.rb b/db/migrate/20130207043046_rename_api_key_to_spree_api_key.spree_api.rb deleted file mode 100644 index 7fd09d3b11..0000000000 --- a/db/migrate/20130207043046_rename_api_key_to_spree_api_key.spree_api.rb +++ /dev/null @@ -1,8 +0,0 @@ -# This migration comes from spree_api (originally 20120530054546) -class RenameApiKeyToSpreeApiKey < ActiveRecord::Migration - def change - unless defined?(User) - rename_column :spree_users, :api_key, :spree_api_key - end - end -end diff --git a/db/migrate/20130207043047_create_users.spree_auth.rb b/db/migrate/20130207043047_create_users.spree_auth.rb deleted file mode 100644 index a4e8e602d2..0000000000 --- a/db/migrate/20130207043047_create_users.spree_auth.rb +++ /dev/null @@ -1,30 +0,0 @@ -# This migration comes from spree_auth (originally 20101026184949) -class CreateUsers < ActiveRecord::Migration - def up - unless table_exists?("spree_users") - create_table "spree_users", :force => true do |t| - t.string "crypted_password", :limit => 128 - t.string "salt", :limit => 128 - t.string "email" - t.string "remember_token" - t.string "remember_token_expires_at" - t.string "persistence_token" - t.string "single_access_token" - t.string "perishable_token" - t.integer "login_count", :default => 0, :null => false - t.integer "failed_login_count", :default => 0, :null => false - t.datetime "last_request_at" - t.datetime "current_login_at" - t.datetime "last_login_at" - t.string "current_login_ip" - t.string "last_login_ip" - t.string "login" - t.integer "ship_address_id" - t.integer "bill_address_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.string "openid_identifier" - end - end - end -end diff --git a/db/migrate/20130207043541_spree_one_two.spree.rb b/db/migrate/20130207043541_spree_one_two.spree.rb deleted file mode 100644 index ad81bfeabe..0000000000 --- a/db/migrate/20130207043541_spree_one_two.spree.rb +++ /dev/null @@ -1,482 +0,0 @@ -# This migration comes from spree (originally 20120831092320) -class SpreeOneTwo < ActiveRecord::Migration - def up - # This migration is just a compressed version of all the previous - # migrations for spree_core. Do not run it if one of the core tables - # already exists. Assume the best. - return if table_exists?(:spree_addresses) - - - create_table :spree_activators do |t| - t.string :description - t.datetime :expires_at - t.datetime :starts_at - t.string :name - t.string :event_name - t.string :type - t.integer :usage_limit - t.string :match_policy, :default => 'all' - t.string :code - t.boolean :advertise, :default => false - t.string :path - t.timestamps - end - - create_table :spree_addresses do |t| - t.string :firstname - t.string :lastname - t.string :address1 - t.string :address2 - t.string :city - t.string :zipcode - t.string :phone - t.string :state_name - t.string :alternative_phone - t.string :company - t.references :state - t.references :country - t.timestamps - end - - add_index :spree_addresses, [:firstname], :name => 'index_addresses_on_firstname' - add_index :spree_addresses, [:lastname], :name => 'index_addresses_on_lastname' - - create_table :spree_adjustments do |t| - t.references :source, :polymorphic => true - t.references :adjustable, :polymorphic => true - t.references :originator, :polymorphic => true - t.decimal :amount, :precision => 8, :scale => 2 - t.string :label - t.boolean :mandatory - t.boolean :locked - t.boolean :eligible, :default => true - t.timestamps - end - - add_index :spree_adjustments, [:adjustable_id], :name => 'index_adjustments_on_order_id' - - create_table :spree_assets do |t| - t.references :viewable, :polymorphic => true - t.integer :attachment_width - t.integer :attachment_height - t.integer :attachment_file_size - t.integer :position - t.string :attachment_content_type - t.string :attachment_file_name - t.string :type, :limit => 75 - t.datetime :attachment_updated_at - t.text :alt - end - - 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| - t.string :type - t.references :calculable, :polymorphic => true - t.timestamps - end - - create_table :spree_configurations do |t| - t.string :name - t.string :type, :limit => 50 - t.timestamps - end - - add_index :spree_configurations, [:name, :type], :name => 'index_spree_configurations_on_name_and_type' - - create_table :spree_countries do |t| - t.string :iso_name - t.string :iso - t.string :iso3 - t.string :name - t.integer :numcode - end - - create_table :spree_credit_cards do |t| - t.string :month - t.string :year - t.string :cc_type - t.string :last_digits - t.string :first_name - t.string :last_name - t.string :start_month - t.string :start_year - t.string :issue_number - t.references :address - t.string :gateway_customer_profile_id - t.string :gateway_payment_profile_id - t.timestamps - end - - create_table :spree_gateways do |t| - t.string :type - t.string :name - t.text :description - t.boolean :active, :default => true - t.string :environment, :default => 'development' - t.string :server, :default => 'test' - t.boolean :test_mode, :default => true - t.timestamps - end - - create_table :spree_inventory_units do |t| - t.integer :lock_version, :default => 0 - t.string :state - t.references :variant - t.references :order - t.references :shipment - t.references :return_authorization - t.timestamps - end - - 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' - - create_table :spree_line_items do |t| - t.references :variant - t.references :order - t.integer :quantity, :null => false - t.decimal :price, :precision => 8, :scale => 2, :null => false - t.timestamps - end - - 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| - t.references :source, :polymorphic => true - t.text :details - t.timestamps - end - - create_table :spree_mail_methods do |t| - t.string :environment - t.boolean :active, :default => true - t.timestamps - end - - create_table :spree_option_types do |t| - t.string :name, :limit => 100 - t.string :presentation, :limit => 100 - t.integer :position, :default => 0, :null => false - t.timestamps - end - - create_table :spree_option_types_prototypes, :id => false do |t| - t.references :prototype - t.references :option_type - end - - create_table :spree_option_values do |t| - t.integer :position - t.string :name - t.string :presentation - t.references :option_type - t.timestamps - end - - create_table :spree_option_values_variants, :id => false do |t| - t.references :variant - t.references :option_value - 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' - - create_table :spree_orders do |t| - t.string :number, :limit => 15 - t.decimal :item_total, :precision => 8, :scale => 2, :default => 0.0, :null => false - t.decimal :total, :precision => 8, :scale => 2, :default => 0.0, :null => false - t.string :state - t.decimal :adjustment_total, :precision => 8, :scale => 2, :default => 0.0, :null => false - t.references :user - t.datetime :completed_at - t.references :bill_address - t.references :ship_address - t.decimal :payment_total, :precision => 8, :scale => 2, :default => 0.0 - t.references :shipping_method - t.string :shipment_state - t.string :payment_state - t.string :email - t.text :special_instructions - t.timestamps - end - - add_index :spree_orders, [:number], :name => 'index_spree_orders_on_number' - - create_table :spree_payment_methods do |t| - t.string :type - t.string :name - t.text :description - t.boolean :active, :default => true - t.string :environment, :default => 'development' - t.datetime :deleted_at - t.string :display_on - t.timestamps - end - - create_table :spree_payments do |t| - t.decimal :amount, :precision => 8, :scale => 2, :default => 0.0, :null => false - t.references :order - t.references :source, :polymorphic => true - t.references :payment_method - t.string :state - t.string :response_code - t.string :avs_response - t.timestamps - end - - create_table :spree_preferences do |t| - t.string :name, :limit => 100 - t.references :owner, :polymorphic => true - t.text :value - t.string :key - t.string :value_type - t.timestamps - end - - add_index :spree_preferences, [:key], :name => 'index_spree_preferences_on_key', :unique => true - - create_table :spree_product_option_types do |t| - t.integer :position - t.references :product - t.references :option_type - t.timestamps - end - - create_table :spree_product_properties do |t| - t.string :value - t.references :product - t.references :property - t.timestamps - end - - add_index :spree_product_properties, [:product_id], :name => 'index_product_properties_on_product_id' - - create_table :spree_products do |t| - t.string :name, :default => '', :null => false - t.text :description - t.datetime :available_on - t.datetime :deleted_at - t.string :permalink - t.string :meta_description - t.string :meta_keywords - t.references :tax_category - t.references :shipping_category - t.integer :count_on_hand, :default => 0, :null => false - t.timestamps - 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' - - create_table :spree_products_taxons, :id => false do |t| - t.references :product - t.references :taxon - 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' - - create_table :spree_properties do |t| - t.string :name - t.string :presentation, :null => false - t.timestamps - end - - create_table :spree_properties_prototypes, :id => false do |t| - t.references :prototype - t.references :property - end - - create_table :spree_prototypes do |t| - t.string :name - t.timestamps - end - - create_table :spree_return_authorizations do |t| - t.string :number - t.string :state - t.decimal :amount, :precision => 8, :scale => 2, :default => 0.0, :null => false - t.references :order - t.text :reason - t.timestamps - end - - create_table :spree_roles do |t| - t.string :name - end - - create_table :spree_roles_users, :id => false do |t| - t.references :role - t.references :user - end - - add_index :spree_roles_users, [:role_id], :name => 'index_spree_roles_users_on_role_id' - add_index :spree_roles_users, [:user_id], :name => 'index_spree_roles_users_on_user_id' - - create_table :spree_shipments do |t| - t.string :tracking - t.string :number - t.decimal :cost, :precision => 8, :scale => 2 - t.datetime :shipped_at - t.references :order - t.references :shipping_method - t.references :address - t.string :state - t.timestamps - end - - add_index :spree_shipments, [:number], :name => 'index_shipments_on_number' - - create_table :spree_shipping_categories do |t| - t.string :name - t.timestamps - end - - create_table :spree_shipping_methods do |t| - t.string :name - t.references :zone - t.string :display_on - t.references :shipping_category - t.boolean :match_none - t.boolean :match_all - t.boolean :match_one - t.datetime :deleted_at - t.timestamps - end - - create_table :spree_state_changes do |t| - t.string :name - t.string :previous_state - t.references :stateful - t.references :user - t.string :stateful_type - t.string :next_state - t.timestamps - end - - create_table :spree_states do |t| - t.string :name - t.string :abbr - t.references :country - end - - create_table :spree_tax_categories do |t| - t.string :name - t.string :description - t.boolean :is_default, :default => false - t.datetime :deleted_at - t.timestamps - end - - create_table :spree_tax_rates do |t| - t.decimal :amount, :precision => 8, :scale => 5 - t.references :zone - t.references :tax_category - t.boolean :included_in_price, :default => false - t.timestamps - end - - create_table :spree_taxonomies do |t| - t.string :name, :null => false - t.timestamps - end - - create_table :spree_taxons do |t| - t.references :parent - t.integer :position, :default => 0 - t.string :name, :null => false - t.string :permalink - t.references :taxonomy - t.integer :lft - t.integer :rgt - t.string :icon_file_name - t.string :icon_content_type - t.integer :icon_file_size - t.datetime :icon_updated_at - t.text :description - 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, [:taxonomy_id], :name => 'index_taxons_on_taxonomy_id' - - create_table :spree_tokenized_permissions, :force => true do |t| - t.references :permissable, :polymorphic => true - t.string :token - t.timestamps - end - - add_index :spree_tokenized_permissions, [:permissable_id, :permissable_type], :name => 'index_tokenized_name_and_type' - - create_table :spree_trackers do |t| - t.string :environment - t.string :analytics_id - t.boolean :active, :default => true - t.timestamps - end - - create_table :spree_users do |t| - t.string :encrypted_password, :limit => 128 - t.string :password_salt, :limit => 128 - t.string :email - t.string :remember_token - t.string :persistence_token - t.string :reset_password_token - t.string :perishable_token - t.integer :sign_in_count, :default => 0, :null => false - t.integer :failed_attempts, :default => 0, :null => false - t.datetime :last_request_at - t.datetime :current_sign_in_at - t.datetime :last_sign_in_at - t.string :current_sign_in_ip - t.string :last_sign_in_ip - t.string :login - t.references :ship_address - t.references :bill_address - t.string :authentication_token - t.string :unlock_token - t.datetime :locked_at - t.datetime :remember_created_at - t.datetime :reset_password_sent_at - t.timestamps - end - - create_table :spree_variants do |t| - t.string :sku, :default => '', :null => false - t.decimal :price, :precision => 8, :scale => 2, :null => false - t.decimal :weight, :precision => 8, :scale => 2 - t.decimal :height, :precision => 8, :scale => 2 - t.decimal :width, :precision => 8, :scale => 2 - t.decimal :depth, :precision => 8, :scale => 2 - t.datetime :deleted_at - t.boolean :is_master, :default => false - t.references :product - t.integer :count_on_hand, :default => 0, :null => false - t.decimal :cost_price, :precision => 8, :scale => 2 - t.integer :position - end - - add_index :spree_variants, [:product_id], :name => 'index_spree_variants_on_product_id' - - create_table :spree_zone_members do |t| - t.references :zoneable, :polymorphic => true - t.references :zone - t.timestamps - end - - create_table :spree_zones do |t| - t.string :name - t.string :description - t.boolean :default_tax, :default => false - t.integer :zone_members_count, :default => 0 - t.timestamps - end - end -end diff --git a/db/migrate/20130207043542_remove_unused_preference_columns.spree.rb b/db/migrate/20130207043542_remove_unused_preference_columns.spree.rb deleted file mode 100644 index 6c049daa22..0000000000 --- a/db/migrate/20130207043542_remove_unused_preference_columns.spree.rb +++ /dev/null @@ -1,9 +0,0 @@ -# This migration comes from spree (originally 20120929093553) -class RemoveUnusedPreferenceColumns < ActiveRecord::Migration - def change - # Columns have already been removed if the application was upgraded from an older version, but must be removed from new apps. - remove_column :spree_preferences, :name if ActiveRecord::Base.connection.column_exists?(:spree_preferences, :name) - remove_column :spree_preferences, :owner_id if ActiveRecord::Base.connection.column_exists?(:spree_preferences, :owner_id) - remove_column :spree_preferences, :owner_type if ActiveRecord::Base.connection.column_exists?(:spree_preferences, :owner_type) - end -end diff --git a/db/migrate/20130207043543_add_states_required_to_countries.spree.rb b/db/migrate/20130207043543_add_states_required_to_countries.spree.rb deleted file mode 100644 index 415001d170..0000000000 --- a/db/migrate/20130207043543_add_states_required_to_countries.spree.rb +++ /dev/null @@ -1,6 +0,0 @@ -# This migration comes from spree (originally 20121010142909) -class AddStatesRequiredToCountries < ActiveRecord::Migration - def change - add_column :spree_countries, :states_required, :boolean,:default => true - end -end diff --git a/db/migrate/20130207043544_add_on_demand_to_product_and_variant.spree.rb b/db/migrate/20130207043544_add_on_demand_to_product_and_variant.spree.rb deleted file mode 100644 index ba258ebf26..0000000000 --- a/db/migrate/20130207043544_add_on_demand_to_product_and_variant.spree.rb +++ /dev/null @@ -1,7 +0,0 @@ -# This migration comes from spree (originally 20121012071449) -class AddOnDemandToProductAndVariant < ActiveRecord::Migration - def change - add_column :spree_products, :on_demand, :boolean, :default => false - add_column :spree_variants, :on_demand, :boolean, :default => false - end -end diff --git a/db/migrate/20130207043545_split_prices_from_variants.spree.rb b/db/migrate/20130207043545_split_prices_from_variants.spree.rb deleted file mode 100644 index f22753470f..0000000000 --- a/db/migrate/20130207043545_split_prices_from_variants.spree.rb +++ /dev/null @@ -1,32 +0,0 @@ -# This migration comes from spree (originally 20121031162139) -class SplitPricesFromVariants < ActiveRecord::Migration - def up - create_table :spree_prices do |t| - t.integer :variant_id, :null => false - t.decimal :amount, :precision => 8, :scale => 2, :null => false - t.string :currency - end - - Spree::Variant.all.each do |variant| - Spree::Price.create!( - :variant_id => variant.id, - :amount => variant[:price], - :currency => Spree::Config[:currency] - ) - end - - remove_column :spree_variants, :price - end - - def down - prices = ActiveRecord::Base.connection.execute("select variant_id, amount from spree_prices") - add_column :spree_variants, :price, :decimal, :after => :sku, :scale => 2, :precision => 8 - - prices.each do |price| - ActiveRecord::Base.connection.execute("update spree_variants set price = #{price['amount']} where id = #{price['variant_id']}") - end - - change_column :spree_variants, :price, :decimal, :after => :sku, :scale => 2, :precision => 8, :null => false - drop_table :spree_prices - end -end diff --git a/db/migrate/20130207043546_remove_not_null_from_spree_prices_amount.spree.rb b/db/migrate/20130207043546_remove_not_null_from_spree_prices_amount.spree.rb deleted file mode 100644 index beb5f7a85f..0000000000 --- a/db/migrate/20130207043546_remove_not_null_from_spree_prices_amount.spree.rb +++ /dev/null @@ -1,10 +0,0 @@ -# This migration comes from spree (originally 20121107003422) -class RemoveNotNullFromSpreePricesAmount < ActiveRecord::Migration - def up - change_column :spree_prices, :amount, :decimal, :precision => 8, :scale => 2, :null => true - end - - def down - change_column :spree_prices, :amount, :decimal, :precision => 8, :scale => 2, :null => false - end -end diff --git a/db/migrate/20130207043547_add_currency_to_line_items.spree.rb b/db/migrate/20130207043547_add_currency_to_line_items.spree.rb deleted file mode 100644 index b0732ee630..0000000000 --- a/db/migrate/20130207043547_add_currency_to_line_items.spree.rb +++ /dev/null @@ -1,6 +0,0 @@ -# This migration comes from spree (originally 20121107184631) -class AddCurrencyToLineItems < ActiveRecord::Migration - def change - add_column :spree_line_items, :currency, :string - end -end diff --git a/db/migrate/20130207043548_add_currency_to_orders.spree.rb b/db/migrate/20130207043548_add_currency_to_orders.spree.rb deleted file mode 100644 index d84bc3b7cc..0000000000 --- a/db/migrate/20130207043548_add_currency_to_orders.spree.rb +++ /dev/null @@ -1,6 +0,0 @@ -# This migration comes from spree (originally 20121107194006) -class AddCurrencyToOrders < ActiveRecord::Migration - def change - add_column :spree_orders, :currency, :string - end -end diff --git a/db/migrate/20130207043549_add_cost_currency_to_variants.spree.rb b/db/migrate/20130207043549_add_cost_currency_to_variants.spree.rb deleted file mode 100644 index a31b96499d..0000000000 --- a/db/migrate/20130207043549_add_cost_currency_to_variants.spree.rb +++ /dev/null @@ -1,6 +0,0 @@ -# This migration comes from spree (originally 20121109173623) -class AddCostCurrencyToVariants < ActiveRecord::Migration - def change - add_column :spree_variants, :cost_currency, :string, :after => :cost_price - end -end diff --git a/db/migrate/20130207043550_remove_display_on_from_payment_methods.spree.rb b/db/migrate/20130207043550_remove_display_on_from_payment_methods.spree.rb deleted file mode 100644 index a763d823e9..0000000000 --- a/db/migrate/20130207043550_remove_display_on_from_payment_methods.spree.rb +++ /dev/null @@ -1,10 +0,0 @@ -# This migration comes from spree (originally 20121111231553) -class RemoveDisplayOnFromPaymentMethods < ActiveRecord::Migration - def up - remove_column :spree_payment_methods, :display_on - end - - def down - add_column :spree_payment_methods, :display_on, :string - end -end diff --git a/db/migrate/20130207043551_add_last_ip_to_spree_orders.spree.rb b/db/migrate/20130207043551_add_last_ip_to_spree_orders.spree.rb deleted file mode 100644 index e85fc41ffe..0000000000 --- a/db/migrate/20130207043551_add_last_ip_to_spree_orders.spree.rb +++ /dev/null @@ -1,6 +0,0 @@ -# This migration comes from spree (originally 20121126040517) -class AddLastIpToSpreeOrders < ActiveRecord::Migration - def change - add_column :spree_orders, :last_ip_address, :string - end -end diff --git a/db/migrate/20130207043552_add_display_on_to_spree_payment_methods.spree.rb b/db/migrate/20130207043552_add_display_on_to_spree_payment_methods.spree.rb deleted file mode 100644 index 240870bbb6..0000000000 --- a/db/migrate/20130207043552_add_display_on_to_spree_payment_methods.spree.rb +++ /dev/null @@ -1,10 +0,0 @@ -# This migration comes from spree (originally 20130114053446) -class AddDisplayOnToSpreePaymentMethods < ActiveRecord::Migration - def self.up - add_column :spree_payment_methods, :display_on, :string - end - - def self.down - remove_column :spree_payment_methods, :display_on - end -end diff --git a/db/migrate/20130207043553_add_position_to_product_properties.spree.rb b/db/migrate/20130207043553_add_position_to_product_properties.spree.rb deleted file mode 100644 index 93da5d87b1..0000000000 --- a/db/migrate/20130207043553_add_position_to_product_properties.spree.rb +++ /dev/null @@ -1,7 +0,0 @@ -# This migration comes from spree (originally 20130120201805) -class AddPositionToProductProperties < ActiveRecord::Migration - def change - add_column :spree_product_properties, :position, :integer, :default => 0 - end -end - diff --git a/db/migrate/20130207043554_add_api_key_to_spree_users.spree_api.rb b/db/migrate/20130207043554_add_api_key_to_spree_users.spree_api.rb deleted file mode 100644 index b9e3fe3884..0000000000 --- a/db/migrate/20130207043554_add_api_key_to_spree_users.spree_api.rb +++ /dev/null @@ -1,8 +0,0 @@ -# This migration comes from spree_api (originally 20100107141738) -class AddApiKeyToSpreeUsers < ActiveRecord::Migration - def change - unless defined?(User) - add_column :spree_users, :api_key, :string, :limit => 40 - end - end -end diff --git a/db/migrate/20130207043555_spree_promo_one_two.spree_promo.rb b/db/migrate/20130207043555_spree_promo_one_two.spree_promo.rb deleted file mode 100644 index 7e808c800b..0000000000 --- a/db/migrate/20130207043555_spree_promo_one_two.spree_promo.rb +++ /dev/null @@ -1,46 +0,0 @@ -# This migration comes from spree_promo (originally 20120831092359) -class SpreePromoOneTwo < ActiveRecord::Migration - def up - # This migration is just a compressed migration for all previous versions of spree_promo - return if table_exists?(:spree_products_promotion_rules) - - 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' - - 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.references :activator - t.integer :position - t.string :type - end - - 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' - - 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' - end -end diff --git a/db/migrate/20130426023034_add_distributor_info_to_enterprises.enterprises_distributor_info_rich_text_feature.rb b/db/migrate/20130426023034_add_distributor_info_to_enterprises.enterprises_distributor_info_rich_text_feature.rb deleted file mode 100644 index 69a6b9981e..0000000000 --- a/db/migrate/20130426023034_add_distributor_info_to_enterprises.enterprises_distributor_info_rich_text_feature.rb +++ /dev/null @@ -1,6 +0,0 @@ -# This migration comes from enterprises_distributor_info_rich_text_feature (originally 20130426022945) -class AddDistributorInfoToEnterprises < ActiveRecord::Migration - def change - add_column :enterprises, :distributor_info, :text - end -end diff --git a/db/migrate/20130629120633_add_order_id_index_to_payments.spree.rb b/db/migrate/20130629120633_add_order_id_index_to_payments.spree.rb deleted file mode 100644 index 49b378abb3..0000000000 --- a/db/migrate/20130629120633_add_order_id_index_to_payments.spree.rb +++ /dev/null @@ -1,10 +0,0 @@ -# This migration comes from spree (originally 20130207155350) -class AddOrderIdIndexToPayments < ActiveRecord::Migration - def self.up - add_index :spree_payments, :order_id - end - - def self.down - remove_index :spree_payments, :order_id - end -end diff --git a/db/migrate/20130629120634_add_primary_to_spree_products_taxons.spree.rb b/db/migrate/20130629120634_add_primary_to_spree_products_taxons.spree.rb deleted file mode 100644 index fd438d5c83..0000000000 --- a/db/migrate/20130629120634_add_primary_to_spree_products_taxons.spree.rb +++ /dev/null @@ -1,6 +0,0 @@ -# This migration comes from spree (originally 20130208032954) -class AddPrimaryToSpreeProductsTaxons < ActiveRecord::Migration - def change - add_column :spree_products_taxons, :id, :primary_key - end -end diff --git a/db/migrate/20130629120635_add_order_id_index_to_shipments.spree.rb b/db/migrate/20130629120635_add_order_id_index_to_shipments.spree.rb deleted file mode 100644 index 5d0ebdbc78..0000000000 --- a/db/migrate/20130629120635_add_order_id_index_to_shipments.spree.rb +++ /dev/null @@ -1,6 +0,0 @@ -# This migration comes from spree (originally 20130222032153) -class AddOrderIdIndexToShipments < ActiveRecord::Migration - def change - add_index :spree_shipments, :order_id - end -end diff --git a/db/migrate/20130629120636_change_meta_description_on_spree_products_to_text.spree.rb b/db/migrate/20130629120636_change_meta_description_on_spree_products_to_text.spree.rb deleted file mode 100644 index 66fff52115..0000000000 --- a/db/migrate/20130629120636_change_meta_description_on_spree_products_to_text.spree.rb +++ /dev/null @@ -1,6 +0,0 @@ -# This migration comes from spree (originally 20130226032817) -class ChangeMetaDescriptionOnSpreeProductsToText < ActiveRecord::Migration - def change - change_column :spree_products, :meta_description, :text, :limit => nil - end -end diff --git a/db/migrate/20130629120637_add_variant_id_index_to_spree_prices.spree.rb b/db/migrate/20130629120637_add_variant_id_index_to_spree_prices.spree.rb deleted file mode 100644 index 0a362f2ee8..0000000000 --- a/db/migrate/20130629120637_add_variant_id_index_to_spree_prices.spree.rb +++ /dev/null @@ -1,6 +0,0 @@ -# This migration comes from spree (originally 20130226054936) -class AddVariantIdIndexToSpreePrices < ActiveRecord::Migration - def change - add_index :spree_prices, :variant_id - end -end diff --git a/db/migrate/20130629120638_change_orders_total_precision.spree.rb b/db/migrate/20130629120638_change_orders_total_precision.spree.rb deleted file mode 100644 index cfb1c81e6a..0000000000 --- a/db/migrate/20130629120638_change_orders_total_precision.spree.rb +++ /dev/null @@ -1,9 +0,0 @@ -# This migration comes from spree (originally 20130319062004) -class ChangeOrdersTotalPrecision < ActiveRecord::Migration - def change - change_column :spree_orders, :item_total, :decimal, :precision => 10, :scale => 2, :default => 0.0, :null => false - change_column :spree_orders, :total, :decimal, :precision => 10, :scale => 2, :default => 0.0, :null => false - change_column :spree_orders, :adjustment_total, :decimal, :precision => 10, :scale => 2, :default => 0.0, :null => false - change_column :spree_orders, :payment_total, :decimal, :precision => 10, :scale => 2, :default => 0.0 - end -end diff --git a/db/migrate/20130629120639_change_spree_payments_amount_precision.spree.rb b/db/migrate/20130629120639_change_spree_payments_amount_precision.spree.rb deleted file mode 100644 index 2ac4630836..0000000000 --- a/db/migrate/20130629120639_change_spree_payments_amount_precision.spree.rb +++ /dev/null @@ -1,8 +0,0 @@ -# This migration comes from spree (originally 20130319063911) -class ChangeSpreePaymentsAmountPrecision < ActiveRecord::Migration - def change - - change_column :spree_payments, :amount, :decimal, :precision => 10, :scale => 2, :default => 0.0, :null => false - - end -end diff --git a/db/migrate/20130629120640_change_spree_return_authorization_amount_precision.spree.rb b/db/migrate/20130629120640_change_spree_return_authorization_amount_precision.spree.rb deleted file mode 100644 index cf6cc4b3c2..0000000000 --- a/db/migrate/20130629120640_change_spree_return_authorization_amount_precision.spree.rb +++ /dev/null @@ -1,8 +0,0 @@ -# This migration comes from spree (originally 20130319064308) -class ChangeSpreeReturnAuthorizationAmountPrecision < ActiveRecord::Migration - def change - - change_column :spree_return_authorizations, :amount, :decimal, :precision => 10, :scale => 2, :default => 0.0, :null => false - - end -end diff --git a/db/migrate/20130629120641_change_adjustments_amount_precision.spree.rb b/db/migrate/20130629120641_change_adjustments_amount_precision.spree.rb deleted file mode 100644 index f391987c40..0000000000 --- a/db/migrate/20130629120641_change_adjustments_amount_precision.spree.rb +++ /dev/null @@ -1,8 +0,0 @@ -# This migration comes from spree (originally 20130319082943) -class ChangeAdjustmentsAmountPrecision < ActiveRecord::Migration - def change - - change_column :spree_adjustments, :amount, :decimal, :precision => 10, :scale => 2 - - end -end diff --git a/db/migrate/20130629120642_add_seo_metas_to_taxons.spree.rb b/db/migrate/20130629120642_add_seo_metas_to_taxons.spree.rb deleted file mode 100644 index a947764a27..0000000000 --- a/db/migrate/20130629120642_add_seo_metas_to_taxons.spree.rb +++ /dev/null @@ -1,10 +0,0 @@ -# This migration comes from spree (originally 20130328195253) -class AddSeoMetasToTaxons < ActiveRecord::Migration - def change - change_table :spree_taxons do |t| - t.string :meta_title - t.string :meta_description - t.string :meta_keywords - end - end -end diff --git a/db/migrate/20130629120643_add_cvv_result_code_and_cvv_result_message_to_spree_payments.spree.rb b/db/migrate/20130629120643_add_cvv_result_code_and_cvv_result_message_to_spree_payments.spree.rb deleted file mode 100644 index 0f611c6336..0000000000 --- a/db/migrate/20130629120643_add_cvv_result_code_and_cvv_result_message_to_spree_payments.spree.rb +++ /dev/null @@ -1,7 +0,0 @@ -# This migration comes from spree (originally 20130626232741) -class AddCvvResultCodeAndCvvResultMessageToSpreePayments < ActiveRecord::Migration - def change - add_column :spree_payments, :cvv_response_code, :string - add_column :spree_payments, :cvv_response_message, :string - end -end diff --git a/db/migrate/20130629120644_add_unique_index_to_permalink_on_spree_products.spree.rb b/db/migrate/20130629120644_add_unique_index_to_permalink_on_spree_products.spree.rb deleted file mode 100644 index 310d487116..0000000000 --- a/db/migrate/20130629120644_add_unique_index_to_permalink_on_spree_products.spree.rb +++ /dev/null @@ -1,6 +0,0 @@ -# This migration comes from spree (originally 20130628021056) -class AddUniqueIndexToPermalinkOnSpreeProducts < ActiveRecord::Migration - def change - add_index "spree_products", ["permalink"], :name => "permalink_idx_unique", :unique => true - end -end diff --git a/db/migrate/20130629120645_add_unique_index_to_orders_shipments_and_stock_transfers.spree.rb b/db/migrate/20130629120645_add_unique_index_to_orders_shipments_and_stock_transfers.spree.rb deleted file mode 100644 index 054cc7402e..0000000000 --- a/db/migrate/20130629120645_add_unique_index_to_orders_shipments_and_stock_transfers.spree.rb +++ /dev/null @@ -1,7 +0,0 @@ -# This migration comes from spree (originally 20130628022817) -class AddUniqueIndexToOrdersShipmentsAndStockTransfers < ActiveRecord::Migration - def add - add_index "spree_orders", ["number"], :name => "number_idx_unique", :unique => true - add_index "spree_shipments", ["number"], :name => "number_idx_unique", :unique => true - end -end diff --git a/db/migrate/20130729021924_make_order_cycle_coordinator_fees_mtm.rb b/db/migrate/20130729021924_make_order_cycle_coordinator_fees_mtm.rb deleted file mode 100644 index ff88d3f493..0000000000 --- a/db/migrate/20130729021924_make_order_cycle_coordinator_fees_mtm.rb +++ /dev/null @@ -1,19 +0,0 @@ -class MakeOrderCycleCoordinatorFeesMtm < ActiveRecord::Migration - def up - remove_column :order_cycles, :coordinator_admin_fee_id - remove_column :order_cycles, :coordinator_sales_fee_id - - create_table :coordinator_fees, id: false do |t| - t.references :order_cycle - t.references :enterprise_fee - end - end - - def down - drop_table :coordinator_fees - - add_column :order_cycles, :coordinator_admin_fee_id, :integer - add_column :order_cycles, :coordinator_sales_fee_id, :integer - end - -end diff --git a/db/migrate/20130729030515_add_enterprise_role.rb b/db/migrate/20130729030515_add_enterprise_role.rb deleted file mode 100644 index 25a1deeeac..0000000000 --- a/db/migrate/20130729030515_add_enterprise_role.rb +++ /dev/null @@ -1,8 +0,0 @@ -class AddEnterpriseRole < ActiveRecord::Migration - def change - create_table :enterprise_roles do |t| - t.references :user, index: true - t.references :enterprise, index: true - end - end -end diff --git a/db/migrate/20130801005801_create_landing_page_images.rb b/db/migrate/20130801005801_create_landing_page_images.rb deleted file mode 100644 index 6b48464d0a..0000000000 --- a/db/migrate/20130801005801_create_landing_page_images.rb +++ /dev/null @@ -1,7 +0,0 @@ -class CreateLandingPageImages < ActiveRecord::Migration - def change - create_table :landing_page_images do |t| - t.timestamps - end - end -end diff --git a/db/migrate/20130801012854_add_attachment_photo_to_landing_page_image.rb b/db/migrate/20130801012854_add_attachment_photo_to_landing_page_image.rb deleted file mode 100644 index 72a4c40de9..0000000000 --- a/db/migrate/20130801012854_add_attachment_photo_to_landing_page_image.rb +++ /dev/null @@ -1,15 +0,0 @@ -class AddAttachmentPhotoToLandingPageImage < ActiveRecord::Migration - def self.up - add_column :landing_page_images, :photo_file_name, :string - add_column :landing_page_images, :photo_content_type, :string - add_column :landing_page_images, :photo_file_size, :integer - add_column :landing_page_images, :photo_updated_at, :datetime - end - - def self.down - remove_column :landing_page_images, :photo_file_name - remove_column :landing_page_images, :photo_content_type - remove_column :landing_page_images, :photo_file_size - remove_column :landing_page_images, :photo_updated_at - end -end diff --git a/db/migrate/20130805050109_update_line_item_caching.rb b/db/migrate/20130805050109_update_line_item_caching.rb deleted file mode 100644 index 42760e7c02..0000000000 --- a/db/migrate/20130805050109_update_line_item_caching.rb +++ /dev/null @@ -1,47 +0,0 @@ -class UpdateLineItemCaching < ActiveRecord::Migration - - class SpreeLineItem < ActiveRecord::Base - belongs_to :shipping_method, class_name: 'Spree::ShippingMethod' - belongs_to :variant, :class_name => "Spree::Variant" - - def itemwise_shipping_cost - order = OpenStruct.new :line_items => [self] - shipping_method.compute_amount(order) - end - - def amount - price * quantity - end - alias total amount - end - - - def up - add_column :spree_line_items, :distribution_fee, :decimal, precision: 10, scale: 2 - add_column :spree_line_items, :shipping_method_name, :string - - SpreeLineItem.all.each do |line_item| - line_item.update_column(:distribution_fee, line_item.itemwise_shipping_cost) - line_item.update_column(:shipping_method_name, line_item.shipping_method.name) - end - - remove_column :spree_line_items, :shipping_method_id - end - - def down - add_column :spree_line_items, :shipping_method_id, :integer - - SpreeLineItem.all.each do |line_item| - shipping_method = Spree::ShippingMethod.find_by_name(line_item.shipping_method_name) - unless shipping_method - say "Shipping method #{line_item.shipping_method_name} not found, using the first available shipping method for LineItem #{line_item.id}" - shipping_method = Spree::ShippingMethod.where("name != 'Delivery'").first - end - - line_item.update_column(:shipping_method_id, shipping_method.id) - end - - remove_column :spree_line_items, :distribution_fee - remove_column :spree_line_items, :shipping_method_name - end -end diff --git a/db/migrate/20130805232516_add_enterprise_fee_to_product_distributions.rb b/db/migrate/20130805232516_add_enterprise_fee_to_product_distributions.rb deleted file mode 100644 index b6154c1dd1..0000000000 --- a/db/migrate/20130805232516_add_enterprise_fee_to_product_distributions.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddEnterpriseFeeToProductDistributions < ActiveRecord::Migration - def change - add_column :product_distributions, :enterprise_fee_id, :integer - end -end diff --git a/db/migrate/20130806055125_create_suburbs.rb b/db/migrate/20130806055125_create_suburbs.rb deleted file mode 100644 index bb09b8522b..0000000000 --- a/db/migrate/20130806055125_create_suburbs.rb +++ /dev/null @@ -1,11 +0,0 @@ -class CreateSuburbs < ActiveRecord::Migration - def change - create_table :suburbs do |t| - t.string :name - t.integer :postcode - t.float :latitude - t.float :longitude - t.integer :state_id - end - end -end diff --git a/db/migrate/20130807002915_add_latitude_and_longitude_to_addresses.rb b/db/migrate/20130807002915_add_latitude_and_longitude_to_addresses.rb deleted file mode 100644 index 7fbfe9c30e..0000000000 --- a/db/migrate/20130807002915_add_latitude_and_longitude_to_addresses.rb +++ /dev/null @@ -1,6 +0,0 @@ -class AddLatitudeAndLongitudeToAddresses < ActiveRecord::Migration - def change - add_column :spree_addresses, :latitude, :float - add_column :spree_addresses, :longitude, :float - end -end diff --git a/db/migrate/20130807062657_add_distributor_id_to_payment_method.rb b/db/migrate/20130807062657_add_distributor_id_to_payment_method.rb deleted file mode 100644 index 26ea241019..0000000000 --- a/db/migrate/20130807062657_add_distributor_id_to_payment_method.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddDistributorIdToPaymentMethod < ActiveRecord::Migration - def change - add_column :spree_payment_methods, :distributor_id, :integer - end -end diff --git a/db/migrate/20130807230834_add_cart.rb b/db/migrate/20130807230834_add_cart.rb deleted file mode 100644 index 38d94a7c8e..0000000000 --- a/db/migrate/20130807230834_add_cart.rb +++ /dev/null @@ -1,9 +0,0 @@ -class AddCart < ActiveRecord::Migration - def change - create_table :carts do |t| - t.integer :user_id - end - - add_column :spree_orders, :cart_id, :integer - end -end diff --git a/db/migrate/20130809045637_create_enterprise_fee_records_for_product_distributions.rb b/db/migrate/20130809045637_create_enterprise_fee_records_for_product_distributions.rb deleted file mode 100644 index b826f51fdb..0000000000 --- a/db/migrate/20130809045637_create_enterprise_fee_records_for_product_distributions.rb +++ /dev/null @@ -1,26 +0,0 @@ -class CreateEnterpriseFeeRecordsForProductDistributions < ActiveRecord::Migration - - class ProductDistribution < ActiveRecord::Base - belongs_to :shipping_method, :class_name => 'Spree::ShippingMethod' - belongs_to :distributor, :class_name => 'Enterprise' - belongs_to :enterprise_fee - end - - def up - ProductDistribution.all.each do |pd| - calculator = pd.shipping_method.calculator.dup - calculator.save! - - ef = EnterpriseFee.new enterprise_id: pd.distributor.id, fee_type: 'packing', name: pd.shipping_method.name - ef.calculator = calculator - ef.save! - - pd.enterprise_fee = ef - pd.save! - end - end - - def down - ProductDistribution.update_all :enterprise_fee_id => nil - end -end diff --git a/db/migrate/20130809075103_create_adjustment_metadata.rb b/db/migrate/20130809075103_create_adjustment_metadata.rb deleted file mode 100644 index 4d1c6579eb..0000000000 --- a/db/migrate/20130809075103_create_adjustment_metadata.rb +++ /dev/null @@ -1,13 +0,0 @@ -class CreateAdjustmentMetadata < ActiveRecord::Migration - def change - create_table :adjustment_metadata do |t| - t.integer :adjustment_id - t.integer :enterprise_id - t.string :fee_name - t.string :fee_type - t.string :enterprise_role - end - - add_index :adjustment_metadata, :adjustment_id - end -end diff --git a/db/migrate/20130812233634_remove_shipping_method_from_product_distribution.rb b/db/migrate/20130812233634_remove_shipping_method_from_product_distribution.rb deleted file mode 100644 index cf3fee3020..0000000000 --- a/db/migrate/20130812233634_remove_shipping_method_from_product_distribution.rb +++ /dev/null @@ -1,9 +0,0 @@ -class RemoveShippingMethodFromProductDistribution < ActiveRecord::Migration - def up - remove_column :product_distributions, :shipping_method_id - end - - def down - add_column :product_distributions, :shipping_method_id, :integer - end -end diff --git a/db/migrate/20130814010857_remove_shipping_methods_using_itemwise_calculator.rb b/db/migrate/20130814010857_remove_shipping_methods_using_itemwise_calculator.rb deleted file mode 100644 index 52351065dd..0000000000 --- a/db/migrate/20130814010857_remove_shipping_methods_using_itemwise_calculator.rb +++ /dev/null @@ -1,15 +0,0 @@ -class RemoveShippingMethodsUsingItemwiseCalculator < ActiveRecord::Migration - class OpenFoodNetwork::Calculator::Itemwise < Spree::Calculator; end - - def up - Spree::ShippingMethod.all.select { |sm| sm.calculator.type == 'OpenFoodNetwork::Calculator::Itemwise' }.each do |sm| - - say "Destroying itemwise shipping method with id #{sm.id}" - sm.destroy - end - end - - def down - Spree::ShippingMethod.create!({name: 'Delivery', zone: Spree::Zone.last, calculator: OpenFoodNetwork::Calculator::Itemwise.new}, without_protection: true) - end -end diff --git a/db/migrate/20130830012138_add_distributor_id_to_shipping_methods.rb b/db/migrate/20130830012138_add_distributor_id_to_shipping_methods.rb deleted file mode 100644 index 3039475a10..0000000000 --- a/db/migrate/20130830012138_add_distributor_id_to_shipping_methods.rb +++ /dev/null @@ -1,6 +0,0 @@ -class AddDistributorIdToShippingMethods < ActiveRecord::Migration - def change - add_column :spree_shipping_methods, :distributor_id, :integer - add_index :spree_shipping_methods, :distributor_id - end -end diff --git a/db/migrate/20130912021553_create_distributors_payment_methods.rb b/db/migrate/20130912021553_create_distributors_payment_methods.rb deleted file mode 100644 index a9e2ed1738..0000000000 --- a/db/migrate/20130912021553_create_distributors_payment_methods.rb +++ /dev/null @@ -1,20 +0,0 @@ -class CreateDistributorsPaymentMethods < ActiveRecord::Migration - class Spree::PaymentMethod < ActiveRecord::Base - belongs_to :distributor, class_name: 'Enterprise' - has_and_belongs_to_many :distributors, join_table: 'distributors_payment_methods', :class_name => 'Enterprise', association_foreign_key: 'distributor_id' - end - - def up - create_table :distributors_payment_methods, :id => false do |t| - t.references :distributor - t.references :payment_method - end - Spree::PaymentMethod.all.each do |pm| - pm.distributors << pm.distributor if pm.distributor_id - end - end - - def down - drop_table :distributors_payment_methods - end -end diff --git a/db/migrate/20130912021938_remove_distributor_id_from_payment_method.rb b/db/migrate/20130912021938_remove_distributor_id_from_payment_method.rb deleted file mode 100644 index 58bece17cd..0000000000 --- a/db/migrate/20130912021938_remove_distributor_id_from_payment_method.rb +++ /dev/null @@ -1,12 +0,0 @@ -class RemoveDistributorIdFromPaymentMethod < ActiveRecord::Migration - def up - remove_column :spree_payment_methods, :distributor_id - end - - def down - add_column :spree_payment_methods, :distributor_id, :integer - Spree::PaymentMethod.each do |pm| - pm.distributor_id = pm.distributors.first.distributor_id if pm.distributors.first - end - end -end diff --git a/db/migrate/20130919010513_ensure_shipping_methods_have_distributors.rb b/db/migrate/20130919010513_ensure_shipping_methods_have_distributors.rb deleted file mode 100644 index 09017609eb..0000000000 --- a/db/migrate/20130919010513_ensure_shipping_methods_have_distributors.rb +++ /dev/null @@ -1,20 +0,0 @@ -class EnsureShippingMethodsHaveDistributors < ActiveRecord::Migration - class Enterprise < ActiveRecord::Base - scope :is_distributor, -> { where(is_distributor: true) } - end - - def up - d = Enterprise.is_distributor.first - sms = Spree::ShippingMethod.where('distributor_id IS NULL') - - if d - say "Assigning an arbitrary distributor (#{d.name}) to all shipping methods without one (#{sms.count} total)" - sms.update_all(distributor_id: d) - else - say "There are #{sms.count} shipping methods without distributors, but there are no distributors to assign to them" - end - end - - def down - end -end diff --git a/db/migrate/20131016230055_convert_shipping_methods_distributors_to_habtm.rb b/db/migrate/20131016230055_convert_shipping_methods_distributors_to_habtm.rb deleted file mode 100644 index 8d26c88d9b..0000000000 --- a/db/migrate/20131016230055_convert_shipping_methods_distributors_to_habtm.rb +++ /dev/null @@ -1,37 +0,0 @@ -class ConvertShippingMethodsDistributorsToHabtm < ActiveRecord::Migration - class Spree::ShippingMethod < ActiveRecord::Base - belongs_to :distributor, class_name: 'Enterprise' - has_and_belongs_to_many :distributors, join_table: 'distributors_shipping_methods', :class_name => 'Enterprise', association_foreign_key: 'distributor_id' - end - - def up - create_table :distributors_shipping_methods, id: false do |t| - t.references :distributor - t.references :shipping_method - end - add_index :distributors_shipping_methods, :distributor_id - add_index :distributors_shipping_methods, :shipping_method_id - - Spree::ShippingMethod.all.each do |sm| - sm.distributors << sm.distributor if sm.distributor_id - end - - remove_column :spree_shipping_methods, :distributor_id - end - - def down - add_column :spree_shipping_methods, :distributor_id, :integer - add_index :spree_shipping_methods, :distributor_id - - Spree::ShippingMethod.all.each do |sm| - if sm.distributors.present? - sm.distributor = sm.distributors.first - sm.save! - - say "WARNING: Discarding #{sm.distributors.count-1} distributors while flattening HABTM relation to belongs_to" if sm.distributors.count > 1 - end - end - - drop_table :distributors_shipping_methods - end -end diff --git a/db/migrate/20131024005253_create_enterprise_groups.rb b/db/migrate/20131024005253_create_enterprise_groups.rb deleted file mode 100644 index 4a8d01fd0a..0000000000 --- a/db/migrate/20131024005253_create_enterprise_groups.rb +++ /dev/null @@ -1,13 +0,0 @@ -class CreateEnterpriseGroups < ActiveRecord::Migration - def change - create_table :enterprise_groups do |t| - t.string :name - t.boolean :on_front_page - end - - create_table :enterprise_groups_enterprises, id: false do |t| - t.references :enterprise_group - t.references :enterprise - end - end -end diff --git a/db/migrate/20131030031125_add_position_to_enterprise_groups.rb b/db/migrate/20131030031125_add_position_to_enterprise_groups.rb deleted file mode 100644 index 199a045784..0000000000 --- a/db/migrate/20131030031125_add_position_to_enterprise_groups.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddPositionToEnterpriseGroups < ActiveRecord::Migration - def change - add_column :enterprise_groups, :position, :integer - end -end diff --git a/db/migrate/20131128034556_setup_product_units_and_values.rb b/db/migrate/20131128034556_setup_product_units_and_values.rb deleted file mode 100644 index d6cf779aed..0000000000 --- a/db/migrate/20131128034556_setup_product_units_and_values.rb +++ /dev/null @@ -1,14 +0,0 @@ -class SetupProductUnitsAndValues < ActiveRecord::Migration - def change - change_table :spree_products do |t| - t.string :variant_unit - t.float :variant_unit_scale - t.string :variant_unit_name - end - - change_table :spree_variants do |t| - t.float :unit_value - t.string :unit_description - end - end -end diff --git a/db/migrate/20140110040238_make_unit_description_default_blank.rb b/db/migrate/20140110040238_make_unit_description_default_blank.rb deleted file mode 100644 index 58254259ab..0000000000 --- a/db/migrate/20140110040238_make_unit_description_default_blank.rb +++ /dev/null @@ -1,10 +0,0 @@ -class MakeUnitDescriptionDefaultBlank < ActiveRecord::Migration - def up - execute "UPDATE spree_variants SET unit_description='' WHERE unit_description IS NULL" - change_column :spree_variants, :unit_description, :string, default: '' - end - - def down - change_column :spree_variants, :unit_description, :string, default: nil - end -end diff --git a/db/migrate/20140116030500_add_attachment_logo_to_enterprise.rb b/db/migrate/20140116030500_add_attachment_logo_to_enterprise.rb deleted file mode 100644 index 0f3c6e114f..0000000000 --- a/db/migrate/20140116030500_add_attachment_logo_to_enterprise.rb +++ /dev/null @@ -1,15 +0,0 @@ -class AddAttachmentLogoToEnterprise < ActiveRecord::Migration - def self.up - add_column :enterprises, :logo_file_name, :string - add_column :enterprises, :logo_content_type, :string - add_column :enterprises, :logo_file_size, :integer - add_column :enterprises, :logo_updated_at, :datetime - end - - def self.down - remove_column :enterprises, :logo_file_name - remove_column :enterprises, :logo_content_type - remove_column :enterprises, :logo_file_size - remove_column :enterprises, :logo_updated_at - end -end diff --git a/db/migrate/20140121050239_add_attachment_promo_image_to_enterprise.rb b/db/migrate/20140121050239_add_attachment_promo_image_to_enterprise.rb deleted file mode 100644 index d875f111b2..0000000000 --- a/db/migrate/20140121050239_add_attachment_promo_image_to_enterprise.rb +++ /dev/null @@ -1,15 +0,0 @@ -class AddAttachmentPromoImageToEnterprise < ActiveRecord::Migration - def self.up - add_column :enterprises, :promo_image_file_name, :string - add_column :enterprises, :promo_image_content_type, :string - add_column :enterprises, :promo_image_file_size, :integer - add_column :enterprises, :promo_image_updated_at, :datetime - end - - def self.down - remove_column :enterprises, :promo_image_file_name - remove_column :enterprises, :promo_image_content_type - remove_column :enterprises, :promo_image_file_size - remove_column :enterprises, :promo_image_updated_at - end -end diff --git a/db/migrate/20140204011203_add_notes_to_products.rb b/db/migrate/20140204011203_add_notes_to_products.rb deleted file mode 100644 index 5ec603a85c..0000000000 --- a/db/migrate/20140204011203_add_notes_to_products.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddNotesToProducts < ActiveRecord::Migration - def change - add_column :spree_products, :notes, :text - end -end diff --git a/db/migrate/20140213003443_add_require_ship_address_to_shipping_methods.rb b/db/migrate/20140213003443_add_require_ship_address_to_shipping_methods.rb deleted file mode 100644 index a38ad29242..0000000000 --- a/db/migrate/20140213003443_add_require_ship_address_to_shipping_methods.rb +++ /dev/null @@ -1,6 +0,0 @@ -class AddRequireShipAddressToShippingMethods < ActiveRecord::Migration - def change - add_column :spree_shipping_methods, :require_ship_address, :boolean, :default => true - add_column :spree_shipping_methods, :description, :text - end -end diff --git a/db/migrate/20140324025840_add_incoming_to_exchanges.rb b/db/migrate/20140324025840_add_incoming_to_exchanges.rb deleted file mode 100644 index 37df0a48db..0000000000 --- a/db/migrate/20140324025840_add_incoming_to_exchanges.rb +++ /dev/null @@ -1,25 +0,0 @@ -class AddIncomingToExchanges < ActiveRecord::Migration - class Exchange < ActiveRecord::Base - belongs_to :order_cycle - belongs_to :receiver, :class_name => 'Enterprise' - - def incoming? - receiver == order_cycle.coordinator - end - end - - - def up - add_column :exchanges, :incoming, :boolean, null: false, default: false - - # Initialise based on whether the exchange is going to or coming - # from the order cycle coordinator - Exchange.all.each do |exchange| - exchange.update_attribute :incoming, exchange.incoming? - end - end - - def down - remove_column :exchanges, :incoming - end -end diff --git a/db/migrate/20140402032034_add_missing_indexes.rb b/db/migrate/20140402032034_add_missing_indexes.rb deleted file mode 100644 index 5c7713d3b6..0000000000 --- a/db/migrate/20140402032034_add_missing_indexes.rb +++ /dev/null @@ -1,38 +0,0 @@ -class AddMissingIndexes < ActiveRecord::Migration - def change - add_index :adjustment_metadata, :enterprise_id - - add_index :carts, :user_id - - add_index :coordinator_fees, :order_cycle_id - add_index :coordinator_fees, :enterprise_fee_id - - add_index :distributors_payment_methods, :distributor_id - add_index :distributors_payment_methods, :payment_method_id - - add_index :enterprise_fees, :enterprise_id - - add_index :enterprise_groups_enterprises, :enterprise_group_id - add_index :enterprise_groups_enterprises, :enterprise_id - - add_index :enterprise_roles, :user_id - add_index :enterprise_roles, :enterprise_id - - add_index :enterprises, :address_id - - add_index :exchange_fees, :exchange_id - add_index :exchange_fees, :enterprise_fee_id - - add_index :exchange_variants, :exchange_id - add_index :exchange_variants, :variant_id - - add_index :exchanges, :order_cycle_id - add_index :exchanges, :sender_id - add_index :exchanges, :receiver_id - add_index :exchanges, :payment_enterprise_id - - add_index :product_distributions, :product_id - add_index :product_distributions, :distributor_id - add_index :product_distributions, :enterprise_fee_id - end -end diff --git a/db/migrate/20140402033428_add_foreign_keys.rb b/db/migrate/20140402033428_add_foreign_keys.rb deleted file mode 100644 index 1535f4f3f9..0000000000 --- a/db/migrate/20140402033428_add_foreign_keys.rb +++ /dev/null @@ -1,188 +0,0 @@ -class AddForeignKeys < ActiveRecord::Migration - class AdjustmentMetadata < ActiveRecord::Base; end - class CoordinatorFee < ActiveRecord::Base; end - class Enterprise < ActiveRecord::Base - belongs_to :address, :class_name => 'Spree::Address' - end - class ExchangeVariant < ActiveRecord::Base; end - class Spree::InventoryUnit < ActiveRecord::Base; end - class Spree::LineItem < ActiveRecord::Base; end - class Spree::Address < ActiveRecord::Base; end - class Spree::Order < ActiveRecord::Base; end - class Spree::Taxon < ActiveRecord::Base; end - - def change - setup_foreign_keys - end - - # http://stackoverflow.com/a/7679513/2720566 - def migrate(direction) - sanitise_data if direction == :up - super - end - - - private - - def sanitise_data - # Remove orphaned AdjustmentMetadata records - orphaned_adjustment_metadata = AdjustmentMetadata.joins('LEFT OUTER JOIN spree_adjustments ON spree_adjustments.id = adjustment_metadata.adjustment_id').where('spree_adjustments.id IS NULL') - say "Destroying #{orphaned_adjustment_metadata.count} orphaned AdjustmentMetadata (of total #{AdjustmentMetadata.count})" - orphaned_adjustment_metadata.destroy_all - - # Remove orphaned ExchangeVariants - orphaned_exchange_variants = ExchangeVariant.joins('LEFT OUTER JOIN spree_variants ON spree_variants.id=exchange_variants.variant_id').where('spree_variants.id IS NULL') - say "Destroying #{orphaned_exchange_variants.count} orphaned ExchangeVariants (of total #{ExchangeVariant.count})" - orphaned_exchange_variants.destroy_all - - # Remove orphaned ExchangeFee records - orphaned_exchange_fees = ExchangeFee.joins('LEFT OUTER JOIN enterprise_fees ON enterprise_fees.id=exchange_fees.enterprise_fee_id').where('enterprise_fees.id IS NULL') - say "Destroying #{orphaned_exchange_fees.count} orphaned ExchangeFees (of total #{ExchangeFee.count})" - orphaned_exchange_fees.destroy_all - - # Remove orphaned Spree::InventoryUnits - orphaned_inventory_units = Spree::InventoryUnit.joins('LEFT OUTER JOIN spree_variants ON spree_variants.id=spree_inventory_units.variant_id').where('spree_variants.id IS NULL') - say "Destroying #{orphaned_inventory_units.count} orphaned InventoryUnits (of total #{Spree::InventoryUnit.count})" - orphaned_inventory_units.destroy_all - - # Remove orphaned Spree::LineItems - orphaned_line_items = Spree::LineItem. - joins('LEFT OUTER JOIN spree_variants ON spree_variants.id=spree_line_items.variant_id'). - joins('LEFT OUTER JOIN spree_orders ON spree_orders.id=spree_line_items.order_id'). - where('spree_variants.id IS NULL OR spree_orders.id IS NULL') - say "Destroying #{orphaned_line_items.count} orphaned LineItems (of total #{Spree::LineItem.count})" - orphaned_line_items.each { |li| li.delete } - - # Update orders without a distributor with a dummy distributor - state = Spree::State.first - country = state.andand.country - unless country && state - country = Spree::Country.create! name: 'Australia', iso_name: 'AU' - state = country.states.create! name: 'Victoria' - end - - address = Spree::Address.create!(firstname: 'Dummy distributor', lastname: 'Dummy distributor', phone: '12345678', state: state, - address1: 'Dummy distributor', city: 'Dummy distributor', zipcode: '1234', country: country) - Enterprise.reset_column_information - deleted_distributor = Enterprise.create!(name: "Deleted distributor", address: address) - - orphaned_orders = Spree::Order.joins('LEFT OUTER JOIN enterprises ON enterprises.id=spree_orders.distributor_id').where('enterprises.id IS NULL') - say "Assigning a dummy distributor to #{orphaned_orders.count} orders with a deleted distributor (of total #{Spree::Order.count})" - orphaned_orders.update_all distributor_id: deleted_distributor.id - - # Remove orphaned Spree::Taxons - orphaned_taxons = Spree::Taxon.joins('LEFT OUTER JOIN spree_taxonomies ON spree_taxonomies.id=spree_taxons.taxonomy_id').where('spree_taxonomies.id IS NULL') - say "Destroying #{orphaned_taxons.count} orphaned Taxons (of total #{Spree::Taxon.count})" - orphaned_taxons.destroy_all - - # Remove orphaned CoordinatorFee records - orphaned_coordinator_fees = CoordinatorFee.joins('LEFT OUTER JOIN enterprise_fees ON enterprise_fees.id = coordinator_fees.enterprise_fee_id').where('enterprise_fees.id IS NULL') - say "Destroying #{orphaned_coordinator_fees.count} orphaned CoordinatorFees (of total #{CoordinatorFee.count})" - orphaned_coordinator_fees.each do |cf| - CoordinatorFee.connection.execute("DELETE FROM coordinator_fees WHERE coordinator_fees.order_cycle_id=#{cf.order_cycle_id} AND coordinator_fees.enterprise_fee_id=#{cf.enterprise_fee_id}") - end - end - - - def setup_foreign_keys - add_foreign_key "adjustment_metadata", "spree_adjustments", name: "adjustment_metadata_adjustment_id_fk", column: "adjustment_id" - add_foreign_key "adjustment_metadata", "enterprises", name: "adjustment_metadata_enterprise_id_fk" - add_foreign_key "carts", "spree_users", name: "carts_user_id_fk", column: "user_id" - add_foreign_key "cms_blocks", "cms_pages", name: "cms_blocks_page_id_fk", column: "page_id" - add_foreign_key "cms_categories", "cms_sites", name: "cms_categories_site_id_fk", column: "site_id", dependent: :delete - add_foreign_key "cms_categorizations", "cms_categories", name: "cms_categorizations_category_id_fk", column: "category_id" - add_foreign_key "cms_files", "cms_blocks", name: "cms_files_block_id_fk", column: "block_id" - add_foreign_key "cms_files", "cms_sites", name: "cms_files_site_id_fk", column: "site_id" - add_foreign_key "cms_layouts", "cms_layouts", name: "cms_layouts_parent_id_fk", column: "parent_id" - add_foreign_key "cms_layouts", "cms_sites", name: "cms_layouts_site_id_fk", column: "site_id", dependent: :delete - add_foreign_key "cms_pages", "cms_layouts", name: "cms_pages_layout_id_fk", column: "layout_id" - add_foreign_key "cms_pages", "cms_pages", name: "cms_pages_parent_id_fk", column: "parent_id" - add_foreign_key "cms_pages", "cms_sites", name: "cms_pages_site_id_fk", column: "site_id", dependent: :delete - add_foreign_key "cms_pages", "cms_pages", name: "cms_pages_target_page_id_fk", column: "target_page_id" - add_foreign_key "cms_snippets", "cms_sites", name: "cms_snippets_site_id_fk", column: "site_id", dependent: :delete - add_foreign_key "coordinator_fees", "enterprise_fees", name: "coordinator_fees_enterprise_fee_id_fk" - add_foreign_key "coordinator_fees", "order_cycles", name: "coordinator_fees_order_cycle_id_fk" - add_foreign_key "distributors_payment_methods", "enterprises", name: "distributors_payment_methods_distributor_id_fk", column: "distributor_id" - add_foreign_key "distributors_payment_methods", "spree_payment_methods", name: "distributors_payment_methods_payment_method_id_fk", column: "payment_method_id" - add_foreign_key "distributors_shipping_methods", "enterprises", name: "distributors_shipping_methods_distributor_id_fk", column: "distributor_id" - add_foreign_key "distributors_shipping_methods", "spree_shipping_methods", name: "distributors_shipping_methods_shipping_method_id_fk", column: "shipping_method_id" - add_foreign_key "enterprise_fees", "enterprises", name: "enterprise_fees_enterprise_id_fk" - add_foreign_key "enterprise_groups_enterprises", "enterprise_groups", name: "enterprise_groups_enterprises_enterprise_group_id_fk" - add_foreign_key "enterprise_groups_enterprises", "enterprises", name: "enterprise_groups_enterprises_enterprise_id_fk" - add_foreign_key "enterprise_roles", "enterprises", name: "enterprise_roles_enterprise_id_fk" - add_foreign_key "enterprise_roles", "spree_users", name: "enterprise_roles_user_id_fk", column: "user_id" - add_foreign_key "enterprises", "spree_addresses", name: "enterprises_address_id_fk", column: "address_id" - add_foreign_key "exchange_fees", "enterprise_fees", name: "exchange_fees_enterprise_fee_id_fk" - add_foreign_key "exchange_fees", "exchanges", name: "exchange_fees_exchange_id_fk" - add_foreign_key "exchange_variants", "exchanges", name: "exchange_variants_exchange_id_fk" - add_foreign_key "exchange_variants", "spree_variants", name: "exchange_variants_variant_id_fk", column: "variant_id" - add_foreign_key "exchanges", "order_cycles", name: "exchanges_order_cycle_id_fk" - add_foreign_key "exchanges", "enterprises", name: "exchanges_payment_enterprise_id_fk", column: "payment_enterprise_id" - add_foreign_key "exchanges", "enterprises", name: "exchanges_receiver_id_fk", column: "receiver_id" - add_foreign_key "exchanges", "enterprises", name: "exchanges_sender_id_fk", column: "sender_id" - add_foreign_key "order_cycles", "enterprises", name: "order_cycles_coordinator_id_fk", column: "coordinator_id" - add_foreign_key "product_distributions", "enterprises", name: "product_distributions_distributor_id_fk", column: "distributor_id" - add_foreign_key "product_distributions", "enterprise_fees", name: "product_distributions_enterprise_fee_id_fk" - add_foreign_key "product_distributions", "spree_products", name: "product_distributions_product_id_fk", column: "product_id" - add_foreign_key "spree_addresses", "spree_countries", name: "spree_addresses_country_id_fk", column: "country_id" - add_foreign_key "spree_addresses", "spree_states", name: "spree_addresses_state_id_fk", column: "state_id" - add_foreign_key "spree_inventory_units", "spree_orders", name: "spree_inventory_units_order_id_fk", column: "order_id" - add_foreign_key "spree_inventory_units", "spree_return_authorizations", name: "spree_inventory_units_return_authorization_id_fk", column: "return_authorization_id" - add_foreign_key "spree_inventory_units", "spree_shipments", name: "spree_inventory_units_shipment_id_fk", column: "shipment_id" - add_foreign_key "spree_inventory_units", "spree_variants", name: "spree_inventory_units_variant_id_fk", column: "variant_id" - add_foreign_key "spree_line_items", "spree_orders", name: "spree_line_items_order_id_fk", column: "order_id" - add_foreign_key "spree_line_items", "spree_variants", name: "spree_line_items_variant_id_fk", column: "variant_id" - add_foreign_key "spree_option_types_prototypes", "spree_option_types", name: "spree_option_types_prototypes_option_type_id_fk", column: "option_type_id" - add_foreign_key "spree_option_types_prototypes", "spree_prototypes", name: "spree_option_types_prototypes_prototype_id_fk", column: "prototype_id" - add_foreign_key "spree_option_values", "spree_option_types", name: "spree_option_values_option_type_id_fk", column: "option_type_id" - add_foreign_key "spree_option_values_variants", "spree_option_values", name: "spree_option_values_variants_option_value_id_fk", column: "option_value_id" - add_foreign_key "spree_option_values_variants", "spree_variants", name: "spree_option_values_variants_variant_id_fk", column: "variant_id" - add_foreign_key "spree_orders", "spree_addresses", name: "spree_orders_bill_address_id_fk", column: "bill_address_id" - add_foreign_key "spree_orders", "carts", name: "spree_orders_cart_id_fk" - add_foreign_key "spree_orders", "enterprises", name: "spree_orders_distributor_id_fk", column: "distributor_id" - add_foreign_key "spree_orders", "order_cycles", name: "spree_orders_order_cycle_id_fk" - add_foreign_key "spree_orders", "spree_addresses", name: "spree_orders_ship_address_id_fk", column: "ship_address_id" - #add_foreign_key "spree_orders", "spree_shipping_methods", name: "spree_orders_shipping_method_id_fk", column: "shipping_method_id" - add_foreign_key "spree_orders", "spree_users", name: "spree_orders_user_id_fk", column: "user_id" - add_foreign_key "spree_payments", "spree_orders", name: "spree_payments_order_id_fk", column: "order_id" - add_foreign_key "spree_payments", "spree_payment_methods", name: "spree_payments_payment_method_id_fk", column: "payment_method_id" - #add_foreign_key "spree_payments", "spree_payments", name: "spree_payments_source_id_fk", column: "source_id" - add_foreign_key "spree_prices", "spree_variants", name: "spree_prices_variant_id_fk", column: "variant_id" - add_foreign_key "spree_product_option_types", "spree_option_types", name: "spree_product_option_types_option_type_id_fk", column: "option_type_id" - add_foreign_key "spree_product_option_types", "spree_products", name: "spree_product_option_types_product_id_fk", column: "product_id" - add_foreign_key "spree_product_properties", "spree_products", name: "spree_product_properties_product_id_fk", column: "product_id" - add_foreign_key "spree_product_properties", "spree_properties", name: "spree_product_properties_property_id_fk", column: "property_id" - add_foreign_key "spree_products_promotion_rules", "spree_products", name: "spree_products_promotion_rules_product_id_fk", column: "product_id" - add_foreign_key "spree_products_promotion_rules", "spree_promotion_rules", name: "spree_products_promotion_rules_promotion_rule_id_fk", column: "promotion_rule_id" - add_foreign_key "spree_products", "spree_shipping_categories", name: "spree_products_shipping_category_id_fk", column: "shipping_category_id" - add_foreign_key "spree_products", "enterprises", name: "spree_products_supplier_id_fk", column: "supplier_id" - add_foreign_key "spree_products", "spree_tax_categories", name: "spree_products_tax_category_id_fk", column: "tax_category_id" - add_foreign_key "spree_products_taxons", "spree_products", name: "spree_products_taxons_product_id_fk", column: "product_id", dependent: :delete - add_foreign_key "spree_products_taxons", "spree_taxons", name: "spree_products_taxons_taxon_id_fk", column: "taxon_id", dependent: :delete - add_foreign_key "spree_promotion_action_line_items", "spree_promotion_actions", name: "spree_promotion_action_line_items_promotion_action_id_fk", column: "promotion_action_id" - add_foreign_key "spree_promotion_action_line_items", "spree_variants", name: "spree_promotion_action_line_items_variant_id_fk", column: "variant_id" - add_foreign_key "spree_promotion_actions", "spree_activators", name: "spree_promotion_actions_activator_id_fk", column: "activator_id" - add_foreign_key "spree_promotion_rules", "spree_activators", name: "spree_promotion_rules_activator_id_fk", column: "activator_id" - add_foreign_key "spree_properties_prototypes", "spree_properties", name: "spree_properties_prototypes_property_id_fk", column: "property_id" - add_foreign_key "spree_properties_prototypes", "spree_prototypes", name: "spree_properties_prototypes_prototype_id_fk", column: "prototype_id" - add_foreign_key "spree_return_authorizations", "spree_orders", name: "spree_return_authorizations_order_id_fk", column: "order_id" - add_foreign_key "spree_roles_users", "spree_roles", name: "spree_roles_users_role_id_fk", column: "role_id" - add_foreign_key "spree_roles_users", "spree_users", name: "spree_roles_users_user_id_fk", column: "user_id" - add_foreign_key "spree_shipments", "spree_addresses", name: "spree_shipments_address_id_fk", column: "address_id" - add_foreign_key "spree_shipments", "spree_orders", name: "spree_shipments_order_id_fk", column: "order_id" - #add_foreign_key "spree_shipments", "spree_shipping_methods", name: "spree_shipments_shipping_method_id_fk", column: "shipping_method_id" - add_foreign_key "spree_shipping_methods", "spree_shipping_categories", name: "spree_shipping_methods_shipping_category_id_fk", column: "shipping_category_id" - add_foreign_key "spree_shipping_methods", "spree_zones", name: "spree_shipping_methods_zone_id_fk", column: "zone_id" - add_foreign_key "spree_state_changes", "spree_users", name: "spree_state_changes_user_id_fk", column: "user_id" - add_foreign_key "spree_states", "spree_countries", name: "spree_states_country_id_fk", column: "country_id" - add_foreign_key "spree_tax_rates", "spree_tax_categories", name: "spree_tax_rates_tax_category_id_fk", column: "tax_category_id" - add_foreign_key "spree_tax_rates", "spree_zones", name: "spree_tax_rates_zone_id_fk", column: "zone_id" - add_foreign_key "spree_taxons", "spree_taxons", name: "spree_taxons_parent_id_fk", column: "parent_id" - add_foreign_key "spree_taxons", "spree_taxonomies", name: "spree_taxons_taxonomy_id_fk", column: "taxonomy_id" - add_foreign_key "spree_users", "spree_addresses", name: "spree_users_bill_address_id_fk", column: "bill_address_id" - add_foreign_key "spree_users", "spree_addresses", name: "spree_users_ship_address_id_fk", column: "ship_address_id" - add_foreign_key "spree_variants", "spree_products", name: "spree_variants_product_id_fk", column: "product_id" - add_foreign_key "spree_zone_members", "spree_zones", name: "spree_zone_members_zone_id_fk", column: "zone_id" - add_foreign_key "suburbs", "spree_states", name: "suburbs_state_id_fk", column: "state_id" - end -end diff --git a/db/migrate/20140425055718_add_active_flag_to_enterprises.rb b/db/migrate/20140425055718_add_active_flag_to_enterprises.rb deleted file mode 100644 index b0bcc2f3ed..0000000000 --- a/db/migrate/20140425055718_add_active_flag_to_enterprises.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddActiveFlagToEnterprises < ActiveRecord::Migration - def change - add_column :enterprises, :active, :boolean, default: true - end -end diff --git a/db/migrate/20140430020639_rename_active_to_visible_on_enterprises.rb b/db/migrate/20140430020639_rename_active_to_visible_on_enterprises.rb deleted file mode 100644 index 99b011304a..0000000000 --- a/db/migrate/20140430020639_rename_active_to_visible_on_enterprises.rb +++ /dev/null @@ -1,5 +0,0 @@ -class RenameActiveToVisibleOnEnterprises < ActiveRecord::Migration - def change - rename_column :enterprises, :active, :visible - end -end diff --git a/db/migrate/20140514044959_create_enterprise_relationships.rb b/db/migrate/20140514044959_create_enterprise_relationships.rb deleted file mode 100644 index 0467d6e560..0000000000 --- a/db/migrate/20140514044959_create_enterprise_relationships.rb +++ /dev/null @@ -1,16 +0,0 @@ -class CreateEnterpriseRelationships < ActiveRecord::Migration - def change - create_table :enterprise_relationships do |t| - t.integer :parent_id - t.integer :child_id - end - - add_index :enterprise_relationships, :parent_id - add_index :enterprise_relationships, :child_id - - add_index :enterprise_relationships, [:parent_id, :child_id], unique: true - - add_foreign_key :enterprise_relationships, :enterprises, column: :parent_id - add_foreign_key :enterprise_relationships, :enterprises, column: :child_id - end -end diff --git a/db/migrate/20140516042552_add_attachment_promo_image_to_enterprise_group.rb b/db/migrate/20140516042552_add_attachment_promo_image_to_enterprise_group.rb deleted file mode 100644 index bd67cb92f0..0000000000 --- a/db/migrate/20140516042552_add_attachment_promo_image_to_enterprise_group.rb +++ /dev/null @@ -1,15 +0,0 @@ -class AddAttachmentPromoImageToEnterpriseGroup < ActiveRecord::Migration - def self.up - add_column :enterprise_groups, :promo_image_file_name, :string - add_column :enterprise_groups, :promo_image_content_type, :string - add_column :enterprise_groups, :promo_image_file_size, :integer - add_column :enterprise_groups, :promo_image_updated_at, :datetime - end - - def self.down - remove_column :enterprise_groups, :promo_image_file_name - remove_column :enterprise_groups, :promo_image_content_type - remove_column :enterprise_groups, :promo_image_file_size - remove_column :enterprise_groups, :promo_image_updated_at - end -end diff --git a/db/migrate/20140516044750_add_fields_to_groups.rb b/db/migrate/20140516044750_add_fields_to_groups.rb deleted file mode 100644 index a50ef1db14..0000000000 --- a/db/migrate/20140516044750_add_fields_to_groups.rb +++ /dev/null @@ -1,6 +0,0 @@ -class AddFieldsToGroups < ActiveRecord::Migration - def change - add_column :enterprise_groups, :description, :text - add_column :enterprise_groups, :long_description, :text - end -end diff --git a/db/migrate/20140516045323_add_attachment_logo_to_enterprise_group.rb b/db/migrate/20140516045323_add_attachment_logo_to_enterprise_group.rb deleted file mode 100644 index 525bccb63e..0000000000 --- a/db/migrate/20140516045323_add_attachment_logo_to_enterprise_group.rb +++ /dev/null @@ -1,15 +0,0 @@ -class AddAttachmentLogoToEnterpriseGroup < ActiveRecord::Migration - def self.up - add_column :enterprise_groups, :logo_file_name, :string - add_column :enterprise_groups, :logo_content_type, :string - add_column :enterprise_groups, :logo_file_size, :integer - add_column :enterprise_groups, :logo_updated_at, :datetime - end - - def self.down - remove_column :enterprise_groups, :logo_file_name - remove_column :enterprise_groups, :logo_content_type - remove_column :enterprise_groups, :logo_file_size - remove_column :enterprise_groups, :logo_updated_at - end -end diff --git a/db/migrate/20140522015012_add_social_media_to_enterprises.rb b/db/migrate/20140522015012_add_social_media_to_enterprises.rb deleted file mode 100644 index 9ca88cf0dc..0000000000 --- a/db/migrate/20140522015012_add_social_media_to_enterprises.rb +++ /dev/null @@ -1,7 +0,0 @@ -class AddSocialMediaToEnterprises < ActiveRecord::Migration - def change - add_column :enterprises, :facebook, :string - add_column :enterprises, :instagram, :string - add_column :enterprises, :linkedin, :string - end -end diff --git a/db/migrate/20140522044009_add_primary_taxon_to_products.rb b/db/migrate/20140522044009_add_primary_taxon_to_products.rb deleted file mode 100644 index d985d7f1b8..0000000000 --- a/db/migrate/20140522044009_add_primary_taxon_to_products.rb +++ /dev/null @@ -1,20 +0,0 @@ -class AddPrimaryTaxonToProducts < ActiveRecord::Migration - def up - add_column :spree_products, :primary_taxon_id, :integer - - add_index :spree_products, :primary_taxon_id - add_foreign_key :spree_products, :spree_taxons, column: :primary_taxon_id - - Spree::Product.all.each do |p| - primary_taxon = p.taxons.where('spree_taxons.name != ?', 'specials').first - first_taxon = Spree::Taxonomy.find_by_name('Products').andand.root || Spree::Taxon.first - p.update_column :primary_taxon_id, (primary_taxon || first_taxon) - end - - change_column :spree_products, :primary_taxon_id, :integer, null: false - end - - def down - remove_column :spree_products, :primary_taxon_id - end -end diff --git a/db/migrate/20140604051248_add_display_name_and_display_as_to_spree_variants.rb b/db/migrate/20140604051248_add_display_name_and_display_as_to_spree_variants.rb deleted file mode 100644 index a2c1080b31..0000000000 --- a/db/migrate/20140604051248_add_display_name_and_display_as_to_spree_variants.rb +++ /dev/null @@ -1,6 +0,0 @@ -class AddDisplayNameAndDisplayAsToSpreeVariants < ActiveRecord::Migration - def change - add_column :spree_variants, :display_name, :string - add_column :spree_variants, :display_as, :string - end -end diff --git a/db/migrate/20140612020206_remove_deleted_variants_from_order_cycles.rb b/db/migrate/20140612020206_remove_deleted_variants_from_order_cycles.rb deleted file mode 100644 index cb03abe09a..0000000000 --- a/db/migrate/20140612020206_remove_deleted_variants_from_order_cycles.rb +++ /dev/null @@ -1,10 +0,0 @@ -class RemoveDeletedVariantsFromOrderCycles < ActiveRecord::Migration - def up - evs = ExchangeVariant.joins(:variant).where('spree_variants.deleted_at IS NOT NULL') - say "Removing #{evs.count} deleted variants from order cycles..." - evs.destroy_all - end - - def down - end -end diff --git a/db/migrate/20140613004344_create_producer_properties.rb b/db/migrate/20140613004344_create_producer_properties.rb deleted file mode 100644 index b45b3bed5d..0000000000 --- a/db/migrate/20140613004344_create_producer_properties.rb +++ /dev/null @@ -1,18 +0,0 @@ -class CreateProducerProperties < ActiveRecord::Migration - def change - create_table :producer_properties do |t| - t.string :value - t.references :producer - t.references :property - t.integer :position - t.timestamps - end - - add_index :producer_properties, :producer_id - add_index :producer_properties, :property_id - add_index :producer_properties, :position - - add_foreign_key :producer_properties, :enterprises, column: :producer_id - add_foreign_key :producer_properties, :spree_properties, column: :property_id - end -end diff --git a/db/migrate/20140621230121_change_suburb_postcode_to_string.rb b/db/migrate/20140621230121_change_suburb_postcode_to_string.rb deleted file mode 100644 index 4756c71c59..0000000000 --- a/db/migrate/20140621230121_change_suburb_postcode_to_string.rb +++ /dev/null @@ -1,9 +0,0 @@ -class ChangeSuburbPostcodeToString < ActiveRecord::Migration - def up - change_column :suburbs, :postcode, :string - end - - def down - change_column :suburbs, :postcode, 'integer USING (postcode::integer)' - end -end diff --git a/db/migrate/20140702053145_add_fields_to_distributors_shipping_methods.rb b/db/migrate/20140702053145_add_fields_to_distributors_shipping_methods.rb deleted file mode 100644 index 75fa60e7b7..0000000000 --- a/db/migrate/20140702053145_add_fields_to_distributors_shipping_methods.rb +++ /dev/null @@ -1,23 +0,0 @@ -class AddFieldsToDistributorsShippingMethods < ActiveRecord::Migration - class DistributorShippingMethod < ActiveRecord::Base - self.table_name = "distributors_shipping_methods" - end - - def up - add_column :distributors_shipping_methods, :id, :primary_key - add_column :distributors_shipping_methods, :created_at, :datetime - add_column :distributors_shipping_methods, :updated_at, :datetime - - DistributorShippingMethod.reset_column_information - DistributorShippingMethod.update_all created_at: Time.zone.now, updated_at: Time.zone.now - - change_column :distributors_shipping_methods, :created_at, :datetime, null: false - change_column :distributors_shipping_methods, :updated_at, :datetime, null: false - end - - def down - remove_column :distributors_shipping_methods, :id - remove_column :distributors_shipping_methods, :created_at - remove_column :distributors_shipping_methods, :updated_at - end -end diff --git a/db/migrate/20140716051214_drop_landing_page_images.rb b/db/migrate/20140716051214_drop_landing_page_images.rb deleted file mode 100644 index d7324ed94b..0000000000 --- a/db/migrate/20140716051214_drop_landing_page_images.rb +++ /dev/null @@ -1,16 +0,0 @@ -class DropLandingPageImages < ActiveRecord::Migration - def up - drop_table :landing_page_images - end - - def down - create_table :landing_page_images do |t| - t.string :photo_file_name - t.string :photo_content_type - t.integer :photo_file_size - t.datetime :photo_updated_at - - t.timestamps - end - end -end diff --git a/db/migrate/20140723021730_create_spree_paypal_express_checkouts.spree_paypal_express.rb b/db/migrate/20140723021730_create_spree_paypal_express_checkouts.spree_paypal_express.rb deleted file mode 100644 index 1f30b68bff..0000000000 --- a/db/migrate/20140723021730_create_spree_paypal_express_checkouts.spree_paypal_express.rb +++ /dev/null @@ -1,9 +0,0 @@ -# This migration comes from spree_paypal_express (originally 20130723042610) -class CreateSpreePaypalExpressCheckouts < ActiveRecord::Migration - def change - create_table :spree_paypal_express_checkouts do |t| - t.string :token - t.string :payer_id - end - end -end diff --git a/db/migrate/20140723021731_add_transaction_id_to_spree_paypal_express_checkouts.spree_paypal_express.rb b/db/migrate/20140723021731_add_transaction_id_to_spree_paypal_express_checkouts.spree_paypal_express.rb deleted file mode 100644 index 3603e8887a..0000000000 --- a/db/migrate/20140723021731_add_transaction_id_to_spree_paypal_express_checkouts.spree_paypal_express.rb +++ /dev/null @@ -1,7 +0,0 @@ -# This migration comes from spree_paypal_express (originally 20130808030836) -class AddTransactionIdToSpreePaypalExpressCheckouts < ActiveRecord::Migration - def change - add_column :spree_paypal_express_checkouts, :transaction_id, :string - add_index :spree_paypal_express_checkouts, :transaction_id - end -end diff --git a/db/migrate/20140723021732_add_state_to_spree_paypal_express_checkouts.spree_paypal_express.rb b/db/migrate/20140723021732_add_state_to_spree_paypal_express_checkouts.spree_paypal_express.rb deleted file mode 100644 index 56a35ae307..0000000000 --- a/db/migrate/20140723021732_add_state_to_spree_paypal_express_checkouts.spree_paypal_express.rb +++ /dev/null @@ -1,6 +0,0 @@ -# This migration comes from spree_paypal_express (originally 20130809013846) -class AddStateToSpreePaypalExpressCheckouts < ActiveRecord::Migration - def change - add_column :spree_paypal_express_checkouts, :state, :string, :default => "complete" - end -end diff --git a/db/migrate/20140723021733_add_refunded_fields_to_spree_paypal_express_checkouts.spree_paypal_express.rb b/db/migrate/20140723021733_add_refunded_fields_to_spree_paypal_express_checkouts.spree_paypal_express.rb deleted file mode 100644 index eb2d10e7f7..0000000000 --- a/db/migrate/20140723021733_add_refunded_fields_to_spree_paypal_express_checkouts.spree_paypal_express.rb +++ /dev/null @@ -1,9 +0,0 @@ -# This migration comes from spree_paypal_express (originally 20130809014319) -class AddRefundedFieldsToSpreePaypalExpressCheckouts < ActiveRecord::Migration - def change - add_column :spree_paypal_express_checkouts, :refund_transaction_id, :string - add_column :spree_paypal_express_checkouts, :refunded_at, :datetime - add_column :spree_paypal_express_checkouts, :refund_type, :string - add_column :spree_paypal_express_checkouts, :created_at, :datetime - end -end diff --git a/db/migrate/20140723023713_switch_paypal_methods.rb b/db/migrate/20140723023713_switch_paypal_methods.rb deleted file mode 100644 index 5b5509cb94..0000000000 --- a/db/migrate/20140723023713_switch_paypal_methods.rb +++ /dev/null @@ -1,13 +0,0 @@ -class SwitchPaypalMethods < ActiveRecord::Migration - def up - Spree::PaymentMethod.connection.execute < 1 - e_limit = 100 - e_limit = 1000 if u.admin? - u.update_column :enterprise_limit, e_limit - end - end - end - - def down - remove_column :spree_users, :enterprise_limit - end -end diff --git a/db/migrate/20140927005000_add_dummy_for_missing_emails.rb b/db/migrate/20140927005000_add_dummy_for_missing_emails.rb deleted file mode 100644 index 08f638e2a3..0000000000 --- a/db/migrate/20140927005000_add_dummy_for_missing_emails.rb +++ /dev/null @@ -1,7 +0,0 @@ -class AddDummyForMissingEmails < ActiveRecord::Migration - def up - Enterprise.all.each do |enterprise| - enterprise.update_column(:email, "missing@example.com") if enterprise.read_attribute(:email).blank? - end - end -end diff --git a/db/migrate/20140927005043_enterprise_config_refactor.rb b/db/migrate/20140927005043_enterprise_config_refactor.rb deleted file mode 100644 index 6b51ac6e50..0000000000 --- a/db/migrate/20140927005043_enterprise_config_refactor.rb +++ /dev/null @@ -1,57 +0,0 @@ -class EnterpriseConfigRefactor < ActiveRecord::Migration - class Enterprise < ActiveRecord::Base - self.inheritance_column = nil - end - - def up - add_column :enterprises, :sells, :string, null: false, default: 'none' - add_index :enterprises, :sells - add_index :enterprises, [:is_primary_producer, :sells] - - Enterprise.reset_column_information - - Enterprise.all.each do |enterprise| - enterprise.update_attributes!({:sells => sells_what?(enterprise)}) - end - - remove_column :enterprises, :type - remove_column :enterprises, :is_distributor - end - - def down - # This process is lossy. Producer profiles wont exist. - add_column :enterprises, :type, :string, null: false, default: 'profile' - add_column :enterprises, :is_distributor, :boolean - - Enterprise.reset_column_information - - Enterprise.all.each do |enterprise| - enterprise.update_attributes!({ - :type => type?(enterprise), - :is_distributor => distributes?(enterprise) - }) - end - - remove_column :enterprises, :sells - end - - def sells_what?(enterprise) - is_distributor = enterprise.read_attribute(:is_distributor) - is_primary_producer = enterprise.read_attribute(:is_primary_producer) - type = enterprise.read_attribute(:type) - return "own" if type == "single" && (is_distributor || is_primary_producer) - return "none" if !is_distributor || type == "profile" - return "any" - end - - def distributes?(enterprise) - enterprise.read_attribute(:sells) != "none" - end - - def type?(enterprise) - sells = enterprise.read_attribute(:sells) - return "profile" if sells == "none" - return "single" if sells == "own" - return "full" - end -end diff --git a/db/migrate/20141003060622_add_standard_variant_to_products.rb b/db/migrate/20141003060622_add_standard_variant_to_products.rb deleted file mode 100644 index 5242f86686..0000000000 --- a/db/migrate/20141003060622_add_standard_variant_to_products.rb +++ /dev/null @@ -1,63 +0,0 @@ -class AddStandardVariantToProducts < ActiveRecord::Migration - def up - # Make sure that all products have a variant_unit - Spree::Product.where("variant_unit IS NULL OR variant_unit = ''").update_all(variant_unit: "items", variant_unit_name: "each") - - # Find products without any standard variants - products_with_only_master = Spree::Product.includes(:variants).where('spree_variants.id IS NULL').select('DISTINCT spree_products.*') - - products_with_only_master.each do |product| - # Add a unit_value to the master variant if it doesn't have one - if product.unit_value.blank? - if product.variant_unit == "weight" && match = product.unit_description.andand.match(/^(\d+(\.\d*)?)(k?g) ?(.*)$/) - scale = (match[3] == "kg" ? 1000 : 1) - product.unit_value = (match[1].to_i*scale) - product.unit_description = match[4] - product.save! - else - unless product.variant_unit == "items" && product.unit_description.present? - product.unit_value = 1 - product.save! - end - end - end - - # Run the callback to add a copy of the master variant as a standard variant - product.send(:ensure_standard_variant) - - existing_master = product.master - new_variant = product.variants.first - - # Replace any relevant references to the master variant with the new standard variant - - # Inventory Units - # Strategy: do nothing to inventory units pertaining to existing_master, - # new inventory units will be created with reference to new_variant - - # Line Items - # Strategy: do nothing to line items pertaining to existing_master, - # new line items will be created with reference to new_variant - - # Option Values - # Strategy: add all option values on existing_master to new_variant, and keep on existing_master - option_values = existing_master.option_values - option_values.each do |option_value| - variant_ids = option_value.variant_ids - variant_ids << new_variant.id - option_value.update_attributes(variant_ids: variant_ids) - end - - # Prices - # Strategy: duplicate all prices on existing_master and assign them to new_variant - existing_prices = existing_master.prices - existing_prices.each do |price| - new_variant.prices << price.dup - end - - # Exchange Variants - # Strategy: Replace all references to existing master in exchanges with new_variant - exchange_variants = ExchangeVariant.where(variant_id: existing_master.id) - exchange_variants.update_all(variant_id: new_variant.id) - end - end -end diff --git a/db/migrate/20141010043405_add_confirmable_to_enterprise.rb b/db/migrate/20141010043405_add_confirmable_to_enterprise.rb deleted file mode 100644 index 9c29bd5f2c..0000000000 --- a/db/migrate/20141010043405_add_confirmable_to_enterprise.rb +++ /dev/null @@ -1,16 +0,0 @@ -class AddConfirmableToEnterprise < ActiveRecord::Migration - def up - add_column :enterprises, :confirmation_token, :string - add_column :enterprises, :confirmed_at, :datetime - add_column :enterprises, :confirmation_sent_at, :datetime - add_column :enterprises, :unconfirmed_email, :string - add_index :enterprises, :confirmation_token, :unique => true - - # Existing enterprises are assumed to be confirmed - Enterprise.update_all(:confirmed_at => Time.zone.now) - end - - def down - remove_columns :enterprises, :confirmation_token, :confirmed_at, :confirmation_sent_at, :unconfirmed_email - end -end diff --git a/db/migrate/20141022050659_add_shop_trial_start_date_to_enterprises.rb b/db/migrate/20141022050659_add_shop_trial_start_date_to_enterprises.rb deleted file mode 100644 index c9680f4e40..0000000000 --- a/db/migrate/20141022050659_add_shop_trial_start_date_to_enterprises.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddShopTrialStartDateToEnterprises < ActiveRecord::Migration - def change - add_column :enterprises, :shop_trial_start_date, :datetime, default: nil - end -end diff --git a/db/migrate/20141023050324_add_producer_profile_only_to_enterprises.rb b/db/migrate/20141023050324_add_producer_profile_only_to_enterprises.rb deleted file mode 100644 index fb73d123f8..0000000000 --- a/db/migrate/20141023050324_add_producer_profile_only_to_enterprises.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddProducerProfileOnlyToEnterprises < ActiveRecord::Migration - def change - add_column :enterprises, :producer_profile_only, :boolean, default: false - end -end diff --git a/db/migrate/20141113053004_create_variant_overrides.rb b/db/migrate/20141113053004_create_variant_overrides.rb deleted file mode 100644 index ae3746f828..0000000000 --- a/db/migrate/20141113053004_create_variant_overrides.rb +++ /dev/null @@ -1,15 +0,0 @@ -class CreateVariantOverrides < ActiveRecord::Migration - def change - create_table :variant_overrides do |t| - t.references :variant - t.references :hub - t.decimal :price, precision: 8, scale: 2 - t.integer :count_on_hand - end - - add_foreign_key :variant_overrides, :spree_variants, column: :variant_id - add_foreign_key :variant_overrides, :enterprises, column: :hub_id - - add_index :variant_overrides, [:variant_id, :hub_id] - end -end diff --git a/db/migrate/20141210233407_add_not_null_to_variant_override_relations.rb b/db/migrate/20141210233407_add_not_null_to_variant_override_relations.rb deleted file mode 100644 index b2f50167c9..0000000000 --- a/db/migrate/20141210233407_add_not_null_to_variant_override_relations.rb +++ /dev/null @@ -1,11 +0,0 @@ -class AddNotNullToVariantOverrideRelations < ActiveRecord::Migration - def up - change_column :variant_overrides, :hub_id, :integer, null: false - change_column :variant_overrides, :variant_id, :integer, null: false - end - - def down - change_column :variant_overrides, :hub_id, :integer, null: true - change_column :variant_overrides, :variant_id, :integer, null: true - end -end diff --git a/db/migrate/20141219034321_add_permalink_to_enterprises.rb b/db/migrate/20141219034321_add_permalink_to_enterprises.rb deleted file mode 100644 index b912180ba7..0000000000 --- a/db/migrate/20141219034321_add_permalink_to_enterprises.rb +++ /dev/null @@ -1,25 +0,0 @@ -class AddPermalinkToEnterprises < ActiveRecord::Migration - def up - add_column :enterprises, :permalink, :string - - Enterprise.reset_column_information - - Enterprise.all.each do |enterprise| - counter = 1 - permalink = enterprise.name.parameterize - permalink = "my-enterprise-name" if permalink == "" - while Enterprise.find_by_permalink(permalink) do - permalink = enterprise.name.parameterize + counter.to_s - counter += 1 - end - - enterprise.update_column :permalink, permalink - end - - change_column :enterprises, :permalink, :string, null: false - end - - def down - remove_column :enterprises, :permalink - end -end diff --git a/db/migrate/20141229094516_add_receival_time_to_exchange.rb b/db/migrate/20141229094516_add_receival_time_to_exchange.rb deleted file mode 100644 index 06933ed051..0000000000 --- a/db/migrate/20141229094516_add_receival_time_to_exchange.rb +++ /dev/null @@ -1,6 +0,0 @@ -class AddReceivalTimeToExchange < ActiveRecord::Migration - def change - add_column :exchanges, :receival_time, :string - add_column :exchanges, :receival_instructions, :string - end -end diff --git a/db/migrate/20150115050935_add_addresses_ref_to_enterprise_groups.rb b/db/migrate/20150115050935_add_addresses_ref_to_enterprise_groups.rb deleted file mode 100644 index 566b35bb88..0000000000 --- a/db/migrate/20150115050935_add_addresses_ref_to_enterprise_groups.rb +++ /dev/null @@ -1,6 +0,0 @@ -class AddAddressesRefToEnterpriseGroups < ActiveRecord::Migration - def change - add_column :enterprise_groups, :address_id, :integer - add_foreign_key :enterprise_groups, :spree_addresses, column: "address_id" - end -end diff --git a/db/migrate/20150115050936_add_address_instances_to_existing_enterprise_groups.rb b/db/migrate/20150115050936_add_address_instances_to_existing_enterprise_groups.rb deleted file mode 100644 index 3b93ee6386..0000000000 --- a/db/migrate/20150115050936_add_address_instances_to_existing_enterprise_groups.rb +++ /dev/null @@ -1,19 +0,0 @@ -class AddAddressInstancesToExistingEnterpriseGroups < ActiveRecord::Migration - def change - country = Spree::Country.find_by_iso(ENV['DEFAULT_COUNTRY_CODE']) - state = country.states.first - EnterpriseGroup.all.each do |g| - next if g.address.present? - address = Spree::Address.new(firstname: 'unused', lastname: 'unused', address1: 'undefined', city: 'undefined', zipcode: 'undefined', state: state, country: country, phone: 'undefined') - g.address = address - # some groups are invalid, because of a missing description - g.save!(validate: false) - end - end - - def self.down - # we can't know which addresses were already there and which weren't - # and we can't remove addresses as long as they are referenced and - # required by the model - end -end diff --git a/db/migrate/20150121030627_add_web_contact_to_enterprise_groups.rb b/db/migrate/20150121030627_add_web_contact_to_enterprise_groups.rb deleted file mode 100644 index afea2dbeea..0000000000 --- a/db/migrate/20150121030627_add_web_contact_to_enterprise_groups.rb +++ /dev/null @@ -1,10 +0,0 @@ -class AddWebContactToEnterpriseGroups < ActiveRecord::Migration - def change - add_column :enterprise_groups, :email, :string, null: false, default: '' - add_column :enterprise_groups, :website, :string, null: false, default: '' - add_column :enterprise_groups, :facebook, :string, null: false, default: '' - add_column :enterprise_groups, :instagram, :string, null: false, default: '' - add_column :enterprise_groups, :linkedin, :string, null: false, default: '' - add_column :enterprise_groups, :twitter, :string, null: false, default: '' - end -end diff --git a/db/migrate/20150122145607_create_customers.rb b/db/migrate/20150122145607_create_customers.rb deleted file mode 100644 index 12e5a721e8..0000000000 --- a/db/migrate/20150122145607_create_customers.rb +++ /dev/null @@ -1,18 +0,0 @@ -class CreateCustomers < ActiveRecord::Migration - def change - create_table :customers do |t| - t.string :email, null: false - t.references :enterprise, null: false - t.string :code, null: false - t.references :user - - t.timestamps - end - add_index :customers, [:enterprise_id, :code], unique: true - add_index :customers, :email - add_index :customers, :user_id - - add_foreign_key :customers, :enterprises, column: :enterprise_id - add_foreign_key :customers, :spree_users, column: :user_id - end -end diff --git a/db/migrate/20150202000203_add_owner_to_enterprise_groups.rb b/db/migrate/20150202000203_add_owner_to_enterprise_groups.rb deleted file mode 100644 index f2e46452df..0000000000 --- a/db/migrate/20150202000203_add_owner_to_enterprise_groups.rb +++ /dev/null @@ -1,6 +0,0 @@ -class AddOwnerToEnterpriseGroups < ActiveRecord::Migration - def change - add_column :enterprise_groups, :owner_id, :integer - add_foreign_key :enterprise_groups, :spree_users, column: "owner_id" - end -end diff --git a/db/migrate/20150216075336_add_temperature_controlled_to_spree_shipping_categories.rb b/db/migrate/20150216075336_add_temperature_controlled_to_spree_shipping_categories.rb deleted file mode 100644 index 89035fc16f..0000000000 --- a/db/migrate/20150216075336_add_temperature_controlled_to_spree_shipping_categories.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddTemperatureControlledToSpreeShippingCategories < ActiveRecord::Migration - def change - add_column :spree_shipping_categories, :temperature_controlled, :boolean, null: false, default: false - end -end diff --git a/db/migrate/20150219021742_add_owner_index_to_enterprise_groups.rb b/db/migrate/20150219021742_add_owner_index_to_enterprise_groups.rb deleted file mode 100644 index 062e9523e6..0000000000 --- a/db/migrate/20150219021742_add_owner_index_to_enterprise_groups.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddOwnerIndexToEnterpriseGroups < ActiveRecord::Migration - def change - add_index :enterprise_groups, :owner_id - end -end diff --git a/db/migrate/20150220035501_add_address_id_index_to_enterprise_groups.rb b/db/migrate/20150220035501_add_address_id_index_to_enterprise_groups.rb deleted file mode 100644 index 32094cbde7..0000000000 --- a/db/migrate/20150220035501_add_address_id_index_to_enterprise_groups.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddAddressIdIndexToEnterpriseGroups < ActiveRecord::Migration - def change - add_index :enterprise_groups, :address_id - end -end diff --git a/db/migrate/20150225111538_add_tax_category_to_enterprise_fee.rb b/db/migrate/20150225111538_add_tax_category_to_enterprise_fee.rb deleted file mode 100644 index 05b5410587..0000000000 --- a/db/migrate/20150225111538_add_tax_category_to_enterprise_fee.rb +++ /dev/null @@ -1,7 +0,0 @@ -class AddTaxCategoryToEnterpriseFee < ActiveRecord::Migration - def change - add_column :enterprise_fees, :tax_category_id, :integer - add_foreign_key :enterprise_fees, :spree_tax_categories, column: :tax_category_id - add_index :enterprise_fees, :tax_category_id - end -end diff --git a/db/migrate/20150225232938_add_included_tax_to_adjustments.rb b/db/migrate/20150225232938_add_included_tax_to_adjustments.rb deleted file mode 100644 index f3815dec2a..0000000000 --- a/db/migrate/20150225232938_add_included_tax_to_adjustments.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddIncludedTaxToAdjustments < ActiveRecord::Migration - def change - add_column :spree_adjustments, :included_tax, :decimal, precision: 10, scale: 2, null: false, default: 0 - end -end diff --git a/db/migrate/20150305004846_add_weight_to_line_items.rb b/db/migrate/20150305004846_add_weight_to_line_items.rb deleted file mode 100644 index a4df1a12f0..0000000000 --- a/db/migrate/20150305004846_add_weight_to_line_items.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddWeightToLineItems < ActiveRecord::Migration - def change - add_column :spree_line_items, :unit_value, :decimal, :precision => 8, :scale => 2 - end -end diff --git a/db/migrate/20150407234739_add_charges_sales_tax_to_enterprises.rb b/db/migrate/20150407234739_add_charges_sales_tax_to_enterprises.rb deleted file mode 100644 index ba8dfa7a08..0000000000 --- a/db/migrate/20150407234739_add_charges_sales_tax_to_enterprises.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddChargesSalesTaxToEnterprises < ActiveRecord::Migration - def change - add_column :enterprises, :charges_sales_tax, :boolean, null: false, default: false - end -end diff --git a/db/migrate/20150410043302_create_delayed_jobs.rb b/db/migrate/20150410043302_create_delayed_jobs.rb deleted file mode 100644 index f7de70bdc5..0000000000 --- a/db/migrate/20150410043302_create_delayed_jobs.rb +++ /dev/null @@ -1,22 +0,0 @@ -class CreateDelayedJobs < ActiveRecord::Migration - def self.up - create_table :delayed_jobs, :force => true do |table| - table.integer :priority, :default => 0, :null => false # Allows some jobs to jump to the front of the queue - table.integer :attempts, :default => 0, :null => false # Provides for retries, but still fail eventually. - table.text :handler, :null => false # YAML-encoded string of the object that will do work - table.text :last_error # reason for last failure (See Note below) - table.datetime :run_at # When to run. Could be Time.zone.now for immediately, or sometime in the future. - table.datetime :locked_at # Set when a client is working on this object - table.datetime :failed_at # Set when all retries have failed (actually, by default, the record is deleted instead) - table.string :locked_by # Who is working on this object (if locked) - table.string :queue # The name of the queue this job is in - table.timestamps - end - - add_index :delayed_jobs, [:priority, :run_at], :name => 'delayed_jobs_priority' - end - - def self.down - drop_table :delayed_jobs - end -end diff --git a/db/migrate/20150422014819_add_inherits_properties_to_product.rb b/db/migrate/20150422014819_add_inherits_properties_to_product.rb deleted file mode 100644 index aba8bbbe45..0000000000 --- a/db/migrate/20150422014819_add_inherits_properties_to_product.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddInheritsPropertiesToProduct < ActiveRecord::Migration - def change - add_column :spree_products, :inherits_properties, :boolean, null: false, default: true - end -end diff --git a/db/migrate/20150424025907_add_default_and_not_null_to_producer_properties_position.rb b/db/migrate/20150424025907_add_default_and_not_null_to_producer_properties_position.rb deleted file mode 100644 index 8c5a2d1f2c..0000000000 --- a/db/migrate/20150424025907_add_default_and_not_null_to_producer_properties_position.rb +++ /dev/null @@ -1,9 +0,0 @@ -class AddDefaultAndNotNullToProducerPropertiesPosition < ActiveRecord::Migration - def change - ProducerProperty.where(position: nil).each do |producer_property| - producer_property.update_attribute(:position, 0) - end - - change_column :producer_properties, :position, :integer, null: false, default: 0 - end -end diff --git a/db/migrate/20150424151117_populate_line_item_unit_value.rb b/db/migrate/20150424151117_populate_line_item_unit_value.rb deleted file mode 100644 index 2122b84472..0000000000 --- a/db/migrate/20150424151117_populate_line_item_unit_value.rb +++ /dev/null @@ -1,9 +0,0 @@ -class PopulateLineItemUnitValue < ActiveRecord::Migration - def up - execute "UPDATE spree_line_items SET unit_value = spree_variants.unit_value FROM spree_variants WHERE spree_line_items.variant_id = spree_variants.id" - end - - def down - raise ActiveRecord::IrreversibleMigration - end -end diff --git a/db/migrate/20150508030520_acts_as_taggable_on_migration.acts_as_taggable_on_engine.rb b/db/migrate/20150508030520_acts_as_taggable_on_migration.acts_as_taggable_on_engine.rb deleted file mode 100644 index 6bbd5594ea..0000000000 --- a/db/migrate/20150508030520_acts_as_taggable_on_migration.acts_as_taggable_on_engine.rb +++ /dev/null @@ -1,31 +0,0 @@ -# This migration comes from acts_as_taggable_on_engine (originally 1) -class ActsAsTaggableOnMigration < ActiveRecord::Migration - def self.up - create_table :tags do |t| - t.string :name - end - - create_table :taggings do |t| - t.references :tag - - # You should make sure that the column created is - # long enough to store the required class names. - t.references :taggable, polymorphic: true - t.references :tagger, polymorphic: true - - # Limit is created to prevent MySQL error on index - # length for MyISAM table type: http://bit.ly/vgW2Ql - t.string :context, limit: 128 - - t.datetime :created_at - end - - add_index :taggings, :tag_id - add_index :taggings, [:taggable_id, :taggable_type, :context] - end - - def self.down - drop_table :taggings - drop_table :tags - end -end diff --git a/db/migrate/20150508030521_add_missing_unique_indices.acts_as_taggable_on_engine.rb b/db/migrate/20150508030521_add_missing_unique_indices.acts_as_taggable_on_engine.rb deleted file mode 100644 index 4ca676f6c7..0000000000 --- a/db/migrate/20150508030521_add_missing_unique_indices.acts_as_taggable_on_engine.rb +++ /dev/null @@ -1,20 +0,0 @@ -# This migration comes from acts_as_taggable_on_engine (originally 2) -class AddMissingUniqueIndices < ActiveRecord::Migration - def self.up - add_index :tags, :name, unique: true - - remove_index :taggings, :tag_id - remove_index :taggings, [:taggable_id, :taggable_type, :context] - add_index :taggings, - [:tag_id, :taggable_id, :taggable_type, :context, :tagger_id, :tagger_type], - unique: true, name: 'taggings_idx' - end - - def self.down - remove_index :tags, :name - - remove_index :taggings, name: 'taggings_idx' - add_index :taggings, :tag_id - add_index :taggings, [:taggable_id, :taggable_type, :context] - end -end diff --git a/db/migrate/20150508030522_add_taggings_counter_cache_to_tags.acts_as_taggable_on_engine.rb b/db/migrate/20150508030522_add_taggings_counter_cache_to_tags.acts_as_taggable_on_engine.rb deleted file mode 100644 index 8edb508078..0000000000 --- a/db/migrate/20150508030522_add_taggings_counter_cache_to_tags.acts_as_taggable_on_engine.rb +++ /dev/null @@ -1,15 +0,0 @@ -# This migration comes from acts_as_taggable_on_engine (originally 3) -class AddTaggingsCounterCacheToTags < ActiveRecord::Migration - def self.up - add_column :tags, :taggings_count, :integer, default: 0 - - ActsAsTaggableOn::Tag.reset_column_information - ActsAsTaggableOn::Tag.find_each do |tag| - ActsAsTaggableOn::Tag.reset_counters(tag.id, :taggings) - end - end - - def self.down - remove_column :tags, :taggings_count - end -end diff --git a/db/migrate/20150508030523_add_missing_taggable_index.acts_as_taggable_on_engine.rb b/db/migrate/20150508030523_add_missing_taggable_index.acts_as_taggable_on_engine.rb deleted file mode 100644 index 71f2d7f433..0000000000 --- a/db/migrate/20150508030523_add_missing_taggable_index.acts_as_taggable_on_engine.rb +++ /dev/null @@ -1,10 +0,0 @@ -# This migration comes from acts_as_taggable_on_engine (originally 4) -class AddMissingTaggableIndex < ActiveRecord::Migration - def self.up - add_index :taggings, [:taggable_id, :taggable_type, :context] - end - - def self.down - remove_index :taggings, [:taggable_id, :taggable_type, :context] - end -end diff --git a/db/migrate/20150508030524_change_collation_for_tag_names.acts_as_taggable_on_engine.rb b/db/migrate/20150508030524_change_collation_for_tag_names.acts_as_taggable_on_engine.rb deleted file mode 100644 index bfb06bc7cd..0000000000 --- a/db/migrate/20150508030524_change_collation_for_tag_names.acts_as_taggable_on_engine.rb +++ /dev/null @@ -1,10 +0,0 @@ -# This migration comes from acts_as_taggable_on_engine (originally 5) -# This migration is added to circumvent issue #623 and have special characters -# work properly -class ChangeCollationForTagNames < ActiveRecord::Migration - def up - if ActsAsTaggableOn::Utils.using_mysql? - execute("ALTER TABLE tags MODIFY name varchar(255) CHARACTER SET utf8 COLLATE utf8_bin;") - end - end -end diff --git a/db/migrate/20150508072454_remove_customer_code_not_null_constraint.rb b/db/migrate/20150508072454_remove_customer_code_not_null_constraint.rb deleted file mode 100644 index deeacbc608..0000000000 --- a/db/migrate/20150508072454_remove_customer_code_not_null_constraint.rb +++ /dev/null @@ -1,9 +0,0 @@ -class RemoveCustomerCodeNotNullConstraint < ActiveRecord::Migration - def up - change_column :customers, :code, :string, null: true - end - - def down - change_column :customers, :code, :string, null: false - end -end diff --git a/db/migrate/20150508072938_add_customer_to_orders.rb b/db/migrate/20150508072938_add_customer_to_orders.rb deleted file mode 100644 index 79d69baf49..0000000000 --- a/db/migrate/20150508072938_add_customer_to_orders.rb +++ /dev/null @@ -1,16 +0,0 @@ -class AddCustomerToOrders < ActiveRecord::Migration - def change - add_column :spree_orders, :customer_id, :integer - add_index :spree_orders, :customer_id - add_foreign_key :spree_orders, :customers, column: :customer_id - - Spree::Order.where("spree_orders.email IS NOT NULL AND distributor_id IS NOT NULL AND customer_id IS NULL").each do |order| - customer = Customer.find_by_email_and_enterprise_id(order.email, order.distributor_id) - unless customer.present? - user = Spree::User.find_by_email(order.email) - customer = Customer.create!(email: order.email, enterprise_id: order.distributor_id, user_id: user.andand.id ) - end - order.update_attribute(:customer, customer) - end - end -end diff --git a/db/migrate/20150527004427_add_permalink_to_groups.rb b/db/migrate/20150527004427_add_permalink_to_groups.rb deleted file mode 100644 index ab6886cff4..0000000000 --- a/db/migrate/20150527004427_add_permalink_to_groups.rb +++ /dev/null @@ -1,26 +0,0 @@ -class AddPermalinkToGroups < ActiveRecord::Migration - def up - add_column :enterprise_groups, :permalink, :string - - EnterpriseGroup.reset_column_information - - EnterpriseGroup.all.each do |group| - counter = 1 - permalink = group.name.parameterize - permalink = "my-group-name" if permalink == "" - while EnterpriseGroup.find_by_permalink(permalink) do - permalink = group.name.parameterize + counter.to_s - counter += 1 - end - - group.update_column :permalink, permalink - end - - change_column :enterprise_groups, :permalink, :string, null: false - add_index :enterprise_groups, :permalink, :unique => true - end - - def down - remove_column :enterprise_groups, :permalink - end -end diff --git a/db/migrate/20150603001843_add_unique_index_to_enterprise_permalink.rb b/db/migrate/20150603001843_add_unique_index_to_enterprise_permalink.rb deleted file mode 100644 index e8841b2c5f..0000000000 --- a/db/migrate/20150603001843_add_unique_index_to_enterprise_permalink.rb +++ /dev/null @@ -1,16 +0,0 @@ -class AddUniqueIndexToEnterprisePermalink < ActiveRecord::Migration - def change - duplicates = Enterprise.group(:permalink).having('count(*) > 1').pluck(:permalink) - duplicates.each { |p| resolve_permalink(p) }; - add_index :enterprises, :permalink, :unique => true - end - - def resolve_permalink(permalink) - conflicting = Enterprise.where(permalink: permalink) - while conflicting.size > 1 do - enterprise = conflicting.pop - enterprise.permalink = nil - enterprise.save - end - end -end diff --git a/db/migrate/20150604045725_add_sessions_table.rb b/db/migrate/20150604045725_add_sessions_table.rb deleted file mode 100644 index 4c879564a5..0000000000 --- a/db/migrate/20150604045725_add_sessions_table.rb +++ /dev/null @@ -1,12 +0,0 @@ -class AddSessionsTable < ActiveRecord::Migration - def change - create_table :sessions do |t| - t.string :session_id, :null => false - t.text :data - t.timestamps - end - - add_index :sessions, :session_id - add_index :sessions, :updated_at - end -end diff --git a/db/migrate/20150605052516_dependent_delete_adjustment_metadata.rb b/db/migrate/20150605052516_dependent_delete_adjustment_metadata.rb deleted file mode 100644 index ee9d8d4af8..0000000000 --- a/db/migrate/20150605052516_dependent_delete_adjustment_metadata.rb +++ /dev/null @@ -1,11 +0,0 @@ -class DependentDeleteAdjustmentMetadata < ActiveRecord::Migration - def up - remove_foreign_key "adjustment_metadata", name: "adjustment_metadata_adjustment_id_fk" - add_foreign_key "adjustment_metadata", "spree_adjustments", name: "adjustment_metadata_adjustment_id_fk", column: "adjustment_id", dependent: :delete - end - - def down - remove_foreign_key "adjustment_metadata", name: "adjustment_metadata_adjustment_id_fk" - add_foreign_key "adjustment_metadata", "spree_adjustments", name: "adjustment_metadata_adjustment_id_fk", column: "adjustment_id" - end -end diff --git a/db/migrate/20150612045544_make_enterprises_name_unique.rb b/db/migrate/20150612045544_make_enterprises_name_unique.rb deleted file mode 100644 index 5722284d94..0000000000 --- a/db/migrate/20150612045544_make_enterprises_name_unique.rb +++ /dev/null @@ -1,20 +0,0 @@ -class MakeEnterprisesNameUnique < ActiveRecord::Migration - def up - dup_names = Enterprise.group('name').select('name, COUNT(*) AS num_enterprises') - - dup_names.each do |data| - (data.num_enterprises.to_i - 1).times do |i| - e = Enterprise.find_by_name data.name - new_name = "#{data.name}-#{i+1}" - e.update_column :name, new_name - say "Renamed enterprise #{data.name} to #{new_name}" - end - end - - add_index :enterprises, :name, unique: true - end - - def down - remove_index :enterprises, :name - end -end diff --git a/db/migrate/20150619020711_create_versions.rb b/db/migrate/20150619020711_create_versions.rb deleted file mode 100644 index 23be970c66..0000000000 --- a/db/migrate/20150619020711_create_versions.rb +++ /dev/null @@ -1,13 +0,0 @@ -class CreateVersions < ActiveRecord::Migration - def change - create_table :versions do |t| - t.string :item_type, :null => false - t.integer :item_id, :null => false - t.string :event, :null => false - t.string :whodunnit - t.text :object - t.datetime :created_at - end - add_index :versions, [:item_type, :item_id] - end -end diff --git a/db/migrate/20150619100137_create_bill_items.rb b/db/migrate/20150619100137_create_bill_items.rb deleted file mode 100644 index fec80692b1..0000000000 --- a/db/migrate/20150619100137_create_bill_items.rb +++ /dev/null @@ -1,15 +0,0 @@ -class CreateBillItems < ActiveRecord::Migration - def change - create_table :bill_items do |t| - t.references :enterprise, nil: false - t.references :owner, nil: false - t.datetime :begins_at, default: nil - t.datetime :ends_at, default: nil - t.string :sells, default: nil - t.boolean :trial, default: false - t.decimal :turnover, default: 0.0 - t.foreign_key :enterprises - t.foreign_key :spree_users, column: :owner_id - end - end -end diff --git a/db/migrate/20150626090338_rename_bill_items_to_billable_periods.rb b/db/migrate/20150626090338_rename_bill_items_to_billable_periods.rb deleted file mode 100644 index caa2fb9a4d..0000000000 --- a/db/migrate/20150626090338_rename_bill_items_to_billable_periods.rb +++ /dev/null @@ -1,9 +0,0 @@ -class RenameBillItemsToBillablePeriods < ActiveRecord::Migration - def up - rename_table :bill_items, :billable_periods - end - - def down - rename_table :billable_periods, :bill_items - end -end diff --git a/db/migrate/20150701034055_add_timestamps_to_billable_periods.rb b/db/migrate/20150701034055_add_timestamps_to_billable_periods.rb deleted file mode 100644 index 6c3ea52356..0000000000 --- a/db/migrate/20150701034055_add_timestamps_to_billable_periods.rb +++ /dev/null @@ -1,8 +0,0 @@ -class AddTimestampsToBillablePeriods < ActiveRecord::Migration - def change - change_table(:billable_periods) do |t| - t.datetime :deleted_at, default: nil - t.timestamps - end - end -end diff --git a/db/migrate/20150719111807_add_default_stock_to_variant_overrides.rb b/db/migrate/20150719111807_add_default_stock_to_variant_overrides.rb deleted file mode 100644 index 880a1b8349..0000000000 --- a/db/migrate/20150719111807_add_default_stock_to_variant_overrides.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddDefaultStockToVariantOverrides < ActiveRecord::Migration - def change - add_column :variant_overrides, :default_stock, :integer - end -end diff --git a/db/migrate/20150719153136_rename_line_item_unit_value.rb b/db/migrate/20150719153136_rename_line_item_unit_value.rb deleted file mode 100644 index 9dbdce75c5..0000000000 --- a/db/migrate/20150719153136_rename_line_item_unit_value.rb +++ /dev/null @@ -1,5 +0,0 @@ -class RenameLineItemUnitValue < ActiveRecord::Migration - def change - rename_column :spree_line_items, :unit_value, :final_weight_volume - end -end diff --git a/db/migrate/20150719153732_update_precision_on_line_item_final_weight_volume.rb b/db/migrate/20150719153732_update_precision_on_line_item_final_weight_volume.rb deleted file mode 100644 index c1b3482c0f..0000000000 --- a/db/migrate/20150719153732_update_precision_on_line_item_final_weight_volume.rb +++ /dev/null @@ -1,11 +0,0 @@ -class UpdatePrecisionOnLineItemFinalWeightVolume < ActiveRecord::Migration - def up - change_column :spree_line_items, :final_weight_volume, :decimal, :precision => 10, :scale => 2 - end - - def down - raise ActiveRecord::IrreversibleMigration - end -end - - diff --git a/db/migrate/20150730160010_update_spree_line_item_final_weight_volume.rb b/db/migrate/20150730160010_update_spree_line_item_final_weight_volume.rb deleted file mode 100644 index 4d51a7160b..0000000000 --- a/db/migrate/20150730160010_update_spree_line_item_final_weight_volume.rb +++ /dev/null @@ -1,9 +0,0 @@ -class UpdateSpreeLineItemFinalWeightVolume < ActiveRecord::Migration - def up - execute "UPDATE spree_line_items SET final_weight_volume = final_weight_volume * quantity" - end - - def down - raise ActiveRecord::IrreversibleMigration - end -end diff --git a/db/migrate/20150827194622_add_enable_reset_to_variant_overrides.rb b/db/migrate/20150827194622_add_enable_reset_to_variant_overrides.rb deleted file mode 100644 index 172cce6588..0000000000 --- a/db/migrate/20150827194622_add_enable_reset_to_variant_overrides.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddEnableResetToVariantOverrides < ActiveRecord::Migration - def change - add_column :variant_overrides, :enable_reset, :boolean - end -end diff --git a/db/migrate/20150916012814_create_account_invoices.rb b/db/migrate/20150916012814_create_account_invoices.rb deleted file mode 100644 index 7e92a53593..0000000000 --- a/db/migrate/20150916012814_create_account_invoices.rb +++ /dev/null @@ -1,18 +0,0 @@ -class CreateAccountInvoices < ActiveRecord::Migration - def change - create_table :account_invoices do |t| - t.references :user, null: false - t.references :order - t.integer :year, null: false - t.integer :month, null: false - t.datetime :issued_at - - t.timestamps - end - add_index :account_invoices, :user_id - add_index :account_invoices, :order_id - - add_foreign_key :account_invoices, :spree_orders, column: :order_id - add_foreign_key :account_invoices, :spree_users, column: :user_id - end -end diff --git a/db/migrate/20150916061809_add_account_invoice_to_billable_periods.rb b/db/migrate/20150916061809_add_account_invoice_to_billable_periods.rb deleted file mode 100644 index ee1d9d5d93..0000000000 --- a/db/migrate/20150916061809_add_account_invoice_to_billable_periods.rb +++ /dev/null @@ -1,7 +0,0 @@ -class AddAccountInvoiceToBillablePeriods < ActiveRecord::Migration - def change - add_column :billable_periods, :account_invoice_id, :integer, null: false - add_index :billable_periods, :account_invoice_id - add_foreign_key :billable_periods, :account_invoices, column: :account_invoice_id - end -end diff --git a/db/migrate/20150924054538_add_option_values_line_items_join_table.rb b/db/migrate/20150924054538_add_option_values_line_items_join_table.rb deleted file mode 100644 index 7a51c851ec..0000000000 --- a/db/migrate/20150924054538_add_option_values_line_items_join_table.rb +++ /dev/null @@ -1,14 +0,0 @@ -class AddOptionValuesLineItemsJoinTable < ActiveRecord::Migration - def change - create_table :spree_option_values_line_items, :id => false, :force => true do |t| - t.integer :line_item_id - t.integer :option_value_id - end - - Spree::LineItem.all.each do |line_item| - line_item.update_units - end - - add_index :spree_option_values_line_items, :line_item_id, :name => 'index_option_values_line_items_on_line_item_id' - end -end diff --git a/db/migrate/20151002020537_ensure_address_for_account_invoice_orders.rb b/db/migrate/20151002020537_ensure_address_for_account_invoice_orders.rb deleted file mode 100644 index 6d2c7d45c5..0000000000 --- a/db/migrate/20151002020537_ensure_address_for_account_invoice_orders.rb +++ /dev/null @@ -1,15 +0,0 @@ -class EnsureAddressForAccountInvoiceOrders < ActiveRecord::Migration - def up - AccountInvoice.where('order_id IS NOT NULL').each do |account_invoice| - billable_periods = account_invoice.billable_periods.order(:enterprise_id).reject{ |bp| bp.turnover == 0 } - - if billable_periods.any? - address = billable_periods.first.enterprise.address - account_invoice.order.update_attributes(bill_address: address, ship_address: address) - end - end - end - - def down - end -end diff --git a/db/migrate/20151125051510_combine_exchange_receival_time_receival_instructions.rb b/db/migrate/20151125051510_combine_exchange_receival_time_receival_instructions.rb deleted file mode 100644 index 434a2053ab..0000000000 --- a/db/migrate/20151125051510_combine_exchange_receival_time_receival_instructions.rb +++ /dev/null @@ -1,9 +0,0 @@ -class CombineExchangeReceivalTimeReceivalInstructions < ActiveRecord::Migration - def up - remove_column :exchanges, :receival_time - end - - def down - add_column :exchanges, :receival_time, :string - end -end diff --git a/db/migrate/20151126235409_add_on_demand_and_sku_to_variant_overrides.rb b/db/migrate/20151126235409_add_on_demand_and_sku_to_variant_overrides.rb deleted file mode 100644 index 9c47bfbc27..0000000000 --- a/db/migrate/20151126235409_add_on_demand_and_sku_to_variant_overrides.rb +++ /dev/null @@ -1,6 +0,0 @@ -class AddOnDemandAndSkuToVariantOverrides < ActiveRecord::Migration - def change - add_column :variant_overrides, :sku, :string, :default => nil, :after => :hub_id - add_column :variant_overrides, :on_demand, :boolean, :default => nil, :after => :count_on_hand - end -end diff --git a/db/migrate/20151128185900_rename_enable_reset_to_resettable.rb b/db/migrate/20151128185900_rename_enable_reset_to_resettable.rb deleted file mode 100644 index 461e2efe25..0000000000 --- a/db/migrate/20151128185900_rename_enable_reset_to_resettable.rb +++ /dev/null @@ -1,3 +0,0 @@ -class RenameEnableResetToResettable < ActiveRecord::Migration - rename_column :variant_overrides, :enable_reset, :resettable -end diff --git a/db/migrate/20160114001844_create_inventory_items.rb b/db/migrate/20160114001844_create_inventory_items.rb deleted file mode 100644 index 2ca54dce4d..0000000000 --- a/db/migrate/20160114001844_create_inventory_items.rb +++ /dev/null @@ -1,13 +0,0 @@ -class CreateInventoryItems < ActiveRecord::Migration - def change - create_table :inventory_items do |t| - t.references :enterprise, null: false, index: true - t.references :variant, null: false, index: true - t.boolean :visible, default: true, null: false - - t.timestamps - end - - add_index "inventory_items", [:enterprise_id, :variant_id], unique: true - end -end diff --git a/db/migrate/20160116024333_create_column_preferences.rb b/db/migrate/20160116024333_create_column_preferences.rb deleted file mode 100644 index e38c51d858..0000000000 --- a/db/migrate/20160116024333_create_column_preferences.rb +++ /dev/null @@ -1,13 +0,0 @@ -class CreateColumnPreferences < ActiveRecord::Migration - def change - create_table :column_preferences do |t| - t.references :user, null: false, index: true - t.string :action_name, null: false, index: true - t.string :column_name, null: false - t.boolean :visible, null: false - - t.timestamps - end - add_index :column_preferences, [:user_id, :action_name, :column_name], unique: true, name: 'index_column_prefs_on_user_id_and_action_name_and_column_name' - end -end diff --git a/db/migrate/20160204013914_add_id_to_coordinator_fees.rb b/db/migrate/20160204013914_add_id_to_coordinator_fees.rb deleted file mode 100644 index 74326a6006..0000000000 --- a/db/migrate/20160204013914_add_id_to_coordinator_fees.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddIdToCoordinatorFees < ActiveRecord::Migration - def change - add_column :coordinator_fees, :id, :primary_key - end -end diff --git a/db/migrate/20160204031816_add_inherits_tax_category_to_enterprise_fees.rb b/db/migrate/20160204031816_add_inherits_tax_category_to_enterprise_fees.rb deleted file mode 100644 index 49751cc479..0000000000 --- a/db/migrate/20160204031816_add_inherits_tax_category_to_enterprise_fees.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddInheritsTaxCategoryToEnterpriseFees < ActiveRecord::Migration - def change - add_column :enterprise_fees, :inherits_tax_category, :boolean, null: false, default: false - end -end diff --git a/db/migrate/20160205044930_add_email_address_to_enterprises.rb b/db/migrate/20160205044930_add_email_address_to_enterprises.rb deleted file mode 100644 index b1047fe4b8..0000000000 --- a/db/migrate/20160205044930_add_email_address_to_enterprises.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddEmailAddressToEnterprises < ActiveRecord::Migration - def change - add_column :enterprises, :email_address, :string - end -end diff --git a/db/migrate/20160212092908_set_enterprise_email_address.rb b/db/migrate/20160212092908_set_enterprise_email_address.rb deleted file mode 100644 index a43591624a..0000000000 --- a/db/migrate/20160212092908_set_enterprise_email_address.rb +++ /dev/null @@ -1,8 +0,0 @@ -class SetEnterpriseEmailAddress < ActiveRecord::Migration - def up - Enterprise.all.each do |enterprise| - enterprise.email_address = enterprise.email - enterprise.save - end - end -end diff --git a/db/migrate/20160218235221_populate_inventories.rb b/db/migrate/20160218235221_populate_inventories.rb deleted file mode 100644 index 2b9d1be8b6..0000000000 --- a/db/migrate/20160218235221_populate_inventories.rb +++ /dev/null @@ -1,22 +0,0 @@ -class PopulateInventories < ActiveRecord::Migration - def up - # If hubs are actively using overrides, populate their inventories with all variants they have permission to override - # Otherwise leave their inventories empty - - hubs_using_overrides = Enterprise.joins("LEFT OUTER JOIN variant_overrides ON variant_overrides.hub_id = enterprises.id") - .where("variant_overrides.id IS NOT NULL").select("DISTINCT enterprises.*") - - hubs_using_overrides.each do |hub| - overridable_producers = OpenFoodNetwork::Permissions.new(hub.owner).variant_override_producers - - variants = Spree::Variant.where(is_master: false, product_id: Spree::Product.not_deleted.where(supplier_id: overridable_producers)) - - variants.each do |variant| - InventoryItem.create(enterprise: hub, variant: variant, visible: true) - end - end - end - - def down - end -end diff --git a/db/migrate/20160224034034_grant_explicit_variant_override_permissions.rb b/db/migrate/20160224034034_grant_explicit_variant_override_permissions.rb deleted file mode 100644 index b56a4a8a93..0000000000 --- a/db/migrate/20160224034034_grant_explicit_variant_override_permissions.rb +++ /dev/null @@ -1,30 +0,0 @@ -class GrantExplicitVariantOverridePermissions < ActiveRecord::Migration - def up - hubs = Enterprise.is_distributor - - begin - EnterpriseRelationship.skip_callback :save, :after, :apply_variant_override_permissions - - hubs.each do |hub| - next if hub.owner.admin? - explicitly_granting_producer_ids = hub.relationships_as_child - .with_permission(:create_variant_overrides).map(&:parent_id) - - managed_producer_ids = Enterprise.managed_by(hub.owner).is_primary_producer.pluck(:id) - implicitly_granting_producer_ids = managed_producer_ids - explicitly_granting_producer_ids - [hub.id] - - # create explicit VO permissions for producers currently granting implicit permission - Enterprise.where(id: implicitly_granting_producer_ids).each do |producer| - relationship = producer.relationships_as_parent.find_or_initialize_by_child_id(hub.id) - permission = relationship.permissions.find_or_initialize_by_name(:create_variant_overrides) - relationship.save! unless permission.persisted? - end - end - ensure - EnterpriseRelationship.set_callback :save, :after, :apply_variant_override_permissions - end - end - - def down - end -end diff --git a/db/migrate/20160224230143_add_permission_revoked_at_to_variant_overrides.rb b/db/migrate/20160224230143_add_permission_revoked_at_to_variant_overrides.rb deleted file mode 100644 index afa58ebe26..0000000000 --- a/db/migrate/20160224230143_add_permission_revoked_at_to_variant_overrides.rb +++ /dev/null @@ -1,21 +0,0 @@ -class AddPermissionRevokedAtToVariantOverrides < ActiveRecord::Migration - def up - add_column :variant_overrides, :permission_revoked_at, :datetime, default: nil - - variant_override_hubs = Enterprise.where(id: VariantOverride.all.map(&:hub_id).uniq) - - variant_override_hubs.each do |hub| - permitting_producer_ids = hub.relationships_as_child - .with_permission(:create_variant_overrides).map(&:parent_id) - - variant_overrides_with_revoked_permissions = VariantOverride.for_hubs(hub) - .joins(variant: :product).where("spree_products.supplier_id NOT IN (?)", permitting_producer_ids) - - variant_overrides_with_revoked_permissions.update_all(permission_revoked_at: Time.now) - end - end - - def down - remove_column :variant_overrides, :permission_revoked_at - end -end diff --git a/db/migrate/20160302044850_repopulate_inventories.rb b/db/migrate/20160302044850_repopulate_inventories.rb deleted file mode 100644 index e38628439a..0000000000 --- a/db/migrate/20160302044850_repopulate_inventories.rb +++ /dev/null @@ -1,30 +0,0 @@ -class RepopulateInventories < ActiveRecord::Migration - # Previous version of this migration (20160218235221) relied on Permissions#variant_override_producers - # which was then changed, meaning that an incomplete set of variants were added to inventories of most hubs - # Re-running this now will ensure that all permitted variants (including those allowed by 20160224034034) are - # added to the relevant inventories - - def up - # If hubs are actively using overrides, populate their inventories with all variants they have permission to override - # Otherwise leave their inventories empty - - hubs_using_overrides = Enterprise.joins("LEFT OUTER JOIN variant_overrides ON variant_overrides.hub_id = enterprises.id") - .where("variant_overrides.id IS NOT NULL").select("DISTINCT enterprises.*") - - hubs_using_overrides.each do |hub| - overridable_producer_ids = hub.relationships_as_child.with_permission(:create_variant_overrides).map(&:parent_id) | [hub.id] - - variants = Spree::Variant.where(is_master: false, product_id: Spree::Product.not_deleted.where(supplier_id: overridable_producer_ids)) - - variants_to_add = variants.joins("LEFT OUTER JOIN (SELECT * from inventory_items WHERE enterprise_id = #{hub.id}) AS o_inventory_items ON o_inventory_items.variant_id = spree_variants.id") - .where('o_inventory_items.id IS NULL') - - variants_to_add.each do |variant| - inventory_item = InventoryItem.create(enterprise: hub, variant: variant, visible: true) - end - end - end - - def down - end -end diff --git a/db/migrate/20160303004210_create_tag_rules.rb b/db/migrate/20160303004210_create_tag_rules.rb deleted file mode 100644 index 157fee1e69..0000000000 --- a/db/migrate/20160303004210_create_tag_rules.rb +++ /dev/null @@ -1,10 +0,0 @@ -class CreateTagRules < ActiveRecord::Migration - def change - create_table :tag_rules do |t| - t.references :enterprise, null: false, index: true - t.string :type, null: false - - t.timestamps - end - end -end diff --git a/db/migrate/20160316051131_add_require_login_to_enterprise.rb b/db/migrate/20160316051131_add_require_login_to_enterprise.rb deleted file mode 100644 index 68de642b62..0000000000 --- a/db/migrate/20160316051131_add_require_login_to_enterprise.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddRequireLoginToEnterprise < ActiveRecord::Migration - def change - add_column :enterprises, :require_login, :boolean, default: false, null: false - end -end diff --git a/db/migrate/20160401043927_change_value_type_of_paypal_passwords.rb b/db/migrate/20160401043927_change_value_type_of_paypal_passwords.rb deleted file mode 100644 index e03ed25f9e..0000000000 --- a/db/migrate/20160401043927_change_value_type_of_paypal_passwords.rb +++ /dev/null @@ -1,15 +0,0 @@ -class ChangeValueTypeOfPaypalPasswords < ActiveRecord::Migration - def up - Spree::Preference - .where("key like ?", "spree/gateway/pay_pal_express/password/%") - .where(value_type: "string") - .update_all(value_type: "password") - end - - def down - Spree::Preference - .where("key like ?", "spree/gateway/pay_pal_express/password/%") - .where(value_type: "password") - .update_all(value_type: "string") - end -end diff --git a/db/migrate/20160520065217_add_is_default_to_tag_rule.rb b/db/migrate/20160520065217_add_is_default_to_tag_rule.rb deleted file mode 100644 index 209520b693..0000000000 --- a/db/migrate/20160520065217_add_is_default_to_tag_rule.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddIsDefaultToTagRule < ActiveRecord::Migration - def change - add_column :tag_rules, :is_default, :boolean, default: false, null: false - end -end diff --git a/db/migrate/20160527012603_add_priority_to_tag_rule.rb b/db/migrate/20160527012603_add_priority_to_tag_rule.rb deleted file mode 100644 index 7080d7a9ac..0000000000 --- a/db/migrate/20160527012603_add_priority_to_tag_rule.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddPriorityToTagRule < ActiveRecord::Migration - def change - add_column :tag_rules, :priority, :integer, default: 99, null: false - end -end diff --git a/db/migrate/20160630052453_create_schedules.rb b/db/migrate/20160630052453_create_schedules.rb deleted file mode 100644 index f1cf5fa5c5..0000000000 --- a/db/migrate/20160630052453_create_schedules.rb +++ /dev/null @@ -1,8 +0,0 @@ -class CreateSchedules < ActiveRecord::Migration - def change - create_table :schedules do |t| - t.string :name, null: false - t.timestamps - end - end -end diff --git a/db/migrate/20160630055825_create_order_cycle_schedules.rb b/db/migrate/20160630055825_create_order_cycle_schedules.rb deleted file mode 100644 index 99147467c9..0000000000 --- a/db/migrate/20160630055825_create_order_cycle_schedules.rb +++ /dev/null @@ -1,14 +0,0 @@ -class CreateOrderCycleSchedules < ActiveRecord::Migration - def change - create_table :order_cycle_schedules do |t| - t.references :order_cycle, null: false - t.references :schedule, null: false - end - - add_index :order_cycle_schedules, :order_cycle_id - add_index :order_cycle_schedules, :schedule_id - - add_foreign_key :order_cycle_schedules, :order_cycles, name: 'oc_schedules_order_cycle_id_fk' - add_foreign_key :order_cycle_schedules, :schedules, name: 'oc_schedules_schedule_id_fk' - end -end diff --git a/db/migrate/20160707023818_drop_cms.rb b/db/migrate/20160707023818_drop_cms.rb deleted file mode 100644 index 018b755466..0000000000 --- a/db/migrate/20160707023818_drop_cms.rb +++ /dev/null @@ -1,154 +0,0 @@ -class DropCms < ActiveRecord::Migration - - # Reverse of CreateCms in 20121009232513_create_cms.rb, including foreign keys defined - # in 20140402033428_add_foreign_keys.rb - - def up - drop_table_cascade :cms_sites - drop_table_cascade :cms_layouts - drop_table_cascade :cms_pages - drop_table_cascade :cms_snippets - drop_table_cascade :cms_blocks - drop_table_cascade :cms_files - drop_table_cascade :cms_revisions - drop_table_cascade :cms_categories - drop_table_cascade :cms_categorizations - end - - def down - text_limit = case ActiveRecord::Base.connection.adapter_name - when 'PostgreSQL' - { } - else - { :limit => 16777215 } - end - - # -- Sites -------------------------------------------------------------- - create_table :cms_sites do |t| - t.string :label, :null => false - t.string :identifier, :null => false - t.string :hostname, :null => false - t.string :path - t.string :locale, :null => false, :default => 'en' - t.boolean :is_mirrored, :null => false, :default => false - end - add_index :cms_sites, :hostname - add_index :cms_sites, :is_mirrored - - # -- Layouts ------------------------------------------------------------ - create_table :cms_layouts do |t| - t.integer :site_id, :null => false - t.integer :parent_id - t.string :app_layout - t.string :label, :null => false - t.string :identifier, :null => false - t.text :content, text_limit - t.text :css, text_limit - t.text :js, text_limit - t.integer :position, :null => false, :default => 0 - t.boolean :is_shared, :null => false, :default => false - t.timestamps - end - add_index :cms_layouts, [:parent_id, :position] - add_index :cms_layouts, [:site_id, :identifier], :unique => true - - # -- Pages -------------------------------------------------------------- - create_table :cms_pages do |t| - t.integer :site_id, :null => false - t.integer :layout_id - t.integer :parent_id - t.integer :target_page_id - t.string :label, :null => false - t.string :slug - t.string :full_path, :null => false - t.text :content, text_limit - t.integer :position, :null => false, :default => 0 - t.integer :children_count, :null => false, :default => 0 - t.boolean :is_published, :null => false, :default => true - t.boolean :is_shared, :null => false, :default => false - t.timestamps - end - add_index :cms_pages, [:site_id, :full_path] - add_index :cms_pages, [:parent_id, :position] - - # -- Page Blocks -------------------------------------------------------- - create_table :cms_blocks do |t| - t.integer :page_id, :null => false - t.string :identifier, :null => false - t.text :content - t.timestamps - end - add_index :cms_blocks, [:page_id, :identifier] - - # -- Snippets ----------------------------------------------------------- - create_table :cms_snippets do |t| - t.integer :site_id, :null => false - t.string :label, :null => false - t.string :identifier, :null => false - t.text :content, text_limit - t.integer :position, :null => false, :default => 0 - t.boolean :is_shared, :null => false, :default => false - t.timestamps - end - add_index :cms_snippets, [:site_id, :identifier], :unique => true - add_index :cms_snippets, [:site_id, :position] - - # -- Files -------------------------------------------------------------- - create_table :cms_files do |t| - t.integer :site_id, :null => false - t.integer :block_id - t.string :label, :null => false - t.string :file_file_name, :null => false - t.string :file_content_type, :null => false - t.integer :file_file_size, :null => false - t.string :description, :limit => 2048 - t.integer :position, :null => false, :default => 0 - t.timestamps - end - add_index :cms_files, [:site_id, :label] - add_index :cms_files, [:site_id, :file_file_name] - add_index :cms_files, [:site_id, :position] - add_index :cms_files, [:site_id, :block_id] - - # -- Revisions ----------------------------------------------------------- - create_table :cms_revisions, :force => true do |t| - t.string :record_type, :null => false - t.integer :record_id, :null => false - t.text :data, text_limit - t.datetime :created_at - end - add_index :cms_revisions, [:record_type, :record_id, :created_at] - - # -- Categories --------------------------------------------------------- - create_table :cms_categories, :force => true do |t| - t.integer :site_id, :null => false - t.string :label, :null => false - t.string :categorized_type, :null => false - end - add_index :cms_categories, [:site_id, :categorized_type, :label], :unique => true - - create_table :cms_categorizations, :force => true do |t| - t.integer :category_id, :null => false - t.string :categorized_type, :null => false - t.integer :categorized_id, :null => false - end - add_index :cms_categorizations, [:category_id, :categorized_type, :categorized_id], :unique => true, - :name => 'index_cms_categorizations_on_cat_id_and_catd_type_and_catd_id' - - - # -- Foreign keys, from 20140402033428_add_foreign_keys.rb - add_foreign_key "cms_blocks", "cms_pages", name: "cms_blocks_page_id_fk", column: "page_id" - add_foreign_key "cms_categories", "cms_sites", name: "cms_categories_site_id_fk", column: "site_id", dependent: :delete - add_foreign_key "cms_categorizations", "cms_categories", name: "cms_categorizations_category_id_fk", column: "category_id" - add_foreign_key "cms_files", "cms_blocks", name: "cms_files_block_id_fk", column: "block_id" - add_foreign_key "cms_files", "cms_sites", name: "cms_files_site_id_fk", column: "site_id" - add_foreign_key "cms_layouts", "cms_layouts", name: "cms_layouts_parent_id_fk", column: "parent_id" - add_foreign_key "cms_layouts", "cms_sites", name: "cms_layouts_site_id_fk", column: "site_id", dependent: :delete - add_foreign_key "cms_pages", "cms_layouts", name: "cms_pages_layout_id_fk", column: "layout_id" - add_foreign_key "cms_pages", "cms_pages", name: "cms_pages_parent_id_fk", column: "parent_id" - add_foreign_key "cms_pages", "cms_sites", name: "cms_pages_site_id_fk", column: "site_id", dependent: :delete - add_foreign_key "cms_pages", "cms_pages", name: "cms_pages_target_page_id_fk", column: "target_page_id" - add_foreign_key "cms_snippets", "cms_sites", name: "cms_snippets_site_id_fk", column: "site_id", dependent: :delete - - end -end diff --git a/db/migrate/20160713003535_add_bill_address_and_ship_address_to_customer.rb b/db/migrate/20160713003535_add_bill_address_and_ship_address_to_customer.rb deleted file mode 100644 index 306276bcc0..0000000000 --- a/db/migrate/20160713003535_add_bill_address_and_ship_address_to_customer.rb +++ /dev/null @@ -1,12 +0,0 @@ -class AddBillAddressAndShipAddressToCustomer < ActiveRecord::Migration - def change - add_column :customers, :bill_address_id, :integer - add_column :customers, :ship_address_id, :integer - - add_index :customers, :bill_address_id - add_index :customers, :ship_address_id - - add_foreign_key :customers, :spree_addresses, column: :bill_address_id - add_foreign_key :customers, :spree_addresses, column: :ship_address_id - end -end diff --git a/db/migrate/20160713013358_add_name_to_customer.rb b/db/migrate/20160713013358_add_name_to_customer.rb deleted file mode 100644 index 832816657e..0000000000 --- a/db/migrate/20160713013358_add_name_to_customer.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddNameToCustomer < ActiveRecord::Migration - def change - add_column :customers, :name, :string - end -end diff --git a/db/migrate/20160819045727_create_standing_orders.rb b/db/migrate/20160819045727_create_standing_orders.rb deleted file mode 100644 index 661bf7411b..0000000000 --- a/db/migrate/20160819045727_create_standing_orders.rb +++ /dev/null @@ -1,25 +0,0 @@ -class CreateStandingOrders < ActiveRecord::Migration - def change - create_table :standing_orders do |t| - t.references :shop, null: false - t.references :customer, null: false - t.references :schedule, null: false - t.references :payment_method, null: false - t.references :shipping_method, null: false - t.datetime :begins_at, :ends_at - t.timestamps - end - - add_index :standing_orders, :shop_id - add_index :standing_orders, :customer_id - add_index :standing_orders, :schedule_id - add_index :standing_orders, :payment_method_id - add_index :standing_orders, :shipping_method_id - - add_foreign_key :standing_orders, :enterprises, name: 'oc_standing_orders_shop_id_fk', column: :shop_id - add_foreign_key :standing_orders, :customers, name: 'oc_standing_orders_customer_id_fk' - add_foreign_key :standing_orders, :schedules, name: 'oc_standing_orders_schedule_id_fk' - add_foreign_key :standing_orders, :spree_payment_methods, name: 'oc_standing_orders_payment_method_id_fk', column: :payment_method_id - add_foreign_key :standing_orders, :spree_shipping_methods, name: 'oc_standing_orders_shipping_method_id_fk', column: :shipping_method_id - end -end diff --git a/db/migrate/20160819065331_swap_calculator_to_flat_percent_per_item.rb b/db/migrate/20160819065331_swap_calculator_to_flat_percent_per_item.rb deleted file mode 100644 index eb8e206e8f..0000000000 --- a/db/migrate/20160819065331_swap_calculator_to_flat_percent_per_item.rb +++ /dev/null @@ -1,29 +0,0 @@ -class SwapCalculatorToFlatPercentPerItem < ActiveRecord::Migration - class Spree::Calculator < ActiveRecord::Base - end - - def up - Spree::Calculator.where(calculable_type: "EnterpriseFee", type: 'Spree::Calculator::FlatPercentItemTotal').each do |c| - swap_calculator_type c, 'Calculator::FlatPercentPerItem' - end - end - - def down - Spree::Calculator.where(calculable_type: "EnterpriseFee", type: 'Spree::Calculator::FlatPercentPerItem').each do |c| - swap_calculator_type c, 'Calculator::FlatPercentItemTotal' - end - end - - - private - - def swap_calculator_type(calculator, to_class) - value = calculator.preferred_flat_percent - - calculator.type = to_class - calculator.save - - calculator = Spree::Calculator.find calculator.id - calculator.preferred_flat_percent = value - end -end diff --git a/db/migrate/20160824013751_create_standing_line_items.rb b/db/migrate/20160824013751_create_standing_line_items.rb deleted file mode 100644 index 90a0d46af3..0000000000 --- a/db/migrate/20160824013751_create_standing_line_items.rb +++ /dev/null @@ -1,16 +0,0 @@ -class CreateStandingLineItems < ActiveRecord::Migration - def change - create_table :standing_line_items do |t| - t.references :standing_order, null: false - t.references :variant, null: false - t.integer :quantity, null: false - t.timestamps - end - - add_index :standing_line_items, :standing_order_id - add_index :standing_line_items, :variant_id - - add_foreign_key :standing_line_items, :standing_orders, name: 'oc_standing_line_items_standing_order_id_fk' - add_foreign_key :standing_line_items, :spree_variants, name: 'oc_standing_line_items_variant_id_fk', column: :variant_id - end -end diff --git a/db/migrate/20160828115018_create_stripe_accounts.rb b/db/migrate/20160828115018_create_stripe_accounts.rb deleted file mode 100644 index 56ab206540..0000000000 --- a/db/migrate/20160828115018_create_stripe_accounts.rb +++ /dev/null @@ -1,12 +0,0 @@ -class CreateStripeAccounts < ActiveRecord::Migration - def change - create_table :stripe_accounts do |t| - t.string :stripe_user_id - t.string :stripe_publishable_key - t.timestamps - t.belongs_to :enterprise - end - - add_index :stripe_accounts, :enterprise_id, unique: true - end -end diff --git a/db/migrate/20160916024535_add_state_to_spree_adjustments.spree.rb b/db/migrate/20160916024535_add_state_to_spree_adjustments.spree.rb deleted file mode 100644 index a4224678df..0000000000 --- a/db/migrate/20160916024535_add_state_to_spree_adjustments.spree.rb +++ /dev/null @@ -1,7 +0,0 @@ -# This migration comes from spree (originally 20121213162028) -class AddStateToSpreeAdjustments < ActiveRecord::Migration - def change - add_column :spree_adjustments, :state, :string - remove_column :spree_adjustments, :locked - end -end diff --git a/db/migrate/20160921060442_add_allow_guest_orders_to_enterprise.rb b/db/migrate/20160921060442_add_allow_guest_orders_to_enterprise.rb deleted file mode 100644 index 7e92c7e74c..0000000000 --- a/db/migrate/20160921060442_add_allow_guest_orders_to_enterprise.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddAllowGuestOrdersToEnterprise < ActiveRecord::Migration - def change - add_column :enterprises, :allow_guest_orders, :boolean, default: true, null: false - end -end diff --git a/db/migrate/20161012022142_add_allow_order_changes_to_enterprise.rb b/db/migrate/20161012022142_add_allow_order_changes_to_enterprise.rb deleted file mode 100644 index 887ce44058..0000000000 --- a/db/migrate/20161012022142_add_allow_order_changes_to_enterprise.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddAllowOrderChangesToEnterprise < ActiveRecord::Migration - def change - add_column :enterprises, :allow_order_changes, :boolean, default: false, null: false - end -end diff --git a/db/migrate/20161014000216_add_ship_and_bill_address_to_standing_orders.rb b/db/migrate/20161014000216_add_ship_and_bill_address_to_standing_orders.rb deleted file mode 100644 index 259227be5f..0000000000 --- a/db/migrate/20161014000216_add_ship_and_bill_address_to_standing_orders.rb +++ /dev/null @@ -1,12 +0,0 @@ -class AddShipAndBillAddressToStandingOrders < ActiveRecord::Migration - def change - add_column :standing_orders, :bill_address_id, :integer, null: false - add_column :standing_orders, :ship_address_id, :integer, null: false - - add_index :standing_orders, :bill_address_id - add_index :standing_orders, :ship_address_id - - add_foreign_key :standing_orders, :spree_addresses, column: :bill_address_id - add_foreign_key :standing_orders, :spree_addresses, column: :ship_address_id - end -end diff --git a/db/migrate/20161020012017_create_standing_order_orders.rb b/db/migrate/20161020012017_create_standing_order_orders.rb deleted file mode 100644 index cbaa0c14cc..0000000000 --- a/db/migrate/20161020012017_create_standing_order_orders.rb +++ /dev/null @@ -1,16 +0,0 @@ -class CreateStandingOrderOrders < ActiveRecord::Migration - def change - create_table :standing_order_orders do |t| - t.references :standing_order, null: false - t.references :order, null: false - t.datetime :cancelled_at - t.timestamps - end - - add_index :standing_order_orders, :standing_order_id - add_index :standing_order_orders, :order_id, unique: true - - add_foreign_key "standing_order_orders", "standing_orders", name: "standing_order_id_fk", column: "standing_order_id" - add_foreign_key "standing_order_orders", "spree_orders", name: "order_id_fk", column: "order_id" - end -end diff --git a/db/migrate/20161110002554_add_standing_orders_placed_at_to_order_cycles.rb b/db/migrate/20161110002554_add_standing_orders_placed_at_to_order_cycles.rb deleted file mode 100644 index 9becae9930..0000000000 --- a/db/migrate/20161110002554_add_standing_orders_placed_at_to_order_cycles.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddStandingOrdersPlacedAtToOrderCycles < ActiveRecord::Migration - def change - add_column :order_cycles, :standing_orders_placed_at, :datetime - end -end diff --git a/db/migrate/20161130001339_add_price_estimate_to_standing_line_items.rb b/db/migrate/20161130001339_add_price_estimate_to_standing_line_items.rb deleted file mode 100644 index 967a24b838..0000000000 --- a/db/migrate/20161130001339_add_price_estimate_to_standing_line_items.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddPriceEstimateToStandingLineItems < ActiveRecord::Migration - def change - add_column :standing_line_items, :price_estimate, :decimal, :precision => 8, :scale => 2 - end -end diff --git a/db/migrate/20161206232009_add_canceled_at_to_standing_orders.rb b/db/migrate/20161206232009_add_canceled_at_to_standing_orders.rb deleted file mode 100644 index f004e28557..0000000000 --- a/db/migrate/20161206232009_add_canceled_at_to_standing_orders.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddCanceledAtToStandingOrders < ActiveRecord::Migration - def change - add_column :standing_orders, :canceled_at, :datetime - end -end diff --git a/db/migrate/20161207040232_rename_standing_order_orders_cancelled_at.rb b/db/migrate/20161207040232_rename_standing_order_orders_cancelled_at.rb deleted file mode 100644 index 6d2c3d0c3f..0000000000 --- a/db/migrate/20161207040232_rename_standing_order_orders_cancelled_at.rb +++ /dev/null @@ -1,7 +0,0 @@ -class RenameStandingOrderOrdersCancelledAt < ActiveRecord::Migration - def change - # No, I'm not illiterate. I just want to maintain consistency with - # existing Spree column names that are spelt using US English - rename_column :standing_order_orders, :cancelled_at, :canceled_at - end -end diff --git a/db/migrate/20161207042153_add_paused_at_to_standing_orders.rb b/db/migrate/20161207042153_add_paused_at_to_standing_orders.rb deleted file mode 100644 index e6e6e95852..0000000000 --- a/db/migrate/20161207042153_add_paused_at_to_standing_orders.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddPausedAtToStandingOrders < ActiveRecord::Migration - def change - add_column :standing_orders, :paused_at, :datetime - end -end diff --git a/db/migrate/20161208233703_add_standing_orders_confirmed_at_to_order_cycles.rb b/db/migrate/20161208233703_add_standing_orders_confirmed_at_to_order_cycles.rb deleted file mode 100644 index 3f4bb3c378..0000000000 --- a/db/migrate/20161208233703_add_standing_orders_confirmed_at_to_order_cycles.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddStandingOrdersConfirmedAtToOrderCycles < ActiveRecord::Migration - def change - add_column :order_cycles, :standing_orders_confirmed_at, :datetime - end -end diff --git a/db/migrate/20161210225156_rename_standing_order_orders_to_proxy_orders.rb b/db/migrate/20161210225156_rename_standing_order_orders_to_proxy_orders.rb deleted file mode 100644 index 964037f823..0000000000 --- a/db/migrate/20161210225156_rename_standing_order_orders_to_proxy_orders.rb +++ /dev/null @@ -1,9 +0,0 @@ -class RenameStandingOrderOrdersToProxyOrders < ActiveRecord::Migration - def change - remove_index :standing_order_orders, :order_id - remove_index :standing_order_orders, :standing_order_id - rename_table :standing_order_orders, :proxy_orders - add_index :proxy_orders, :order_id, unique: true - add_index :proxy_orders, :standing_order_id - end -end diff --git a/db/migrate/20161210235939_add_order_cycle_id_to_proxy_orders.rb b/db/migrate/20161210235939_add_order_cycle_id_to_proxy_orders.rb deleted file mode 100644 index fd18937ea0..0000000000 --- a/db/migrate/20161210235939_add_order_cycle_id_to_proxy_orders.rb +++ /dev/null @@ -1,20 +0,0 @@ -class AddOrderCycleIdToProxyOrders < ActiveRecord::Migration - def up - add_column :proxy_orders, :order_cycle_id, :integer - - ProxyOrder.find_each do |proxy_order| - order_cycle_id = proxy_order.order.order_cycle_id - proxy_order.update_attribute(:order_cycle_id, order_cycle_id) - end - - change_column :proxy_orders, :order_cycle_id, :integer, null: false - add_index :proxy_orders, [:order_cycle_id, :standing_order_id], unique: true - add_foreign_key :proxy_orders, :order_cycles - end - - def down - remove_foreign_key :proxy_orders, :order_cycles - remove_index :proxy_orders, :order_cycle_id - remove_column :proxy_orders, :order_cycle_id - end -end diff --git a/db/migrate/20161211210859_remove_proxy_order_order_not_null_constraint.rb b/db/migrate/20161211210859_remove_proxy_order_order_not_null_constraint.rb deleted file mode 100644 index 726dde623a..0000000000 --- a/db/migrate/20161211210859_remove_proxy_order_order_not_null_constraint.rb +++ /dev/null @@ -1,9 +0,0 @@ -class RemoveProxyOrderOrderNotNullConstraint < ActiveRecord::Migration - def up - change_column :proxy_orders, :order_id, :integer, null: true - end - - def down - change_column :proxy_orders, :order_id, :integer, null: false - end -end diff --git a/db/migrate/20161215032136_add_enable_standing_orders_to_enterprises.rb b/db/migrate/20161215032136_add_enable_standing_orders_to_enterprises.rb deleted file mode 100644 index 3bd4ad13cb..0000000000 --- a/db/migrate/20161215032136_add_enable_standing_orders_to_enterprises.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddEnableStandingOrdersToEnterprises < ActiveRecord::Migration - def change - add_column :enterprises, :enable_standing_orders, :boolean, default: false, null: false - end -end diff --git a/db/migrate/20161215230219_add_invoice_text_and_invoice_logo_to_enterprises.rb b/db/migrate/20161215230219_add_invoice_text_and_invoice_logo_to_enterprises.rb deleted file mode 100644 index d9cfca91ba..0000000000 --- a/db/migrate/20161215230219_add_invoice_text_and_invoice_logo_to_enterprises.rb +++ /dev/null @@ -1,6 +0,0 @@ -class AddInvoiceTextAndInvoiceLogoToEnterprises < ActiveRecord::Migration - def change - add_column :enterprises, :invoice_text, :text - add_column :enterprises, :display_invoice_logo, :boolean, default: false - end -end diff --git a/db/migrate/20161222022340_add_placed_at_and_confirmed_at_to_proxy_orders.rb b/db/migrate/20161222022340_add_placed_at_and_confirmed_at_to_proxy_orders.rb deleted file mode 100644 index daf67b1211..0000000000 --- a/db/migrate/20161222022340_add_placed_at_and_confirmed_at_to_proxy_orders.rb +++ /dev/null @@ -1,6 +0,0 @@ -class AddPlacedAtAndConfirmedAtToProxyOrders < ActiveRecord::Migration - def change - add_column :proxy_orders, :placed_at, :datetime - add_column :proxy_orders, :confirmed_at, :datetime - end -end diff --git a/db/migrate/20170225203658_add_user_id_to_spree_credit_cards.rb b/db/migrate/20170225203658_add_user_id_to_spree_credit_cards.rb deleted file mode 100644 index 29e50e0c1a..0000000000 --- a/db/migrate/20170225203658_add_user_id_to_spree_credit_cards.rb +++ /dev/null @@ -1,8 +0,0 @@ -class AddUserIdToSpreeCreditCards < ActiveRecord::Migration - def change - unless Spree::CreditCard.column_names.include? "user_id" - add_column :spree_credit_cards, :user_id, :integer - add_index :spree_credit_cards, :user_id - end - end -end diff --git a/db/migrate/20170304151129_add_payment_method_to_spree_credit_cards.rb b/db/migrate/20170304151129_add_payment_method_to_spree_credit_cards.rb deleted file mode 100644 index 76c1cab805..0000000000 --- a/db/migrate/20170304151129_add_payment_method_to_spree_credit_cards.rb +++ /dev/null @@ -1,8 +0,0 @@ -class AddPaymentMethodToSpreeCreditCards < ActiveRecord::Migration - def change - unless Spree::CreditCard.column_names.include? "payment_method_id" - add_column :spree_credit_cards, :payment_method_id, :integer - add_index :spree_credit_cards, :payment_method_id - end - end -end diff --git a/db/migrate/20170310231746_add_import_date_to_spree_variants.rb b/db/migrate/20170310231746_add_import_date_to_spree_variants.rb deleted file mode 100644 index d5acbf882e..0000000000 --- a/db/migrate/20170310231746_add_import_date_to_spree_variants.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddImportDateToSpreeVariants < ActiveRecord::Migration - def change - add_column :spree_variants, :import_date, :datetime - end -end diff --git a/db/migrate/20170314132401_add_import_date_to_variant_overrides.rb b/db/migrate/20170314132401_add_import_date_to_variant_overrides.rb deleted file mode 100644 index daef32ec61..0000000000 --- a/db/migrate/20170314132401_add_import_date_to_variant_overrides.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddImportDateToVariantOverrides < ActiveRecord::Migration - def change - add_column :variant_overrides, :import_date, :datetime - end -end diff --git a/db/migrate/20170413074528_rename_payment_methods.spree_paypal_express.rb b/db/migrate/20170413074528_rename_payment_methods.spree_paypal_express.rb deleted file mode 100644 index 2c426824d8..0000000000 --- a/db/migrate/20170413074528_rename_payment_methods.spree_paypal_express.rb +++ /dev/null @@ -1,14 +0,0 @@ -# This migration comes from spree_paypal_express (originally 20140117051315) -class RenamePaymentMethods < ActiveRecord::Migration - def up - execute <<-SQL - update spree_payment_methods set type = 'Spree::Gateway::PayPalExpress' WHERE type = 'Spree::BillingIntegration::PaypalExpress' - SQL - end - - def down - execute <<-SQL - update spree_payment_methods set type = 'Spree::BillingIntegration::PaypalExpress' WHERE type = 'Spree::Gateway::PayPalExpress' - SQL - end -end diff --git a/db/migrate/20170413083148_add_tracking_url_to_spree_shipping_methods.spree.rb b/db/migrate/20170413083148_add_tracking_url_to_spree_shipping_methods.spree.rb deleted file mode 100644 index 28a9807184..0000000000 --- a/db/migrate/20170413083148_add_tracking_url_to_spree_shipping_methods.spree.rb +++ /dev/null @@ -1,6 +0,0 @@ -# This migration comes from spree (originally 20130301205200) -class AddTrackingUrlToSpreeShippingMethods < ActiveRecord::Migration - def change - add_column :spree_shipping_methods, :tracking_url, :string - end -end diff --git a/db/migrate/20170512115519_add_locale_to_spree_users.rb b/db/migrate/20170512115519_add_locale_to_spree_users.rb deleted file mode 100644 index f694bff1f7..0000000000 --- a/db/migrate/20170512115519_add_locale_to_spree_users.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddLocaleToSpreeUsers < ActiveRecord::Migration - def change - add_column :spree_users, :locale, :string, limit: 5 - end -end diff --git a/db/migrate/20170710145821_add_confirmable_to_user.rb b/db/migrate/20170710145821_add_confirmable_to_user.rb deleted file mode 100644 index cd458545e0..0000000000 --- a/db/migrate/20170710145821_add_confirmable_to_user.rb +++ /dev/null @@ -1,16 +0,0 @@ -class AddConfirmableToUser < ActiveRecord::Migration - def up - add_column :spree_users, :confirmation_token, :string - add_column :spree_users, :confirmed_at, :datetime - add_column :spree_users, :confirmation_sent_at, :datetime - add_column :spree_users, :unconfirmed_email, :string - add_index :spree_users, :confirmation_token, :unique => true - - # Set all current users to confirmed - Spree::User.update_all(confirmed_at: Time.zone.now) - end - - def down - remove_columns :spree_users, :confirmation_token, :confirmed_at, :confirmation_sent_at, :unconfirmed_email - end -end diff --git a/db/migrate/20170719125120_remove_confirmable_from_enterprises.rb b/db/migrate/20170719125120_remove_confirmable_from_enterprises.rb deleted file mode 100644 index a4aad51dd4..0000000000 --- a/db/migrate/20170719125120_remove_confirmable_from_enterprises.rb +++ /dev/null @@ -1,16 +0,0 @@ -class RemoveConfirmableFromEnterprises < ActiveRecord::Migration - def up - remove_columns :enterprises, :confirmation_token, :confirmed_at, :confirmation_sent_at, :unconfirmed_email - end - - def down - add_column :enterprises, :confirmation_token, :string - add_column :enterprises, :confirmed_at, :datetime - add_column :enterprises, :confirmation_sent_at, :datetime - add_column :enterprises, :unconfirmed_email, :string - add_index :enterprises, :confirmation_token, :unique => true - - # Existing enterprises are assumed to be confirmed - Enterprise.update_all(:confirmed_at => Time.zone.now) - end -end diff --git a/db/migrate/20170727104900_add_receives_notifications_to_enterprise_roles.rb b/db/migrate/20170727104900_add_receives_notifications_to_enterprise_roles.rb deleted file mode 100644 index 128cc2a554..0000000000 --- a/db/migrate/20170727104900_add_receives_notifications_to_enterprise_roles.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddReceivesNotificationsToEnterpriseRoles < ActiveRecord::Migration - def change - add_column :enterprise_roles, :receives_notifications, :boolean, default: false - end -end diff --git a/db/migrate/20170728140134_remove_email_from_enterprises.rb b/db/migrate/20170728140134_remove_email_from_enterprises.rb deleted file mode 100644 index 01e4fe7f87..0000000000 --- a/db/migrate/20170728140134_remove_email_from_enterprises.rb +++ /dev/null @@ -1,48 +0,0 @@ -class RemoveEmailFromEnterprises < ActiveRecord::Migration - class Enterprise < ActiveRecord::Base; end - class Spree::User < ActiveRecord::Base; end - - class EnterpriseRole < ActiveRecord::Base - belongs_to :user, class_name: 'Spree::User' - belongs_to :enterprise, class_name: 'Enterprise' - end - - def up - Enterprise.reset_column_information - Spree::User.reset_column_information - EnterpriseRole.reset_column_information - - Enterprise.select([:id, :email, :owner_id]).each do |enterprise| - update_enterprise_contact enterprise - end - - remove_column :enterprises, :email - rename_column :enterprises, :contact, :contact_name - end - - def down - Enterprise.reset_column_information - Spree::User.reset_column_information - EnterpriseRole.reset_column_information - - add_column :enterprises, :email, :string - rename_column :enterprises, :contact_name, :contact - - Enterprise.select(:id).each do |e| - manager = EnterpriseRole.find_by_enterprise_id_and_receives_notifications(e.id, true) - user = Spree::User.find(manager.user_id) - e.update_attribute :email, user.email - end - end - - def update_enterprise_contact(enterprise) - contact_user = contact_or_owner(enterprise) - - role = EnterpriseRole.find_or_initialize_by_user_id_and_enterprise_id(contact_user.id, enterprise.id) - role.update_attribute :receives_notifications, true - end - - def contact_or_owner(enterprise) - Spree::User.find_by_email(enterprise.email) || Spree::User.find(enterprise.owner_id) - end -end diff --git a/db/migrate/20170913205345_change_default_value_of_spree_users_enterprise_limit.rb b/db/migrate/20170913205345_change_default_value_of_spree_users_enterprise_limit.rb deleted file mode 100644 index 2db2182d9c..0000000000 --- a/db/migrate/20170913205345_change_default_value_of_spree_users_enterprise_limit.rb +++ /dev/null @@ -1,9 +0,0 @@ -class ChangeDefaultValueOfSpreeUsersEnterpriseLimit < ActiveRecord::Migration - def up - change_column :spree_users, :enterprise_limit, :integer, default: 5 - end - - def down - change_column :spree_users, :enterprise_limit, :integer, default: 1 - end -end diff --git a/db/migrate/20170921065259_update_adjustment_states.spree.rb b/db/migrate/20170921065259_update_adjustment_states.spree.rb deleted file mode 100644 index 9040709751..0000000000 --- a/db/migrate/20170921065259_update_adjustment_states.spree.rb +++ /dev/null @@ -1,17 +0,0 @@ -# This migration comes from spree (originally 20130417120035) -class UpdateAdjustmentStates < ActiveRecord::Migration - def up - Spree::Order.complete.find_each do |order| - order.adjustments.update_all(:state => 'closed') - end - - Spree::Shipment.shipped.includes(:adjustment).find_each do |shipment| - shipment.adjustment.update_column(:state, 'finalized') if shipment.adjustment - end - - Spree::Adjustment.where(:state => nil).update_all(:state => 'open') - end - - def down - end -end diff --git a/db/migrate/20171027005930_add_credit_card_to_standing_orders.rb b/db/migrate/20171027005930_add_credit_card_to_standing_orders.rb deleted file mode 100644 index 60e5133a72..0000000000 --- a/db/migrate/20171027005930_add_credit_card_to_standing_orders.rb +++ /dev/null @@ -1,7 +0,0 @@ -class AddCreditCardToStandingOrders < ActiveRecord::Migration - def change - add_column :standing_orders, :credit_card_id, :integer - add_index :standing_orders, :credit_card_id - add_foreign_key :standing_orders, :spree_credit_cards, name: :standing_orders_credit_card_id_fk, column: :credit_card_id - end -end diff --git a/db/migrate/20180202024104_rename_standing_orders_to_subscriptions.rb b/db/migrate/20180202024104_rename_standing_orders_to_subscriptions.rb deleted file mode 100644 index 91c90d90b5..0000000000 --- a/db/migrate/20180202024104_rename_standing_orders_to_subscriptions.rb +++ /dev/null @@ -1,99 +0,0 @@ -class RenameStandingOrdersToSubscriptions < ActiveRecord::Migration - def up - remove_foreign_key :proxy_orders, name: :standing_order_id_fk - remove_foreign_key :standing_line_items, name: :oc_standing_line_items_standing_order_id_fk - - remove_foreign_key :standing_orders, name: :oc_standing_orders_customer_id_fk - remove_foreign_key :standing_orders, name: :oc_standing_orders_shop_id_fk - remove_foreign_key :standing_orders, name: :oc_standing_orders_schedule_id_fk - remove_foreign_key :standing_orders, name: :standing_orders_bill_address_id_fk - remove_foreign_key :standing_orders, name: :standing_orders_ship_address_id_fk - remove_foreign_key :standing_orders, name: :standing_orders_credit_card_id_fk - remove_foreign_key :standing_orders, name: :oc_standing_orders_payment_method_id_fk - remove_foreign_key :standing_orders, name: :oc_standing_orders_shipping_method_id_fk - - remove_index :proxy_orders, :column => [:order_cycle_id, :standing_order_id] - remove_index :proxy_orders, :column => [:standing_order_id] - remove_index :standing_line_items, :column => [:standing_order_id] - - rename_table :standing_orders, :subscriptions - - rename_index :subscriptions, :index_standing_orders_on_bill_address_id, :index_subscriptions_on_bill_address_id - rename_index :subscriptions, :index_standing_orders_on_credit_card_id, :index_subscriptions_on_credit_card_id - rename_index :subscriptions, :index_standing_orders_on_customer_id, :index_subscriptions_on_customer_id - rename_index :subscriptions, :index_standing_orders_on_payment_method_id, :index_subscriptions_on_payment_method_id - rename_index :subscriptions, :index_standing_orders_on_schedule_id, :index_subscriptions_on_schedule_id - rename_index :subscriptions, :index_standing_orders_on_ship_address_id, :index_subscriptions_on_ship_address_id - rename_index :subscriptions, :index_standing_orders_on_shipping_method_id, :index_subscriptions_on_shipping_method_id - rename_index :subscriptions, :index_standing_orders_on_shop_id, :index_subscriptions_on_shop_id - - rename_column :enterprises, :enable_standing_orders, :enable_subscriptions - rename_column :proxy_orders, :standing_order_id, :subscription_id - rename_column :standing_line_items, :standing_order_id, :subscription_id - - add_index :proxy_orders, [:order_cycle_id, :subscription_id], unique: true - add_index :proxy_orders, :subscription_id - add_index :standing_line_items, :subscription_id - - add_foreign_key :proxy_orders, :subscriptions, name: :proxy_orders_subscription_id_fk - add_foreign_key :standing_line_items, :subscriptions, name: :standing_line_items_subscription_id_fk - - add_foreign_key :subscriptions, :customers, name: :subscriptions_customer_id_fk - add_foreign_key :subscriptions, :enterprises, name: :subscriptions_shop_id_fk, column: :shop_id - add_foreign_key :subscriptions, :schedules, name: :subscriptions_schedule_id_fk - add_foreign_key :subscriptions, :spree_addresses, name: :subscriptions_bill_address_id_fk, column: :bill_address_id - add_foreign_key :subscriptions, :spree_addresses, name: :subscriptions_ship_address_id_fk, column: :ship_address_id - add_foreign_key :subscriptions, :spree_credit_cards, name: :subscriptions_credit_card_id_fk, column: :credit_card_id - add_foreign_key :subscriptions, :spree_payment_methods, name: :subscriptions_payment_method_id_fk, column: :payment_method_id - add_foreign_key :subscriptions, :spree_shipping_methods, name: :subscriptions_shipping_method_id_fk, column: :shipping_method_id - end - - def down - remove_foreign_key :proxy_orders, name: :proxy_orders_subscription_id_fk - remove_foreign_key :standing_line_items, name: :standing_line_items_subscription_id_fk - - remove_foreign_key :subscriptions, name: :subscriptions_customer_id_fk - remove_foreign_key :subscriptions, name: :subscriptions_shop_id_fk - remove_foreign_key :subscriptions, name: :subscriptions_schedule_id_fk - remove_foreign_key :subscriptions, name: :subscriptions_bill_address_id_fk - remove_foreign_key :subscriptions, name: :subscriptions_ship_address_id_fk - remove_foreign_key :subscriptions, name: :subscriptions_credit_card_id_fk - remove_foreign_key :subscriptions, name: :subscriptions_payment_method_id_fk - remove_foreign_key :subscriptions, name: :subscriptions_shipping_method_id_fk - - remove_index :proxy_orders, :column => [:order_cycle_id, :subscription_id] - remove_index :proxy_orders, :column => [:subscription_id] - remove_index :standing_line_items, :column => [:subscription_id] - - rename_table :subscriptions, :standing_orders - - rename_index :standing_orders, :index_subscriptions_on_bill_address_id, :index_standing_orders_on_bill_address_id - rename_index :standing_orders, :index_subscriptions_on_credit_card_id, :index_standing_orders_on_credit_card_id - rename_index :standing_orders, :index_subscriptions_on_customer_id, :index_standing_orders_on_customer_id - rename_index :standing_orders, :index_subscriptions_on_payment_method_id, :index_standing_orders_on_payment_method_id - rename_index :standing_orders, :index_subscriptions_on_schedule_id, :index_standing_orders_on_schedule_id - rename_index :standing_orders, :index_subscriptions_on_ship_address_id, :index_standing_orders_on_ship_address_id - rename_index :standing_orders, :index_subscriptions_on_shipping_method_id, :index_standing_orders_on_shipping_method_id - rename_index :standing_orders, :index_subscriptions_on_shop_id, :index_standing_orders_on_shop_id - - rename_column :enterprises, :enable_subscriptions, :enable_standing_orders - rename_column :proxy_orders, :subscription_id, :standing_order_id - rename_column :standing_line_items, :subscription_id, :standing_order_id - - add_index :proxy_orders, [:order_cycle_id, :standing_order_id], unique: true - add_index :proxy_orders, :standing_order_id - add_index :standing_line_items, :standing_order_id - - add_foreign_key :proxy_orders, :standing_orders, name: :standing_order_id_fk - add_foreign_key :standing_line_items, :standing_orders, name: :oc_standing_line_items_standing_order_id_fk - - add_foreign_key :standing_orders, :customers, name: :oc_standing_orders_customer_id_fk - add_foreign_key :standing_orders, :enterprises, name: :oc_standing_orders_shop_id_fk, column: :shop_id - add_foreign_key :standing_orders, :schedules, name: :oc_standing_orders_schedule_id_fk - add_foreign_key :standing_orders, :spree_addresses, name: :standing_orders_bill_address_id_fk, column: :bill_address_id - add_foreign_key :standing_orders, :spree_addresses, name: :standing_orders_ship_address_id_fk, column: :ship_address_id - add_foreign_key :standing_orders, :spree_credit_cards, name: :standing_orders_credit_card_id_fk, column: :credit_card_id - add_foreign_key :standing_orders, :spree_payment_methods, name: :oc_standing_orders_payment_method_id_fk, column: :payment_method_id - add_foreign_key :standing_orders, :spree_shipping_methods, name: :oc_standing_orders_shipping_method_id_fk, column: :shipping_method_id - end -end diff --git a/db/migrate/20180204235108_rename_standing_line_items_to_subscription_line_items.rb b/db/migrate/20180204235108_rename_standing_line_items_to_subscription_line_items.rb deleted file mode 100644 index eda85f905b..0000000000 --- a/db/migrate/20180204235108_rename_standing_line_items_to_subscription_line_items.rb +++ /dev/null @@ -1,27 +0,0 @@ -class RenameStandingLineItemsToSubscriptionLineItems < ActiveRecord::Migration - def up - remove_foreign_key :standing_line_items, name: :oc_standing_line_items_variant_id_fk - remove_foreign_key :standing_line_items, name: :standing_line_items_subscription_id_fk - - rename_table :standing_line_items, :subscription_line_items - - rename_index :subscription_line_items, :index_standing_line_items_on_subscription_id, :index_subscription_line_items_on_subscription_id - rename_index :subscription_line_items, :index_standing_line_items_on_variant_id, :index_subscription_line_items_on_variant_id - - add_foreign_key :subscription_line_items, :spree_variants, name: :subscription_line_items_variant_id_fk, column: :variant_id - add_foreign_key :subscription_line_items, :subscriptions, name: :subscription_line_items_subscription_id_fk - end - - def down - remove_foreign_key :subscription_line_items, name: :subscription_line_items_variant_id_fk - remove_foreign_key :subscription_line_items, name: :subscription_line_items_subscription_id_fk - - rename_table :subscription_line_items, :standing_line_items - - rename_index :standing_line_items, :index_subscription_line_items_on_subscription_id, :index_standing_line_items_on_subscription_id - rename_index :standing_line_items, :index_subscription_line_items_on_variant_id, :index_standing_line_items_on_variant_id - - add_foreign_key :standing_line_items, :spree_variants, name: :oc_standing_line_items_variant_id_fk, column: :variant_id - add_foreign_key :standing_line_items, :subscriptions, name: :standing_line_items_subscription_id_fk - end -end diff --git a/db/migrate/20180222231639_add_shipping_fee_estimate_and_payment_fee_estimate_to_subscription.rb b/db/migrate/20180222231639_add_shipping_fee_estimate_and_payment_fee_estimate_to_subscription.rb deleted file mode 100644 index 2c4f29d891..0000000000 --- a/db/migrate/20180222231639_add_shipping_fee_estimate_and_payment_fee_estimate_to_subscription.rb +++ /dev/null @@ -1,6 +0,0 @@ -class AddShippingFeeEstimateAndPaymentFeeEstimateToSubscription < ActiveRecord::Migration - def change - add_column :subscriptions, :shipping_fee_estimate, :decimal, :precision => 8, :scale => 2 - add_column :subscriptions, :payment_fee_estimate, :decimal, :precision => 8, :scale => 2 - end -end diff --git a/db/migrate/20180316034336_remove_placed_at_and_confirmed_at_from_order_cycles.rb b/db/migrate/20180316034336_remove_placed_at_and_confirmed_at_from_order_cycles.rb deleted file mode 100644 index b41d698eb3..0000000000 --- a/db/migrate/20180316034336_remove_placed_at_and_confirmed_at_from_order_cycles.rb +++ /dev/null @@ -1,11 +0,0 @@ -class RemovePlacedAtAndConfirmedAtFromOrderCycles < ActiveRecord::Migration - def up - remove_column :order_cycles, :standing_orders_placed_at - remove_column :order_cycles, :standing_orders_confirmed_at - end - - def down - add_column :order_cycles, :standing_orders_placed_at, :datetime - add_column :order_cycles, :standing_orders_confirmed_at, :datetime - end -end diff --git a/db/migrate/20180406045821_add_charges_allowed_to_customers.rb b/db/migrate/20180406045821_add_charges_allowed_to_customers.rb deleted file mode 100644 index 4503dc87b6..0000000000 --- a/db/migrate/20180406045821_add_charges_allowed_to_customers.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddChargesAllowedToCustomers < ActiveRecord::Migration - def change - add_column :customers, :allow_charges, :boolean, default: false, null: false - end -end diff --git a/db/migrate/20180418025217_add_is_default_to_credit_card.rb b/db/migrate/20180418025217_add_is_default_to_credit_card.rb deleted file mode 100644 index c39b3e44dc..0000000000 --- a/db/migrate/20180418025217_add_is_default_to_credit_card.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddIsDefaultToCreditCard < ActiveRecord::Migration - def change - add_column :spree_credit_cards, :is_default, :boolean, default: false - end -end diff --git a/db/migrate/20180426145630_create_spree_stock_items.spree.rb b/db/migrate/20180426145630_create_spree_stock_items.spree.rb deleted file mode 100644 index cd6f349740..0000000000 --- a/db/migrate/20180426145630_create_spree_stock_items.spree.rb +++ /dev/null @@ -1,15 +0,0 @@ -# This migration comes from spree (originally 20130211190146) -class CreateSpreeStockItems < ActiveRecord::Migration - def change - create_table :spree_stock_items do |t| - t.belongs_to :stock_location - t.belongs_to :variant - t.integer :count_on_hand, null: false, default: 0 - t.integer :lock_version - - t.timestamps - end - add_index :spree_stock_items, :stock_location_id - add_index :spree_stock_items, [:stock_location_id, :variant_id], :name => 'stock_item_by_loc_and_var_id' - end -end diff --git a/db/migrate/20180426145631_create_spree_stock_locations.spree.rb b/db/migrate/20180426145631_create_spree_stock_locations.spree.rb deleted file mode 100644 index a3e4d1a4dc..0000000000 --- a/db/migrate/20180426145631_create_spree_stock_locations.spree.rb +++ /dev/null @@ -1,12 +0,0 @@ -# This migration comes from spree (originally 20130211191120) -class CreateSpreeStockLocations < ActiveRecord::Migration - def change - create_table :spree_stock_locations do |t| - t.string :name - t.belongs_to :address - - t.timestamps - end - add_index :spree_stock_locations, :address_id - end -end diff --git a/db/migrate/20180426145632_create_default_stock.spree.rb b/db/migrate/20180426145632_create_default_stock.spree.rb deleted file mode 100644 index 7e1d188e4a..0000000000 --- a/db/migrate/20180426145632_create_default_stock.spree.rb +++ /dev/null @@ -1,34 +0,0 @@ -Spree::Stock::Quantifier.class_eval do - def initialize(variant) - @variant = variant - @stock_items = Spree::StockItem.joins(:stock_location).where(:variant_id => @variant) - end -end - -# This migration comes from spree (originally 20130213191427) -class CreateDefaultStock < ActiveRecord::Migration - def up - Spree::StockLocation.skip_callback(:create, :after, :create_stock_items) - Spree::StockItem.skip_callback(:save, :after, :process_backorders) - location = Spree::StockLocation.create(name: 'default') - Spree::Variant.all.each do |variant| - stock_item = location.stock_items.build(variant: variant) - stock_item.send(:count_on_hand=, variant.count_on_hand) - stock_item.save! - end - - remove_column :spree_variants, :count_on_hand - end - - def down - add_column :spree_variants, :count_on_hand, :integer - - Spree::StockItem.all.each do |stock_item| - stock_item.variant.update_column :count_on_hand, stock_item.count_on_hand - end - - Spree::StockLocation.delete_all - Spree::StockItem.delete_all - end -end - diff --git a/db/migrate/20180426145633_add_stock_location_id_to_spree_shipments.spree.rb b/db/migrate/20180426145633_add_stock_location_id_to_spree_shipments.spree.rb deleted file mode 100644 index e102d7febb..0000000000 --- a/db/migrate/20180426145633_add_stock_location_id_to_spree_shipments.spree.rb +++ /dev/null @@ -1,6 +0,0 @@ -# This migration comes from spree (originally 20130226191231) -class AddStockLocationIdToSpreeShipments < ActiveRecord::Migration - def change - add_column :spree_shipments, :stock_location_id, :integer - end -end diff --git a/db/migrate/20180426145634_add_pending_to_inventory_unit.spree.rb b/db/migrate/20180426145634_add_pending_to_inventory_unit.spree.rb deleted file mode 100644 index c3879d3604..0000000000 --- a/db/migrate/20180426145634_add_pending_to_inventory_unit.spree.rb +++ /dev/null @@ -1,7 +0,0 @@ -# This migration comes from spree (originally 20130227143905) -class AddPendingToInventoryUnit < ActiveRecord::Migration - def change - add_column :spree_inventory_units, :pending, :boolean, :default => true - Spree::InventoryUnit.update_all(:pending => false) - end -end diff --git a/db/migrate/20180426145635_remove_on_demand_from_product_and_variant.spree.rb b/db/migrate/20180426145635_remove_on_demand_from_product_and_variant.spree.rb deleted file mode 100644 index 0732d4ffd0..0000000000 --- a/db/migrate/20180426145635_remove_on_demand_from_product_and_variant.spree.rb +++ /dev/null @@ -1,7 +0,0 @@ -# This migration comes from spree (originally 20130228164411) -class RemoveOnDemandFromProductAndVariant < ActiveRecord::Migration - def change - remove_column :spree_products, :on_demand - # we are removing spree_variants.on_demand in a later migration - end -end diff --git a/db/migrate/20180426145636_create_shipping_method_zone.spree.rb b/db/migrate/20180426145636_create_shipping_method_zone.spree.rb deleted file mode 100644 index 2d99447b13..0000000000 --- a/db/migrate/20180426145636_create_shipping_method_zone.spree.rb +++ /dev/null @@ -1,23 +0,0 @@ -# This migration comes from spree (originally 20130228210442) -class CreateShippingMethodZone < ActiveRecord::Migration - def up - create_table :shipping_methods_zones, :id => false do |t| - t.integer :shipping_method_id - t.integer :zone_id - end - # This association has been corrected in a latter migration - # but when this database migration runs, the table is still incorrectly named - # 'shipping_methods_zones' instead of 'spre_shipping_methods_zones' - Spree::ShippingMethod.has_and_belongs_to_many :zones, :join_table => 'shipping_methods_zones', - :class_name => 'Spree::Zone', - :foreign_key => 'shipping_method_id' - Spree::ShippingMethod.all.each{|sm| sm.zones << Spree::Zone.find(sm.zone_id)} - - remove_column :spree_shipping_methods, :zone_id - end - - def down - drop_table :shipping_methods_zones - add_column :spree_shipping_methods, :zone_id, :integer - end -end diff --git a/db/migrate/20180426145637_remove_shipping_category_id_from_shipping_method.spree.rb b/db/migrate/20180426145637_remove_shipping_category_id_from_shipping_method.spree.rb deleted file mode 100644 index f686ac4aa7..0000000000 --- a/db/migrate/20180426145637_remove_shipping_category_id_from_shipping_method.spree.rb +++ /dev/null @@ -1,6 +0,0 @@ -# This migration comes from spree (originally 20130301162745) -class RemoveShippingCategoryIdFromShippingMethod < ActiveRecord::Migration - def change - remove_column :spree_shipping_methods, :shipping_category_id - end -end diff --git a/db/migrate/20180426145638_create_shipping_method_categories.spree.rb b/db/migrate/20180426145638_create_shipping_method_categories.spree.rb deleted file mode 100644 index 2af03a7ec0..0000000000 --- a/db/migrate/20180426145638_create_shipping_method_categories.spree.rb +++ /dev/null @@ -1,14 +0,0 @@ -# This migration comes from spree (originally 20130301162924) -class CreateShippingMethodCategories < ActiveRecord::Migration - def change - create_table :spree_shipping_method_categories do |t| - t.integer :shipping_method_id, :null => false - t.integer :shipping_category_id, :null => false - - t.timestamps - end - - add_index :spree_shipping_method_categories, :shipping_method_id - add_index :spree_shipping_method_categories, :shipping_category_id - end -end diff --git a/db/migrate/20180426145639_create_spree_shipping_rates.spree.rb b/db/migrate/20180426145639_create_spree_shipping_rates.spree.rb deleted file mode 100644 index f2932a57b3..0000000000 --- a/db/migrate/20180426145639_create_spree_shipping_rates.spree.rb +++ /dev/null @@ -1,25 +0,0 @@ -# This migration comes from spree (originally 20130304162240) -class CreateSpreeShippingRates < ActiveRecord::Migration - def up - create_table :spree_shipping_rates do |t| - t.belongs_to :shipment - t.belongs_to :shipping_method - t.boolean :selected, :default => false - t.decimal :cost, :precision => 8, :scale => 2 - t.timestamps - end - add_index(:spree_shipping_rates, [:shipment_id, :shipping_method_id], - :name => 'spree_shipping_rates_join_index', - :unique => true) - - # Spree::Shipment.all.each do |shipment| - # shipping_method = Spree::ShippingMethod.find(shipment.shipment_method_id) - # shipment.add_shipping_method(shipping_method, true) - # end - end - - def down - # add_column :spree_shipments, :shipping_method_id, :integer - drop_table :spree_shipping_rates - end -end diff --git a/db/migrate/20180426145640_remove_category_match_attributes_from_shipping_method.spree.rb b/db/migrate/20180426145640_remove_category_match_attributes_from_shipping_method.spree.rb deleted file mode 100644 index 1562aecdb2..0000000000 --- a/db/migrate/20180426145640_remove_category_match_attributes_from_shipping_method.spree.rb +++ /dev/null @@ -1,8 +0,0 @@ -# This migration comes from spree (originally 20130304192936) -class RemoveCategoryMatchAttributesFromShippingMethod < ActiveRecord::Migration - def change - remove_column :spree_shipping_methods, :match_none - remove_column :spree_shipping_methods, :match_one - remove_column :spree_shipping_methods, :match_all - end -end diff --git a/db/migrate/20180426145641_create_stock_movements.spree.rb b/db/migrate/20180426145641_create_stock_movements.spree.rb deleted file mode 100644 index d7c8cb88d3..0000000000 --- a/db/migrate/20180426145641_create_stock_movements.spree.rb +++ /dev/null @@ -1,13 +0,0 @@ -# This migration comes from spree (originally 20130305143310) -class CreateStockMovements < ActiveRecord::Migration - def change - create_table :spree_stock_movements do |t| - t.belongs_to :stock_item - t.integer :quantity - t.string :action - - t.timestamps - end - add_index :spree_stock_movements, :stock_item_id - end -end diff --git a/db/migrate/20180426145642_add_address_fields_to_stock_location.spree.rb b/db/migrate/20180426145642_add_address_fields_to_stock_location.spree.rb deleted file mode 100644 index 4a16efeb40..0000000000 --- a/db/migrate/20180426145642_add_address_fields_to_stock_location.spree.rb +++ /dev/null @@ -1,23 +0,0 @@ -# This migration comes from spree (originally 20130306181701) -class AddAddressFieldsToStockLocation < ActiveRecord::Migration - def change - remove_column :spree_stock_locations, :address_id - - add_column :spree_stock_locations, :address1, :string - add_column :spree_stock_locations, :address2, :string - add_column :spree_stock_locations, :city, :string - add_column :spree_stock_locations, :state_id, :integer - add_column :spree_stock_locations, :state_name, :string - add_column :spree_stock_locations, :country_id, :integer - add_column :spree_stock_locations, :zipcode, :string - add_column :spree_stock_locations, :phone, :string - - - usa = Spree::Country.where(:iso => 'US').first - # In case USA isn't found. - # See #3115 - country = usa || Spree::Country.first - Spree::Country.reset_column_information - Spree::StockLocation.update_all(:country_id => country) - end -end diff --git a/db/migrate/20180426145643_add_active_field_to_stock_locations.spree.rb b/db/migrate/20180426145643_add_active_field_to_stock_locations.spree.rb deleted file mode 100644 index 0e69642de2..0000000000 --- a/db/migrate/20180426145643_add_active_field_to_stock_locations.spree.rb +++ /dev/null @@ -1,6 +0,0 @@ -# This migration comes from spree (originally 20130306191917) -class AddActiveFieldToStockLocations < ActiveRecord::Migration - def change - add_column :spree_stock_locations, :active, :boolean, :default => true - end -end diff --git a/db/migrate/20180426145644_add_backorderable_to_stock_item.spree.rb b/db/migrate/20180426145644_add_backorderable_to_stock_item.spree.rb deleted file mode 100644 index 839e3b3d09..0000000000 --- a/db/migrate/20180426145644_add_backorderable_to_stock_item.spree.rb +++ /dev/null @@ -1,6 +0,0 @@ -# This migration comes from spree (originally 20130306195650) -class AddBackorderableToStockItem < ActiveRecord::Migration - def change - add_column :spree_stock_items, :backorderable, :boolean, :default => true - end -end diff --git a/db/migrate/20180426145645_add_default_quantity_to_stock_movement.spree.rb b/db/migrate/20180426145645_add_default_quantity_to_stock_movement.spree.rb deleted file mode 100644 index c991b94e4a..0000000000 --- a/db/migrate/20180426145645_add_default_quantity_to_stock_movement.spree.rb +++ /dev/null @@ -1,6 +0,0 @@ -# This migration comes from spree (originally 20130307161754) -class AddDefaultQuantityToStockMovement < ActiveRecord::Migration - def change - change_column :spree_stock_movements, :quantity, :integer, :default => 0 - end -end diff --git a/db/migrate/20180426145646_add_source_and_destination_to_stock_movements.spree.rb b/db/migrate/20180426145646_add_source_and_destination_to_stock_movements.spree.rb deleted file mode 100644 index 7e0f0987b7..0000000000 --- a/db/migrate/20180426145646_add_source_and_destination_to_stock_movements.spree.rb +++ /dev/null @@ -1,9 +0,0 @@ -# This migration comes from spree (originally 20130318151756) -class AddSourceAndDestinationToStockMovements < ActiveRecord::Migration - def change - change_table :spree_stock_movements do |t| - t.references :source, polymorphic: true - t.references :destination, polymorphic: true - end - end -end diff --git a/db/migrate/20180426145647_add_originator_to_stock_movement.spree.rb b/db/migrate/20180426145647_add_originator_to_stock_movement.spree.rb deleted file mode 100644 index 7c1a74679a..0000000000 --- a/db/migrate/20180426145647_add_originator_to_stock_movement.spree.rb +++ /dev/null @@ -1,8 +0,0 @@ -# This migration comes from spree (originally 20130319183250) -class AddOriginatorToStockMovement < ActiveRecord::Migration - def change - change_table :spree_stock_movements do |t| - t.references :originator, polymorphic: true - end - end -end diff --git a/db/migrate/20180426145648_drop_source_and_destination_from_stock_movement.spree.rb b/db/migrate/20180426145648_drop_source_and_destination_from_stock_movement.spree.rb deleted file mode 100644 index 6735614f4e..0000000000 --- a/db/migrate/20180426145648_drop_source_and_destination_from_stock_movement.spree.rb +++ /dev/null @@ -1,16 +0,0 @@ -# This migration comes from spree (originally 20130319190507) -class DropSourceAndDestinationFromStockMovement < ActiveRecord::Migration - def up - change_table :spree_stock_movements do |t| - t.remove_references :source, :polymorphic => true - t.remove_references :destination, :polymorphic => true - end - end - - def down - change_table :spree_stock_movements do |t| - t.references :source, polymorphic: true - t.references :destination, polymorphic: true - end - end -end diff --git a/db/migrate/20180426145649_migrate_inventory_unit_sold_to_on_hand.spree.rb b/db/migrate/20180426145649_migrate_inventory_unit_sold_to_on_hand.spree.rb deleted file mode 100644 index 4f759427ee..0000000000 --- a/db/migrate/20180426145649_migrate_inventory_unit_sold_to_on_hand.spree.rb +++ /dev/null @@ -1,10 +0,0 @@ -# This migration comes from spree (originally 20130325163316) -class MigrateInventoryUnitSoldToOnHand < ActiveRecord::Migration - def up - Spree::InventoryUnit.where(:state => 'sold').update_all(:state => 'on_hand') - end - - def down - Spree::InventoryUnit.where(:state => 'on_hand').update_all(:state => 'sold') - end -end diff --git a/db/migrate/20180426145650_add_stock_location_to_rma.spree.rb b/db/migrate/20180426145650_add_stock_location_to_rma.spree.rb deleted file mode 100644 index 54d85f76a4..0000000000 --- a/db/migrate/20180426145650_add_stock_location_to_rma.spree.rb +++ /dev/null @@ -1,6 +0,0 @@ -# This migration comes from spree (originally 20130326175857) -class AddStockLocationToRma < ActiveRecord::Migration - def change - add_column :spree_return_authorizations, :stock_location_id, :integer - end -end diff --git a/db/migrate/20180426145651_update_shipment_state_for_canceled_orders.spree.rb b/db/migrate/20180426145651_update_shipment_state_for_canceled_orders.spree.rb deleted file mode 100644 index f5c1b5a0cf..0000000000 --- a/db/migrate/20180426145651_update_shipment_state_for_canceled_orders.spree.rb +++ /dev/null @@ -1,16 +0,0 @@ -# This migration comes from spree (originally 20130328130308) -class UpdateShipmentStateForCanceledOrders < ActiveRecord::Migration - def up - shipments = Spree::Shipment.joins(:order). - where("spree_orders.state = 'canceled'") - case Spree::Shipment.connection.adapter_name - when "SQLite3" - shipments.update_all("state = 'cancelled'") - when "MySQL" || "PostgreSQL" - shipments.update_all("spree_shipments.state = 'cancelled'") - end - end - - def down - end -end diff --git a/db/migrate/20180426145652_remove_stock_item_and_variant_lock.spree.rb b/db/migrate/20180426145652_remove_stock_item_and_variant_lock.spree.rb deleted file mode 100644 index c522a765cc..0000000000 --- a/db/migrate/20180426145652_remove_stock_item_and_variant_lock.spree.rb +++ /dev/null @@ -1,15 +0,0 @@ -# This migration comes from spree (originally 20130329134939) -class RemoveStockItemAndVariantLock < ActiveRecord::Migration - def up - # we are moving to pessimistic locking on stock_items - remove_column :spree_stock_items, :lock_version - - # variants no longer manage their count_on_hand so we are removing their lock - remove_column :spree_variants, :lock_version - end - - def down - add_column :spree_stock_items, :lock_version, :integer - add_column :spree_variants, :lock_version, :integer - end -end diff --git a/db/migrate/20180426145653_add_shipping_rates_to_shipments.spree.rb b/db/migrate/20180426145653_add_shipping_rates_to_shipments.spree.rb deleted file mode 100644 index 67c24f568d..0000000000 --- a/db/migrate/20180426145653_add_shipping_rates_to_shipments.spree.rb +++ /dev/null @@ -1,16 +0,0 @@ -# This migration comes from spree (originally 20130417123427) -class AddShippingRatesToShipments < ActiveRecord::Migration - def up - Spree::Shipment.all.each do |shipment| - shipment.shipping_rates.create!(:shipping_method_id => shipment.shipping_method_id, - :cost => shipment.cost, - :selected => true) - end - - remove_column :spree_shipments, :shipping_method_id - end - - def down - add_column :spree_shipments, :shipping_method_id, :integer - end -end diff --git a/db/migrate/20180426145654_create_spree_stock_transfers.spree.rb b/db/migrate/20180426145654_create_spree_stock_transfers.spree.rb deleted file mode 100644 index 1b73d9b176..0000000000 --- a/db/migrate/20180426145654_create_spree_stock_transfers.spree.rb +++ /dev/null @@ -1,15 +0,0 @@ -# This migration comes from spree (originally 20130418125341) -class CreateSpreeStockTransfers < ActiveRecord::Migration - def change - create_table :spree_stock_transfers do |t| - t.string :type - t.string :reference_number - t.integer :source_location_id - t.integer :destination_location_id - t.timestamps - end - - add_index :spree_stock_transfers, :source_location_id - add_index :spree_stock_transfers, :destination_location_id - end -end diff --git a/db/migrate/20180426145655_drop_products_count_on_hand.spree.rb b/db/migrate/20180426145655_drop_products_count_on_hand.spree.rb deleted file mode 100644 index 29cb947a56..0000000000 --- a/db/migrate/20180426145655_drop_products_count_on_hand.spree.rb +++ /dev/null @@ -1,6 +0,0 @@ -# This migration comes from spree (originally 20130423110707) -class DropProductsCountOnHand < ActiveRecord::Migration - def up - remove_column :spree_products, :count_on_hand - end -end diff --git a/db/migrate/20180426145656_set_default_shipping_rate_cost.spree.rb b/db/migrate/20180426145656_set_default_shipping_rate_cost.spree.rb deleted file mode 100644 index 64b9ccb108..0000000000 --- a/db/migrate/20180426145656_set_default_shipping_rate_cost.spree.rb +++ /dev/null @@ -1,6 +0,0 @@ -# This migration comes from spree (originally 20130423223847) -class SetDefaultShippingRateCost < ActiveRecord::Migration - def change - change_column :spree_shipping_rates, :cost, :decimal, default: 0, precision: 8, scale: 2 - end -end diff --git a/db/migrate/20180426145657_add_number_to_stock_transfer.spree.rb b/db/migrate/20180426145657_add_number_to_stock_transfer.spree.rb deleted file mode 100644 index cf06743da0..0000000000 --- a/db/migrate/20180426145657_add_number_to_stock_transfer.spree.rb +++ /dev/null @@ -1,24 +0,0 @@ -# This migration comes from spree (originally 20130509115210) -class AddNumberToStockTransfer < ActiveRecord::Migration - def up - remove_index :spree_stock_transfers, :source_location_id - remove_index :spree_stock_transfers, :destination_location_id - - rename_column :spree_stock_transfers, :reference_number, :reference - add_column :spree_stock_transfers, :number, :string - - Spree::StockTransfer.all.each do |transfer| - transfer.send(:generate_stock_transfer_number) - transfer.save! - end - - add_index :spree_stock_transfers, :number - add_index :spree_stock_transfers, :source_location_id - add_index :spree_stock_transfers, :destination_location_id - end - - def down - rename_column :spree_stock_transfers, :reference, :reference_number - remove_column :spree_stock_transfers, :number, :string - end -end diff --git a/db/migrate/20180426145658_add_sku_index_to_spree_variants.spree.rb b/db/migrate/20180426145658_add_sku_index_to_spree_variants.spree.rb deleted file mode 100644 index cd089f846d..0000000000 --- a/db/migrate/20180426145658_add_sku_index_to_spree_variants.spree.rb +++ /dev/null @@ -1,6 +0,0 @@ -# This migration comes from spree (originally 20130514151929) -class AddSkuIndexToSpreeVariants < ActiveRecord::Migration - def change - add_index :spree_variants, :sku - end -end diff --git a/db/migrate/20180426145659_add_backorderable_default_to_spree_stock_location.spree.rb b/db/migrate/20180426145659_add_backorderable_default_to_spree_stock_location.spree.rb deleted file mode 100644 index 29939c59e6..0000000000 --- a/db/migrate/20180426145659_add_backorderable_default_to_spree_stock_location.spree.rb +++ /dev/null @@ -1,6 +0,0 @@ -# This migration comes from spree (originally 20130515180736) -class AddBackorderableDefaultToSpreeStockLocation < ActiveRecord::Migration - def change - add_column :spree_stock_locations, :backorderable_default, :boolean, default: true - end -end diff --git a/db/migrate/20180426145660_add_propage_all_variants_to_spree_stock_location.spree.rb b/db/migrate/20180426145660_add_propage_all_variants_to_spree_stock_location.spree.rb deleted file mode 100644 index bfc55eac56..0000000000 --- a/db/migrate/20180426145660_add_propage_all_variants_to_spree_stock_location.spree.rb +++ /dev/null @@ -1,6 +0,0 @@ -# This migration comes from spree (originally 20130516151222) -class AddPropageAllVariantsToSpreeStockLocation < ActiveRecord::Migration - def change - add_column :spree_stock_locations, :propagate_all_variants, :boolean, default: true - end -end diff --git a/db/migrate/20180426145661_rename_shipping_methods_zones_to_spree_shipping_methods_zones.spree.rb b/db/migrate/20180426145661_rename_shipping_methods_zones_to_spree_shipping_methods_zones.spree.rb deleted file mode 100644 index 5c7ee6dd95..0000000000 --- a/db/migrate/20180426145661_rename_shipping_methods_zones_to_spree_shipping_methods_zones.spree.rb +++ /dev/null @@ -1,6 +0,0 @@ -# This migration comes from spree (originally 20130611054351) -class RenameShippingMethodsZonesToSpreeShippingMethodsZones < ActiveRecord::Migration - def change - rename_table :shipping_methods_zones, :spree_shipping_methods_zones - end -end diff --git a/db/migrate/20180426145662_add_deleted_at_to_spree_tax_rates.spree.rb b/db/migrate/20180426145662_add_deleted_at_to_spree_tax_rates.spree.rb deleted file mode 100644 index c804d9a1f7..0000000000 --- a/db/migrate/20180426145662_add_deleted_at_to_spree_tax_rates.spree.rb +++ /dev/null @@ -1,6 +0,0 @@ -# This migration comes from spree (originally 20130708052307) -class AddDeletedAtToSpreeTaxRates < ActiveRecord::Migration - def change - add_column :spree_tax_rates, :deleted_at, :datetime - end -end diff --git a/db/migrate/20180426145663_remove_lock_version_from_inventory_units.spree.rb b/db/migrate/20180426145663_remove_lock_version_from_inventory_units.spree.rb deleted file mode 100644 index 42c60bd3f3..0000000000 --- a/db/migrate/20180426145663_remove_lock_version_from_inventory_units.spree.rb +++ /dev/null @@ -1,7 +0,0 @@ -# This migration comes from spree (originally 20130711200933) -class RemoveLockVersionFromInventoryUnits < ActiveRecord::Migration - def change - # we are moving to pessimistic locking on stock_items - remove_column :spree_inventory_units, :lock_version - end -end diff --git a/db/migrate/20180426145664_add_cost_price_to_line_item.spree.rb b/db/migrate/20180426145664_add_cost_price_to_line_item.spree.rb deleted file mode 100644 index d54222f559..0000000000 --- a/db/migrate/20180426145664_add_cost_price_to_line_item.spree.rb +++ /dev/null @@ -1,6 +0,0 @@ -# This migration comes from spree (originally 20130718042445) -class AddCostPriceToLineItem < ActiveRecord::Migration - def change - add_column :spree_line_items, :cost_price, :decimal, :precision => 8, :scale => 2 - end -end diff --git a/db/migrate/20180426145665_set_backorderable_to_default_to_false.spree.rb b/db/migrate/20180426145665_set_backorderable_to_default_to_false.spree.rb deleted file mode 100644 index a05f4279a4..0000000000 --- a/db/migrate/20180426145665_set_backorderable_to_default_to_false.spree.rb +++ /dev/null @@ -1,7 +0,0 @@ -# This migration comes from spree (originally 20130718233855) -class SetBackorderableToDefaultToFalse < ActiveRecord::Migration - def change - change_column :spree_stock_items, :backorderable, :boolean, :default => false - change_column :spree_stock_locations, :backorderable_default, :boolean, :default => false - end -end diff --git a/db/migrate/20180426145666_add_created_by_id_to_spree_orders.spree.rb b/db/migrate/20180426145666_add_created_by_id_to_spree_orders.spree.rb deleted file mode 100644 index fe59c0fc21..0000000000 --- a/db/migrate/20180426145666_add_created_by_id_to_spree_orders.spree.rb +++ /dev/null @@ -1,6 +0,0 @@ -# This migration comes from spree (originally 20130725031716) -class AddCreatedByIdToSpreeOrders < ActiveRecord::Migration - def change - add_column :spree_orders, :created_by_id, :integer - end -end diff --git a/db/migrate/20180426145667_index_completed_at_on_spree_orders.spree.rb b/db/migrate/20180426145667_index_completed_at_on_spree_orders.spree.rb deleted file mode 100644 index c4c279ca4c..0000000000 --- a/db/migrate/20180426145667_index_completed_at_on_spree_orders.spree.rb +++ /dev/null @@ -1,6 +0,0 @@ -# This migration comes from spree (originally 20130729214043) -class IndexCompletedAtOnSpreeOrders < ActiveRecord::Migration - def change - add_index :spree_orders, :completed_at - end -end diff --git a/db/migrate/20180426145668_add_tax_category_id_to_spree_line_items.spree.rb b/db/migrate/20180426145668_add_tax_category_id_to_spree_line_items.spree.rb deleted file mode 100644 index 2b7e1a51bc..0000000000 --- a/db/migrate/20180426145668_add_tax_category_id_to_spree_line_items.spree.rb +++ /dev/null @@ -1,6 +0,0 @@ -# This migration comes from spree (originally 20130802014537) -class AddTaxCategoryIdToSpreeLineItems < ActiveRecord::Migration - def change - add_column :spree_line_items, :tax_category_id, :integer - end -end diff --git a/db/migrate/20180426145669_migrate_tax_categories_to_line_items.spree.rb b/db/migrate/20180426145669_migrate_tax_categories_to_line_items.spree.rb deleted file mode 100644 index 4ce74249b3..0000000000 --- a/db/migrate/20180426145669_migrate_tax_categories_to_line_items.spree.rb +++ /dev/null @@ -1,14 +0,0 @@ -# This migration comes from spree (originally 20130802022321) -class MigrateTaxCategoriesToLineItems < ActiveRecord::Migration - def change - Spree::LineItem.includes(:variant => { :product => :tax_category }).find_in_batches do |line_items| - line_items.each do |line_item| - next if line_item.variant.nil? - next if line_item.variant.product.nil? - next if line_item.product.nil? - next unless line_item.product.tax_category.present? - line_item.update_column(:tax_category_id, line_item.product.tax_category.id) - end - end - end -end diff --git a/db/migrate/20180510083800_remove_credit_card_from_subscriptions.rb b/db/migrate/20180510083800_remove_credit_card_from_subscriptions.rb deleted file mode 100644 index 0821fbef61..0000000000 --- a/db/migrate/20180510083800_remove_credit_card_from_subscriptions.rb +++ /dev/null @@ -1,13 +0,0 @@ -class RemoveCreditCardFromSubscriptions < ActiveRecord::Migration - def up - remove_foreign_key :subscriptions, name: :subscriptions_credit_card_id_fk - remove_index :subscriptions, :credit_card_id - remove_column :subscriptions, :credit_card_id - end - - def down - add_column :subscriptions, :credit_card_id, :integer - add_index :subscriptions, :credit_card_id - add_foreign_key :subscriptions, :spree_credit_cards, name: :subscriptions_credit_card_id_fk, column: :credit_card_id - end -end diff --git a/db/migrate/20180812214434_drop_carts.rb b/db/migrate/20180812214434_drop_carts.rb deleted file mode 100644 index f3dfb36ee7..0000000000 --- a/db/migrate/20180812214434_drop_carts.rb +++ /dev/null @@ -1,7 +0,0 @@ -class DropCarts < ActiveRecord::Migration - def change - remove_foreign_key :spree_orders, column: :cart_id - remove_column :spree_orders, :cart_id - drop_table :carts - end -end diff --git a/db/migrate/20180906094641_add_uniqueness_of_variant_id_to_spree_stock_items.rb b/db/migrate/20180906094641_add_uniqueness_of_variant_id_to_spree_stock_items.rb deleted file mode 100644 index 93b2853208..0000000000 --- a/db/migrate/20180906094641_add_uniqueness_of_variant_id_to_spree_stock_items.rb +++ /dev/null @@ -1,8 +0,0 @@ -# Since OFN has only a single default StockLocation, variants in OFN can only -# have a stock item. By adding this unique index we constraint that at DB level -# ensuring data integrity. -class AddUniquenessOfVariantIdToSpreeStockItems < ActiveRecord::Migration - def change - add_index :spree_stock_items, :variant_id, unique: true - end -end diff --git a/db/migrate/20180910155506_add_uniqueness_of_order_id_to_spree_shipments.rb b/db/migrate/20180910155506_add_uniqueness_of_order_id_to_spree_shipments.rb deleted file mode 100644 index 0ee5849afd..0000000000 --- a/db/migrate/20180910155506_add_uniqueness_of_order_id_to_spree_shipments.rb +++ /dev/null @@ -1,92 +0,0 @@ -# This migration is an OFN specific migration that enforces an order to have a single shipment at all times -class AddUniquenessOfOrderIdToSpreeShipments < ActiveRecord::Migration - def change - Spree::InventoryUnit.connection.schema_cache.clear! - Spree::InventoryUnit.reset_column_information - - destroy_all_but_latest_shipments - - remove_index :spree_shipments, :order_id - add_index :spree_shipments, :order_id, unique: true - end - - private - - # Destroy all but the latest shipment in each order - def destroy_all_but_latest_shipments - latest_shipments = Spree::Shipment. - select("order_id, MAX(updated_at) updated_at"). - group(:order_id). - having("count(*) > 1") - - all_duplicated_shipments = Spree::Shipment. - joins("INNER JOIN (#{latest_shipments.to_sql}) latest_shipments ON spree_shipments.order_id = latest_shipments.order_id") - backup_to_csv(all_duplicated_shipments) - - shipments_to_delete = Spree::Shipment. - joins("INNER JOIN (#{latest_shipments.to_sql}) latest_shipments ON spree_shipments.order_id = latest_shipments.order_id AND spree_shipments.updated_at != latest_shipments.updated_at") - remove_association_to_adjustments(shipments_to_delete) - shipments_to_delete.destroy_all - end - - def remove_association_to_adjustments(shipments) - Spree::Adjustment. - joins("INNER JOIN (#{shipments.to_sql}) shipments_to_delete ON shipments_to_delete.id = spree_adjustments.source_id and spree_adjustments.source_type = 'Spree::Shipment'"). - update_all(source_id: nil, source_type: nil, originator_id: nil, originator_type: nil, mandatory: nil) - end - - def backup_to_csv(shipments) - CSV.open(csv_path, "w") do |csv| - csv << csv_header_row - - shipments.each do |shipment| - csv << shipment_csv_row(shipment) - end - end - end - - def csv_header_row - %w( - id - tracking - number - order_number - shipping_method_name - cost - state - shipped_at - created_at - updated_at - address_json - ) - end - - def shipment_csv_row(shipment) - [ - shipment.id, - shipment.tracking, - shipment.number, - shipment.order.number, - shipment.shipping_method.andand.name, - shipment.cost, - shipment.state, - shipment.shipped_at, - shipment.created_at, - shipment.updated_at, - shipment.address.to_json - ] - end - - def csv_path - ensure_reports_path_exists - reports_path.join("duplicated_shipments_backup.csv") - end - - def reports_path - Rails.root.join("reports") - end - - def ensure_reports_path_exists - Dir.mkdir(reports_path) unless File.exist?(reports_path) - end -end diff --git a/db/migrate/20180919102548_remove_shipping_method_name_from_spree_line_items.rb b/db/migrate/20180919102548_remove_shipping_method_name_from_spree_line_items.rb deleted file mode 100644 index eaae250a18..0000000000 --- a/db/migrate/20180919102548_remove_shipping_method_name_from_spree_line_items.rb +++ /dev/null @@ -1,9 +0,0 @@ -class RemoveShippingMethodNameFromSpreeLineItems < ActiveRecord::Migration - def up - remove_column :spree_line_items, :shipping_method_name - end - - def down - add_column :spree_line_items, :shipping_method_name, :string - end -end diff --git a/db/migrate/20181008201815_update_instagram_data.rb b/db/migrate/20181008201815_update_instagram_data.rb deleted file mode 100644 index d1a45dc155..0000000000 --- a/db/migrate/20181008201815_update_instagram_data.rb +++ /dev/null @@ -1,8 +0,0 @@ -class UpdateInstagramData < ActiveRecord::Migration - def change - Enterprise.where("instagram like ?", "%instagram.com%").find_each do |e| - e.instagram = e.instagram.split('/').last - e.save - end - end -end diff --git a/db/migrate/20181010093850_fix_variants_missing_unit_value.rb b/db/migrate/20181010093850_fix_variants_missing_unit_value.rb deleted file mode 100644 index c4226d0dc2..0000000000 --- a/db/migrate/20181010093850_fix_variants_missing_unit_value.rb +++ /dev/null @@ -1,49 +0,0 @@ -# Fixes variants whose product.variant_unit is 'weight' and miss a unit_value, -# showing 1 unit of the specified weight. That is, if the user chose Kg, it'll -# display 1 as unit. -class FixVariantsMissingUnitValue < ActiveRecord::Migration - HUMAN_UNIT_VALUE = 1 - - def up - logger.info "Fixing variants missing unit_value...\n" - - variants_missing_unit_value.find_each do |variant| - logger.info "Processing variant #{variant.id}..." - - fix_unit_value(variant) - end - - logger.info "Done!" - end - - def down - end - - private - - def variants_missing_unit_value - Spree::Variant - .joins(:product) - .readonly(false) - .where( - spree_products: { variant_unit: 'weight' }, - spree_variants: { unit_value: nil } - ) - end - - def fix_unit_value(variant) - variant.unit_value = HUMAN_UNIT_VALUE * variant.product.variant_unit_scale - - if variant.save - logger.info "Successfully fixed variant #{variant.id}" - else - logger.info "Failed fixing variant #{variant.id}" - end - - logger.info "" - end - - def logger - @logger ||= Logger.new('log/migrate.log') - end -end diff --git a/db/migrate/20181020103501_revoke_variant_overrideswithout_permissions.rb b/db/migrate/20181020103501_revoke_variant_overrideswithout_permissions.rb deleted file mode 100644 index d8140c9bf3..0000000000 --- a/db/migrate/20181020103501_revoke_variant_overrideswithout_permissions.rb +++ /dev/null @@ -1,17 +0,0 @@ -class RevokeVariantOverrideswithoutPermissions < ActiveRecord::Migration - def up - # This process was executed when the permission_revoked_at colum was created (see AddPermissionRevokedAtToVariantOverrides) - # It needs to be repeated due to #2739 - variant_override_hubs = Enterprise.where(id: VariantOverride.select(:hub_id).uniq) - - variant_override_hubs.find_each do |hub| - permitting_producer_ids = hub.relationships_as_child - .with_permission(:create_variant_overrides).pluck(:parent_id) - - variant_overrides_with_revoked_permissions = VariantOverride.for_hubs(hub) - .joins(variant: :product).where("spree_products.supplier_id NOT IN (?)", permitting_producer_ids) - - variant_overrides_with_revoked_permissions.update_all(permission_revoked_at: Time.now) - end - end -end diff --git a/db/migrate/20181031105158_allow_all_suppliers_own_variant_overrides.rb b/db/migrate/20181031105158_allow_all_suppliers_own_variant_overrides.rb deleted file mode 100644 index a04bd5dfff..0000000000 --- a/db/migrate/20181031105158_allow_all_suppliers_own_variant_overrides.rb +++ /dev/null @@ -1,12 +0,0 @@ -class AllowAllSuppliersOwnVariantOverrides < ActiveRecord::Migration - def up - # This migration is fixing a detail of previous migration RevokeVariantOverrideswithoutPermissions - # Here we allow all variant_overrides where hub_id is the products supplier_id - # This is needed when the supplier herself uses the inventory to manage stock and not the catalog - owned_variant_overrides = VariantOverride.unscoped - .joins(variant: :product).where("spree_products.supplier_id = variant_overrides.hub_id") - - owned_variant_overrides.update_all(permission_revoked_at: nil) - end -end - diff --git a/db/migrate/20181106162211_update_weight_calculator_type_class_name.rb b/db/migrate/20181106162211_update_weight_calculator_type_class_name.rb deleted file mode 100644 index f8e15b3414..0000000000 --- a/db/migrate/20181106162211_update_weight_calculator_type_class_name.rb +++ /dev/null @@ -1,9 +0,0 @@ -class UpdateWeightCalculatorTypeClassName < ActiveRecord::Migration - def up - Spree::Calculator.connection.execute("UPDATE spree_calculators SET type = 'Calculator::Weight' WHERE type = 'OpenFoodNetwork::Calculator::Weight'") - end - - def down - Spree::Calculator.connection.execute("UPDATE spree_calculators SET type = 'OpenFoodNetwork::Calculator::Weight' WHERE type = 'Calculator::Weight'") - end -end diff --git a/db/migrate/20181123012635_associate_customers_to_users.rb b/db/migrate/20181123012635_associate_customers_to_users.rb deleted file mode 100644 index 95fab93677..0000000000 --- a/db/migrate/20181123012635_associate_customers_to_users.rb +++ /dev/null @@ -1,42 +0,0 @@ -# When we introduced the Customer model, we didn't associate any existing -# customers with users that have the same email address. -# Later we decided to create that association when users sign up. But we didn't -# update all the existing customers. We do that now for data consistency and to -# solve several bugs. -# -# - https://github.com/openfoodfoundation/openfoodnetwork/pull/2084 -# - https://github.com/openfoodfoundation/openfoodnetwork/issues/2841 -class AssociateCustomersToUsers < ActiveRecord::Migration - class Customer < ActiveRecord::Base - end - - def up - save_customers - execute "UPDATE customers - SET user_id = spree_users.id - FROM spree_users - WHERE customers.email = spree_users.email - AND customers.user_id IS NULL;" - end - - def down - customers = backed_up_customers - Customer.where(id: customers).update_all(user_id: nil) - end - - def save_customers - customers = Customer. - joins("INNER JOIN spree_users ON customers.email = spree_users.email"). - where(user_id: nil).all - - File.write(backup_file, YAML.dump(customers)) - end - - def backed_up_customers - YAML.load(File.read(backup_file)) - end - - def backup_file - File.join("log", "customers_without_user_association.log") - end -end diff --git a/db/migrate/20181128054803_old_migrations_removed.rb b/db/migrate/20181128054803_old_migrations_removed.rb new file mode 100644 index 0000000000..e0ad67a62b --- /dev/null +++ b/db/migrate/20181128054803_old_migrations_removed.rb @@ -0,0 +1,11 @@ +class OldMigrationsRemoved < ActiveRecord::Migration + LAST_DELETED_MIGRATION = 20181128054803 + def up + if ActiveRecord::Migrator.current_version < LAST_DELETED_MIGRATION + message = "You haven't updated your dev environment in a long time! " \ + "Legacy migration files before 2019 have now been removed. " \ + "Run `rails db:schema:load` before running `rails db:migrate`." + raise StandardError, message + end + end +end diff --git a/db/migrate/20181128054803_simplify_variant_override_stock_settings.rb b/db/migrate/20181128054803_simplify_variant_override_stock_settings.rb deleted file mode 100644 index 6627dca015..0000000000 --- a/db/migrate/20181128054803_simplify_variant_override_stock_settings.rb +++ /dev/null @@ -1,165 +0,0 @@ -# This simplifies variant overrides to have only the following combinations: -# -# on_demand | count_on_hand -# -----------+--------------- -# true | nil -# false | set -# nil | nil -# -# Refer to the table {here}[https://github.com/openfoodfoundation/openfoodnetwork/issues/3067] for -# the effect of different variant and variant override stock configurations. -# -# Furthermore, this will allow all existing variant overrides to satisfy the newly added model -# validation rules. -class SimplifyVariantOverrideStockSettings < ActiveRecord::Migration - class VariantOverride < ActiveRecord::Base - belongs_to :variant - belongs_to :hub, class_name: "Enterprise" - - scope :with_count_on_hand, -> { where("count_on_hand IS NOT NULL") } - scope :without_count_on_hand, -> { where(count_on_hand: nil) } - end - - class Variant < ActiveRecord::Base - self.table_name = "spree_variants" - - belongs_to :product - - def name - namer = OpenFoodNetwork::OptionValueNamer.new(self) - namer.name - end - end - - class Product < ActiveRecord::Base - self.table_name = "spree_products" - - belongs_to :supplier, class_name: "Enterprise" - end - - class Enterprise < ActiveRecord::Base; end - - def up - ensure_reports_path_exists - - CSV.open(csv_path, "w") do |csv| - csv << csv_header_row - - update_use_producer_stock_settings_with_count_on_hand(csv) - update_on_demand_with_count_on_hand(csv) - update_limited_stock_without_count_on_hand(csv) - end - - split_csv_by_distributor - end - - def down - CSV.foreach(csv_path, headers: true) do |row| - VariantOverride.where(id: row["variant_override_id"]) - .update_all(on_demand: row["previous_on_demand"], - count_on_hand: row["previous_count_on_hand"]) - end - end - - private - - def reports_path - Rails.root.join("reports", "SimplifyVariantOverrideStockSettings") - end - - def ensure_reports_path_exists - Dir.mkdir(reports_path) unless File.exist?(reports_path) - end - - def csv_path - reports_path.join("changed_variant_overrides.csv") - end - - def distributor_csv_path(name, id) - reports_path.join("changed_variant_overrides-#{name.parameterize('_')}-#{id}.csv") - end - - # When on_demand is nil but count_on_hand is set, force limited stock. - def update_use_producer_stock_settings_with_count_on_hand(csv) - variant_overrides = VariantOverride.where(on_demand: nil).with_count_on_hand - update_variant_overrides_and_log(csv, variant_overrides) do |variant_override| - variant_override.update_attributes!(on_demand: false) - end - end - - # Clear count_on_hand if forcing on demand. - def update_on_demand_with_count_on_hand(csv) - variant_overrides = VariantOverride.where(on_demand: true).with_count_on_hand - update_variant_overrides_and_log(csv, variant_overrides) do |variant_override| - variant_override.update_attributes!(count_on_hand: nil) - end - end - - # When on_demand is false but count on hand is not specified, set this to use producer stock - # settings. - def update_limited_stock_without_count_on_hand(csv) - variant_overrides = VariantOverride.where(on_demand: false).without_count_on_hand - update_variant_overrides_and_log(csv, variant_overrides) do |variant_override| - variant_override.update_attributes!(on_demand: nil) - end - end - - def update_variant_overrides_and_log(csv, variant_overrides) - variant_overrides.find_each do |variant_override| - csv << variant_override_log_row(variant_override) do - yield variant_override - end - end - end - - def csv_header_row - %w( - variant_override_id - distributor_name distributor_id - producer_name producer_id - product_name product_id - variant_description variant_id - previous_on_demand previous_count_on_hand - updated_on_demand updated_count_on_hand - ) - end - - def variant_override_log_row(variant_override) - variant = variant_override.variant - distributor = variant_override.hub - product = variant.andand.product - supplier = product.andand.supplier - - row = [ - variant_override.id, - distributor.andand.name, distributor.andand.id, - supplier.andand.name, supplier.andand.id, - product.andand.name, product.andand.id, - variant.andand.name, variant.andand.id, - variant_override.on_demand, variant_override.count_on_hand - ] - - yield variant_override - - row + [variant_override.on_demand, variant_override.count_on_hand] - end - - def split_csv_by_distributor - table = CSV.read(csv_path) - distributor_ids = table[1..-1].map { |row| row[2] }.uniq # Don't use the header row. - - distributor_ids.each do |distributor_id| - distributor_data_rows = filter_data_rows_for_distributor(table[1..-1], distributor_id) - distributor_name = distributor_data_rows.first[1] - - CSV.open(distributor_csv_path(distributor_name, distributor_id), "w") do |csv| - csv << table[0] # Header row - distributor_data_rows.each { |row| csv << row } - end - end - end - - def filter_data_rows_for_distributor(data_rows, distributor_id) - data_rows.select { |row| row[2] == distributor_id } - end -end From 63ac6c50881ecdd7c49b93613dfa4fb0ae55a7ff Mon Sep 17 00:00:00 2001 From: Maikel Linke Date: Fri, 17 Apr 2020 12:40:54 +1000 Subject: [PATCH 2/4] Remove superfluous conditional A migration's `up` method is only run when the migration needs to be applied. The only case we could have a higher version number is when a migration with a higher version got merged before the current one. And in that case, we still want this migration to fail, because it hasn't been applied yet. --- db/migrate/20181128054803_old_migrations_removed.rb | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/db/migrate/20181128054803_old_migrations_removed.rb b/db/migrate/20181128054803_old_migrations_removed.rb index e0ad67a62b..3cd68a2610 100644 --- a/db/migrate/20181128054803_old_migrations_removed.rb +++ b/db/migrate/20181128054803_old_migrations_removed.rb @@ -1,11 +1,8 @@ class OldMigrationsRemoved < ActiveRecord::Migration - LAST_DELETED_MIGRATION = 20181128054803 def up - if ActiveRecord::Migrator.current_version < LAST_DELETED_MIGRATION - message = "You haven't updated your dev environment in a long time! " \ - "Legacy migration files before 2019 have now been removed. " \ - "Run `rails db:schema:load` before running `rails db:migrate`." - raise StandardError, message - end + message = "You haven't updated your dev environment in a long time! " \ + "Legacy migration files before 2019 have now been removed. " \ + "Run `rails db:schema:load` before running `rails db:migrate`." + raise StandardError, message end end From 8af40f4675fb67c731fb93c72229e6aa251be742 Mon Sep 17 00:00:00 2001 From: Maikel Linke Date: Fri, 17 Apr 2020 12:47:49 +1000 Subject: [PATCH 3/4] Format and indent migration message It's much clearer to read this way: ``` == OldMigrationsRemoved: migrating =========================================== rake aborted! StandardError: An error has occurred, this and all later migrations canceled: You haven't updated your dev environment in a long time! Legacy migration files before 2019 have now been removed. Run `rails db:schema:load` before running `rails db:migrate`. ``` --- db/migrate/20181128054803_old_migrations_removed.rb | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/db/migrate/20181128054803_old_migrations_removed.rb b/db/migrate/20181128054803_old_migrations_removed.rb index 3cd68a2610..435848834a 100644 --- a/db/migrate/20181128054803_old_migrations_removed.rb +++ b/db/migrate/20181128054803_old_migrations_removed.rb @@ -1,8 +1,11 @@ class OldMigrationsRemoved < ActiveRecord::Migration def up - message = "You haven't updated your dev environment in a long time! " \ - "Legacy migration files before 2019 have now been removed. " \ - "Run `rails db:schema:load` before running `rails db:migrate`." - raise StandardError, message + raise StandardError, <<-MESSAGE + + You haven't updated your dev environment in a long time! + Legacy migration files before 2019 have now been removed. + Run `rails db:schema:load` before running `rails db:migrate`. + + MESSAGE end end From 75207247e69126bb86b2e81a6382cbeaa96945c9 Mon Sep 17 00:00:00 2001 From: Maikel Linke Date: Fri, 17 Apr 2020 12:52:05 +1000 Subject: [PATCH 4/4] Correct database commands --- db/migrate/20181128054803_old_migrations_removed.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/db/migrate/20181128054803_old_migrations_removed.rb b/db/migrate/20181128054803_old_migrations_removed.rb index 435848834a..47d233f0aa 100644 --- a/db/migrate/20181128054803_old_migrations_removed.rb +++ b/db/migrate/20181128054803_old_migrations_removed.rb @@ -1,10 +1,12 @@ +# frozen_string_literal: true + class OldMigrationsRemoved < ActiveRecord::Migration def up raise StandardError, <<-MESSAGE You haven't updated your dev environment in a long time! Legacy migration files before 2019 have now been removed. - Run `rails db:schema:load` before running `rails db:migrate`. + Run `rake db:schema:load` before running `rake db:migrate`. MESSAGE end