From 274c7311e8b77d6a53989f0ef4812e7fe0e017c9 Mon Sep 17 00:00:00 2001 From: Deepak Mahakale Date: Fri, 2 Dec 2016 00:13:50 +0530 Subject: [PATCH] Initialize spree demo application --- .gitignore | 18 + Gemfile | 52 + Gemfile.lock | 339 ++++++ README.md | 28 + Rakefile | 6 + app/assets/images/.keep | 0 app/assets/javascripts/application.js | 16 + app/assets/stylesheets/application.css | 15 + app/controllers/application_controller.rb | 5 + app/controllers/concerns/.keep | 0 app/helpers/application_helper.rb | 2 + app/mailers/.keep | 0 app/models/.keep | 0 app/models/concerns/.keep | 0 app/views/layouts/application.html.erb | 14 + bin/bundle | 3 + bin/rails | 4 + bin/rake | 4 + bin/setup | 29 + config.ru | 4 + config/application.rb | 39 + config/boot.rb | 3 + config/database.yml | 25 + config/environment.rb | 5 + config/environments/development.rb | 41 + config/environments/production.rb | 79 ++ config/environments/test.rb | 42 + config/initializers/assets.rb | 11 + config/initializers/backtrace_silencers.rb | 7 + config/initializers/cookies_serializer.rb | 3 + config/initializers/devise.rb | 1 + .../initializers/filter_parameter_logging.rb | 4 + config/initializers/inflections.rb | 16 + config/initializers/mime_types.rb | 4 + config/initializers/session_store.rb | 3 + config/initializers/spree.rb | 18 + config/initializers/wrap_parameters.rb | 14 + config/locales/en.yml | 23 + config/routes.rb | 63 + config/secrets.yml | 22 + .../20161201175440_spree_one_two.spree.rb | 482 ++++++++ ...0161201175441_spree_promo_one_two.spree.rb | 46 + ...20161201175442_add_tax_rate_label.spree.rb | 6 + ...75443_add_toggle_tax_rate_display.spree.rb | 6 + ..._remove_unused_preference_columns.spree.rb | 9 + ...75445_add_lock_version_to_variant.spree.rb | 6 + ..._add_states_required_to_countries.spree.rb | 6 + ..._on_demand_to_product_and_variant.spree.rb | 7 + ..._constraint_from_products_on_hand.spree.rb | 12 + ...175449_split_prices_from_variants.spree.rb | 32 + ...not_null_from_spree_prices_amount.spree.rb | 10 + ...175451_add_currency_to_line_items.spree.rb | 6 + ...1201175452_add_currency_to_orders.spree.rb | 6 + ...453_add_cost_currency_to_variants.spree.rb | 6 + ...e_display_on_from_payment_methods.spree.rb | 6 + ...175455_add_position_to_taxonomies.spree.rb | 6 + ...75456_add_last_ip_to_spree_orders.spree.rb | 6 + ...57_add_state_to_spree_adjustments.spree.rb | 7 + ...splay_on_to_spree_payment_methods.spree.rb | 10 + ...dd_position_to_product_properties.spree.rb | 7 + ..._add_identifier_to_spree_payments.spree.rb | 6 + ...61_add_order_id_index_to_payments.spree.rb | 10 + ..._primary_to_spree_products_taxons.spree.rb | 6 + ...01175463_create_spree_stock_items.spree.rb | 15 + ...5464_create_spree_stock_locations.spree.rb | 12 + ...161201175465_create_default_stock.spree.rb | 35 + ...6_add_order_id_index_to_shipments.spree.rb | 6 + ...ription_on_spree_products_to_text.spree.rb | 6 + ...ck_location_id_to_spree_shipments.spree.rb | 6 + ...469_add_pending_to_inventory_unit.spree.rb | 7 + ...n_demand_from_product_and_variant.spree.rb | 7 + ...75471_create_shipping_method_zone.spree.rb | 22 + ..._category_id_from_shipping_method.spree.rb | 6 + ...create_shipping_method_categories.spree.rb | 14 + ...ing_url_to_spree_shipping_methods.spree.rb | 6 + ...75475_create_spree_shipping_rates.spree.rb | 25 + ...h_attributes_from_shipping_method.spree.rb | 8 + ...1201175477_create_stock_movements.spree.rb | 13 + ..._address_fields_to_stock_location.spree.rb | 23 + ...d_active_field_to_stock_locations.spree.rb | 6 + ...0_add_backorderable_to_stock_item.spree.rb | 6 + ...efault_quantity_to_stock_movement.spree.rb | 6 + ...nd_destination_to_stock_movements.spree.rb | 9 + ...483_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 + ..._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 + ...1175490_add_stock_location_to_rma.spree.rb | 6 + ...hipment_state_for_canceled_orders.spree.rb | 16 + ...201175492_add_seo_metas_to_taxons.spree.rb | 10 + ...emove_stock_item_and_variant_lock.spree.rb | 15 + ...94_add_name_to_spree_credit_cards.spree.rb | 6 + ...name_fields_on_spree_credit_cards.spree.rb | 14 + ..._to_source_columns_on_adjustments.spree.rb | 6 + ...01175497_update_adjustment_states.spree.rb | 17 + ...8_add_shipping_rates_to_shipments.spree.rb | 16 + ...5499_create_spree_stock_transfers.spree.rb | 15 + ...75500_drop_products_count_on_hand.spree.rb | 6 + ...01_set_default_shipping_rate_cost.spree.rb | 6 + ...5502_add_number_to_stock_transfer.spree.rb | 24 + ...3_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_user_id_index_to_spree_orders.spree.rb | 6 + ...add_updated_at_to_spree_countries.spree.rb | 10 + ...09_add_updated_at_to_spree_states.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 | 8 + ...add_deleted_at_to_spree_tax_rates.spree.rb | 6 + ...lock_version_from_inventory_units.spree.rb | 7 + ...75515_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 | 11 + ...201175521_drop_spree_mail_methods.spree.rb | 13 + ...fault_stock_location_on_shipments.spree.rb | 9 + ...0161201175523_upgrade_adjustments.spree.rb | 41 + ...01175524_rename_adjustment_fields.spree.rb | 15 + ..._column_to_spree_shipping_methods.spree.rb | 6 + ...e_column_to_spree_stock_locations.spree.rb | 6 + ...dd_shipment_total_to_spree_orders.spree.rb | 6 + ...01175528_expand_order_number_size.spree.rb | 10 + ...9_rename_activators_to_promotions.spree.rb | 6 + ...dd_adjustment_total_to_line_items.spree.rb | 6 + ...add_adjustment_total_to_shipments.spree.rb | 6 + ...1175532_add_depth_to_spree_taxons.spree.rb | 17 + ...o_line_items_shipments_and_orders.spree.rb | 9 + ..._to_shipping_methods_and_products.spree.rb | 16 + ..._migrate_old_shipping_calculators.spree.rb | 20 + ...add_code_to_spree_promotion_rules.spree.rb | 6 + ...nge_states_required_for_countries.spree.rb | 10 + ...d_deleted_at_to_spree_stock_items.spree.rb | 6 + ...emove_promotions_event_name_field.spree.rb | 6 + ...ne_items_and_shipments_and_orders.spree.rb | 8 + ..._remove_unused_credit_card_fields.spree.rb | 17 + ...42_add_track_inventory_to_variant.spree.rb | 6 + ...5543_add_tax_category_to_variants.spree.rb | 7 + ...75544_add_channel_to_spree_orders.spree.rb | 6 + ...75545_add_included_to_adjustments.spree.rb | 6 + ...201175546_rename_tax_total_fields.spree.rb | 12 + ..._item_id_to_spree_inventory_units.spree.rb | 22 + ...175548_add_updated_at_to_variants.spree.rb | 6 + ...9_add_position_to_classifications.spree.rb | 6 + ...50_create_spree_orders_promotions.spree.rb | 9 + ...unique_shipping_method_categories.spree.rb | 25 + ...52_add_item_count_to_spree_orders.spree.rb | 6 + ...value_type_from_spree_preferences.spree.rb | 9 + ...me_permalink_to_slug_for_products.spree.rb | 6 + ...variant_id_and_currency_on_prices.spree.rb | 6 + ...rules_and_actions_to_promotion_id.spree.rb | 7 + ...57_add_deleted_at_to_spree_prices.spree.rb | 6 + ...over_id_and_approved_at_to_orders.spree.rb | 7 + ...rmation_delivered_to_spree_orders.spree.rb | 6 + ...d_auto_capture_to_payment_methods.spree.rb | 6 + ...eate_spree_payment_capture_events.spree.rb | 13 + ...add_uncaptured_amount_to_payments.spree.rb | 6 + ...63_default_variant_weight_to_zero.spree.rb | 12 + ...x_category_id_to_shipping_methods.spree.rb | 6 + ...add_tax_rate_id_to_shipping_rates.spree.rb | 6 + ...mount_to_line_items_and_shipments.spree.rb | 7 + .../20161201175567_add_more_indexes.spree.rb | 14 + ...68_add_considered_risky_to_orders.spree.rb | 6 + ...dd_preference_store_to_everything.spree.rb | 9 + ...add_user_id_to_spree_credit_cards.spree.rb | 14 + ...201175571_migrate_old_preferences.spree.rb | 24 + ...0161201175572_create_spree_stores.spree.rb | 26 + ...573_create_store_from_preferences.spree.rb | 38 + ...74_add_timestamps_to_spree_assets.spree.rb | 7 + ...eate_spree_taxons_promotion_rules.spree.rb | 9 + ...75576_add_additional_store_fields.spree.rb | 9 + ...01175577_add_many_missing_indexes.spree.rb | 19 + ...orphic_index_and_add_more_missing.spree.rb | 67 + ...r_id_created_by_id_index_to_order.spree.rb | 6 + ...ange_spree_price_amount_precision.spree.rb | 9 + ...1175581_add_token_to_spree_orders.spree.rb | 6 + ...r_token_from_tokenized_permission.spree.rb | 30 + ...hipment_total_for_users_upgrading.spree.rb | 11 + ...dit_card_first_name_and_last_name.spree.rb | 7 + ...ted_at_to_spree_promotion_actions.spree.rb | 7 + ...ptured_amount_from_spree_payments.spree.rb | 6 + ...161201175587_create_spree_refunds.spree.rb | 13 + ...turn_authorization_inventory_unit.spree.rb | 13 + ...on_inventory_unit_to_return_items.spree.rb | 6 + ...backfill_line_item_pre_tax_amount.spree.rb | 11 + ...reate_spree_return_authorizations.spree.rb | 56 + ...add_amount_fields_to_return_items.spree.rb | 8 + ..._drop_return_authorization_amount.spree.rb | 6 + ...pree_return_authorization_reasons.spree.rb | 29 + ...75595_create_spree_refund_reasons.spree.rb | 15 + ...ename_return_authorization_reason.spree.rb | 6 + ...create_spree_promotion_categories.spree.rb | 12 + ..._drop_received_at_on_return_items.spree.rb | 10 + ...acceptance_status_to_return_items.spree.rb | 7 + ...5600_create_default_refund_reason.spree.rb | 10 + ..._default_to_spree_stock_locations.spree.rb | 8 + ...602_create_spree_customer_returns.spree.rb | 10 + ...customer_return_id_to_return_item.spree.rb | 7 + ...01175604_create_friendly_id_slugs.spree.rb | 16 + ...ee_refund_return_authorization_id.spree.rb | 6 + ...urn_item_pre_tax_amount_precision.spree.rb | 14 + ...opy_product_slugs_to_slug_history.spree.rb | 16 + ...75608_create_spree_reimbursements.spree.rb | 22 + ...d_promotionable_to_spree_products.spree.rb | 6 + ...hange_inventory_unit_foreign_keys.spree.rb | 8 + ...ance_status_errors_to_return_item.spree.rb | 6 + ..._create_spree_reimbursement_types.spree.rb | 21 + ...5613_add_default_to_shipment_cost.spree.rb | 11 + ...add_default_to_spree_credit_cards.spree.rb | 6 + ...ake_existing_credit_cards_default.spree.rb | 11 + ...16_add_type_to_reimbursement_type.spree.rb | 10 + ...reate_spree_reimbursement_credits.spree.rb | 11 + ..._add_meta_title_to_spree_products.spree.rb | 8 + .../20161201175619_add_kind_to_zone.spree.rb | 12 + ..._add_code_to_spree_tax_categories.spree.rb | 6 + ...ult_pre_tax_amount_should_be_zero.spree.rb | 7 + ...dd_code_to_spree_shipping_methods.spree.rb | 6 + ...ncel_audit_fields_to_spree_orders.spree.rb | 7 + ...1201175624_add_store_id_to_orders.spree.rb | 9 + ...25_create_spree_taxons_prototypes.spree.rb | 9 + ...6_add_state_lock_version_to_order.spree.rb | 6 + ...ree_variants_to_spree_stock_items.spree.rb | 14 + ...628_fix_adjustment_order_presence.spree.rb | 14 + ..._update_classifications_positions.spree.rb | 10 + ...guest_token_index_to_spree_orders.spree.rb | 6 + ...31_remove_token_permissions_table.spree.rb | 7 + ..._remove_extra_products_slug_index.spree.rb | 6 + ...1175633_update_product_slug_index.spree.rb | 7 + ..._identifier_to_number_for_payment.spree.rb | 6 + ...175635_create_spree_store_credits.spree.rb | 25 + ...ate_spree_store_credit_categories.spree.rb | 9 + ..._create_spree_store_credit_events.spree.rb | 18 + ...8_create_spree_store_credit_types.spree.rb | 11 + ...e_environment_from_payment_method.spree.rb | 7 + ...40_add_resellable_to_return_items.spree.rb | 6 + ...ode_to_spree_promotion_categories.spree.rb | 6 + ...2_remove_environment_from_tracker.spree.rb | 7 + ...75643_remove_spree_configurations.spree.rb | 17 + ...x_to_spree_stock_items_variant_id.spree.rb | 14 + ...5645_ensure_payments_have_numbers.spree.rb | 10 + ...d_missing_indexes_on_spree_tables.spree.rb | 68 ++ ...icated_indexes_from_multi_columns.spree.rb | 19 + ...er_index_from_spree_state_changes.spree.rb | 15 + ...201175649_fix_adjustment_order_id.spree.rb | 71 ++ ...position_to_spree_payment_methods.spree.rb | 6 + ...d_deleted_at_to_friendly_id_slugs.spree.rb | 7 + ...increase_scale_on_pre_tax_amounts.spree.rb | 17 + ...ble_adjustment_total_to_line_item.spree.rb | 20 + ...4_migrate_payment_methods_display.spree.rb | 13 + ...e_acts_as_paranoid_on_calculators.spree.rb | 7 + ...pree_payment_method_store_credits.spree.rb | 13 + ...gs_to_associations_to_model_names.spree.rb | 19 + ...01175658_spree_store_credit_types.spree.rb | 12 + ...ontinued_to_products_and_variants.spree.rb | 69 ++ ...pping_method_id_from_spree_orders.spree.rb | 14 + ...id_column_to_earlier_habtm_tables.spree.rb | 17 + .../20161201175662_add_indexes.spree.rb | 15 + ...63_add_api_key_to_spree_users.spree_api.rb | 8 + ...01175664_resize_api_key_field.spree_api.rb | 8 + ...name_api_key_to_spree_api_key.spree_api.rb | 8 + ...d_index_to_user_spree_api_key.spree_api.rb | 8 + .../20161201175667_create_users.spree_auth.rb | 30 + ...68_rename_columns_for_devise.spree_auth.rb | 38 + ..._convert_user_remember_field.spree_auth.rb | 12 + ...sword_sent_at_to_spree_users.spree_auth.rb | 9 + ...ake_users_email_index_unique.spree_auth.rb | 10 + ...5672_add_deleted_at_to_users.spree_auth.rb | 7 + ...673_add_confirmable_to_users.spree_auth.rb | 8 + ..._add_missing_indices_on_user.spree_auth.rb | 11 + ...reate_skrill_transactions.spree_gateway.rb | 14 + ...ntree_payment_method_type.spree_gateway.rb | 10 + ...tripe_payment_method_type.spree_gateway.rb | 10 + ...anced_payment_method_type.spree_gateway.rb | 10 + ...aypal_payment_method_type.spree_gateway.rb | 10 + ...igrate_stripe_preferences.spree_gateway.rb | 9 + db/schema.rb | 1079 +++++++++++++++++ db/seeds.rb | 11 + lib/assets/.keep | 0 lib/tasks/.keep | 0 log/.keep | 0 public/404.html | 67 + public/422.html | 67 + public/500.html | 66 + public/favicon.ico | 0 public/robots.txt | 13 + vendor/assets/javascripts/.keep | 0 .../assets/javascripts/spree/backend/all.js | 11 + .../assets/javascripts/spree/frontend/all.js | 12 + vendor/assets/stylesheets/.keep | 0 .../assets/stylesheets/spree/backend/all.css | 10 + .../assets/stylesheets/spree/frontend/all.css | 10 + 297 files changed, 5660 insertions(+) create mode 100644 .gitignore create mode 100644 Gemfile create mode 100644 Gemfile.lock create mode 100644 README.md create mode 100644 Rakefile create mode 100644 app/assets/images/.keep create mode 100644 app/assets/javascripts/application.js create mode 100644 app/assets/stylesheets/application.css create mode 100644 app/controllers/application_controller.rb create mode 100644 app/controllers/concerns/.keep create mode 100644 app/helpers/application_helper.rb create mode 100644 app/mailers/.keep create mode 100644 app/models/.keep create mode 100644 app/models/concerns/.keep create mode 100644 app/views/layouts/application.html.erb create mode 100755 bin/bundle create mode 100755 bin/rails create mode 100755 bin/rake create mode 100755 bin/setup create mode 100644 config.ru create mode 100644 config/application.rb create mode 100644 config/boot.rb create mode 100644 config/database.yml create mode 100644 config/environment.rb create mode 100644 config/environments/development.rb create mode 100644 config/environments/production.rb create mode 100644 config/environments/test.rb create mode 100644 config/initializers/assets.rb create mode 100644 config/initializers/backtrace_silencers.rb create mode 100644 config/initializers/cookies_serializer.rb create mode 100644 config/initializers/devise.rb create mode 100644 config/initializers/filter_parameter_logging.rb create mode 100644 config/initializers/inflections.rb create mode 100644 config/initializers/mime_types.rb create mode 100644 config/initializers/session_store.rb create mode 100644 config/initializers/spree.rb create mode 100644 config/initializers/wrap_parameters.rb create mode 100644 config/locales/en.yml create mode 100644 config/routes.rb create mode 100644 config/secrets.yml create mode 100644 db/migrate/20161201175440_spree_one_two.spree.rb create mode 100644 db/migrate/20161201175441_spree_promo_one_two.spree.rb create mode 100644 db/migrate/20161201175442_add_tax_rate_label.spree.rb create mode 100644 db/migrate/20161201175443_add_toggle_tax_rate_display.spree.rb create mode 100644 db/migrate/20161201175444_remove_unused_preference_columns.spree.rb create mode 100644 db/migrate/20161201175445_add_lock_version_to_variant.spree.rb create mode 100644 db/migrate/20161201175446_add_states_required_to_countries.spree.rb create mode 100644 db/migrate/20161201175447_add_on_demand_to_product_and_variant.spree.rb create mode 100644 db/migrate/20161201175448_remove_not_null_constraint_from_products_on_hand.spree.rb create mode 100644 db/migrate/20161201175449_split_prices_from_variants.spree.rb create mode 100644 db/migrate/20161201175450_remove_not_null_from_spree_prices_amount.spree.rb create mode 100644 db/migrate/20161201175451_add_currency_to_line_items.spree.rb create mode 100644 db/migrate/20161201175452_add_currency_to_orders.spree.rb create mode 100644 db/migrate/20161201175453_add_cost_currency_to_variants.spree.rb create mode 100644 db/migrate/20161201175454_remove_display_on_from_payment_methods.spree.rb create mode 100644 db/migrate/20161201175455_add_position_to_taxonomies.spree.rb create mode 100644 db/migrate/20161201175456_add_last_ip_to_spree_orders.spree.rb create mode 100644 db/migrate/20161201175457_add_state_to_spree_adjustments.spree.rb create mode 100644 db/migrate/20161201175458_add_display_on_to_spree_payment_methods.spree.rb create mode 100644 db/migrate/20161201175459_add_position_to_product_properties.spree.rb create mode 100644 db/migrate/20161201175460_add_identifier_to_spree_payments.spree.rb create mode 100644 db/migrate/20161201175461_add_order_id_index_to_payments.spree.rb create mode 100644 db/migrate/20161201175462_add_primary_to_spree_products_taxons.spree.rb create mode 100644 db/migrate/20161201175463_create_spree_stock_items.spree.rb create mode 100644 db/migrate/20161201175464_create_spree_stock_locations.spree.rb create mode 100644 db/migrate/20161201175465_create_default_stock.spree.rb create mode 100644 db/migrate/20161201175466_add_order_id_index_to_shipments.spree.rb create mode 100644 db/migrate/20161201175467_change_meta_description_on_spree_products_to_text.spree.rb create mode 100644 db/migrate/20161201175468_add_stock_location_id_to_spree_shipments.spree.rb create mode 100644 db/migrate/20161201175469_add_pending_to_inventory_unit.spree.rb create mode 100644 db/migrate/20161201175470_remove_on_demand_from_product_and_variant.spree.rb create mode 100644 db/migrate/20161201175471_create_shipping_method_zone.spree.rb create mode 100644 db/migrate/20161201175472_remove_shipping_category_id_from_shipping_method.spree.rb create mode 100644 db/migrate/20161201175473_create_shipping_method_categories.spree.rb create mode 100644 db/migrate/20161201175474_add_tracking_url_to_spree_shipping_methods.spree.rb create mode 100644 db/migrate/20161201175475_create_spree_shipping_rates.spree.rb create mode 100644 db/migrate/20161201175476_remove_category_match_attributes_from_shipping_method.spree.rb create mode 100644 db/migrate/20161201175477_create_stock_movements.spree.rb create mode 100644 db/migrate/20161201175478_add_address_fields_to_stock_location.spree.rb create mode 100644 db/migrate/20161201175479_add_active_field_to_stock_locations.spree.rb create mode 100644 db/migrate/20161201175480_add_backorderable_to_stock_item.spree.rb create mode 100644 db/migrate/20161201175481_add_default_quantity_to_stock_movement.spree.rb create mode 100644 db/migrate/20161201175482_add_source_and_destination_to_stock_movements.spree.rb create mode 100644 db/migrate/20161201175483_change_orders_total_precision.spree.rb create mode 100644 db/migrate/20161201175484_change_spree_payments_amount_precision.spree.rb create mode 100644 db/migrate/20161201175485_change_spree_return_authorization_amount_precision.spree.rb create mode 100644 db/migrate/20161201175486_change_adjustments_amount_precision.spree.rb create mode 100644 db/migrate/20161201175487_add_originator_to_stock_movement.spree.rb create mode 100644 db/migrate/20161201175488_drop_source_and_destination_from_stock_movement.spree.rb create mode 100644 db/migrate/20161201175489_migrate_inventory_unit_sold_to_on_hand.spree.rb create mode 100644 db/migrate/20161201175490_add_stock_location_to_rma.spree.rb create mode 100644 db/migrate/20161201175491_update_shipment_state_for_canceled_orders.spree.rb create mode 100644 db/migrate/20161201175492_add_seo_metas_to_taxons.spree.rb create mode 100644 db/migrate/20161201175493_remove_stock_item_and_variant_lock.spree.rb create mode 100644 db/migrate/20161201175494_add_name_to_spree_credit_cards.spree.rb create mode 100644 db/migrate/20161201175495_update_name_fields_on_spree_credit_cards.spree.rb create mode 100644 db/migrate/20161201175496_add_index_to_source_columns_on_adjustments.spree.rb create mode 100644 db/migrate/20161201175497_update_adjustment_states.spree.rb create mode 100644 db/migrate/20161201175498_add_shipping_rates_to_shipments.spree.rb create mode 100644 db/migrate/20161201175499_create_spree_stock_transfers.spree.rb create mode 100644 db/migrate/20161201175500_drop_products_count_on_hand.spree.rb create mode 100644 db/migrate/20161201175501_set_default_shipping_rate_cost.spree.rb create mode 100644 db/migrate/20161201175502_add_number_to_stock_transfer.spree.rb create mode 100644 db/migrate/20161201175503_add_sku_index_to_spree_variants.spree.rb create mode 100644 db/migrate/20161201175504_add_backorderable_default_to_spree_stock_location.spree.rb create mode 100644 db/migrate/20161201175505_add_propage_all_variants_to_spree_stock_location.spree.rb create mode 100644 db/migrate/20161201175506_rename_shipping_methods_zones_to_spree_shipping_methods_zones.spree.rb create mode 100644 db/migrate/20161201175507_add_user_id_index_to_spree_orders.spree.rb create mode 100644 db/migrate/20161201175508_add_updated_at_to_spree_countries.spree.rb create mode 100644 db/migrate/20161201175509_add_updated_at_to_spree_states.spree.rb create mode 100644 db/migrate/20161201175510_add_cvv_result_code_and_cvv_result_message_to_spree_payments.spree.rb create mode 100644 db/migrate/20161201175511_add_unique_index_to_permalink_on_spree_products.spree.rb create mode 100644 db/migrate/20161201175512_add_unique_index_to_orders_shipments_and_stock_transfers.spree.rb create mode 100644 db/migrate/20161201175513_add_deleted_at_to_spree_tax_rates.spree.rb create mode 100644 db/migrate/20161201175514_remove_lock_version_from_inventory_units.spree.rb create mode 100644 db/migrate/20161201175515_add_cost_price_to_line_item.spree.rb create mode 100644 db/migrate/20161201175516_set_backorderable_to_default_to_false.spree.rb create mode 100644 db/migrate/20161201175517_add_created_by_id_to_spree_orders.spree.rb create mode 100644 db/migrate/20161201175518_index_completed_at_on_spree_orders.spree.rb create mode 100644 db/migrate/20161201175519_add_tax_category_id_to_spree_line_items.spree.rb create mode 100644 db/migrate/20161201175520_migrate_tax_categories_to_line_items.spree.rb create mode 100644 db/migrate/20161201175521_drop_spree_mail_methods.spree.rb create mode 100644 db/migrate/20161201175522_set_default_stock_location_on_shipments.spree.rb create mode 100644 db/migrate/20161201175523_upgrade_adjustments.spree.rb create mode 100644 db/migrate/20161201175524_rename_adjustment_fields.spree.rb create mode 100644 db/migrate/20161201175525_add_admin_name_column_to_spree_shipping_methods.spree.rb create mode 100644 db/migrate/20161201175526_add_admin_name_column_to_spree_stock_locations.spree.rb create mode 100644 db/migrate/20161201175527_add_shipment_total_to_spree_orders.spree.rb create mode 100644 db/migrate/20161201175528_expand_order_number_size.spree.rb create mode 100644 db/migrate/20161201175529_rename_activators_to_promotions.spree.rb create mode 100644 db/migrate/20161201175530_add_adjustment_total_to_line_items.spree.rb create mode 100644 db/migrate/20161201175531_add_adjustment_total_to_shipments.spree.rb create mode 100644 db/migrate/20161201175532_add_depth_to_spree_taxons.spree.rb create mode 100644 db/migrate/20161201175533_add_tax_total_to_line_items_shipments_and_orders.spree.rb create mode 100644 db/migrate/20161201175534_add_shipping_category_to_shipping_methods_and_products.spree.rb create mode 100644 db/migrate/20161201175535_migrate_old_shipping_calculators.spree.rb create mode 100644 db/migrate/20161201175536_add_code_to_spree_promotion_rules.spree.rb create mode 100644 db/migrate/20161201175537_change_states_required_for_countries.spree.rb create mode 100644 db/migrate/20161201175538_add_deleted_at_to_spree_stock_items.spree.rb create mode 100644 db/migrate/20161201175539_remove_promotions_event_name_field.spree.rb create mode 100644 db/migrate/20161201175540_add_promo_total_to_line_items_and_shipments_and_orders.spree.rb create mode 100644 db/migrate/20161201175541_remove_unused_credit_card_fields.spree.rb create mode 100644 db/migrate/20161201175542_add_track_inventory_to_variant.spree.rb create mode 100644 db/migrate/20161201175543_add_tax_category_to_variants.spree.rb create mode 100644 db/migrate/20161201175544_add_channel_to_spree_orders.spree.rb create mode 100644 db/migrate/20161201175545_add_included_to_adjustments.spree.rb create mode 100644 db/migrate/20161201175546_rename_tax_total_fields.spree.rb create mode 100644 db/migrate/20161201175547_add_line_item_id_to_spree_inventory_units.spree.rb create mode 100644 db/migrate/20161201175548_add_updated_at_to_variants.spree.rb create mode 100644 db/migrate/20161201175549_add_position_to_classifications.spree.rb create mode 100644 db/migrate/20161201175550_create_spree_orders_promotions.spree.rb create mode 100644 db/migrate/20161201175551_unique_shipping_method_categories.spree.rb create mode 100644 db/migrate/20161201175552_add_item_count_to_spree_orders.spree.rb create mode 100644 db/migrate/20161201175553_remove_value_type_from_spree_preferences.spree.rb create mode 100644 db/migrate/20161201175554_rename_permalink_to_slug_for_products.spree.rb create mode 100644 db/migrate/20161201175555_add_index_to_variant_id_and_currency_on_prices.spree.rb create mode 100644 db/migrate/20161201175556_rename_activator_id_in_rules_and_actions_to_promotion_id.spree.rb create mode 100644 db/migrate/20161201175557_add_deleted_at_to_spree_prices.spree.rb create mode 100644 db/migrate/20161201175558_add_approver_id_and_approved_at_to_orders.spree.rb create mode 100644 db/migrate/20161201175559_add_confirmation_delivered_to_spree_orders.spree.rb create mode 100644 db/migrate/20161201175560_add_auto_capture_to_payment_methods.spree.rb create mode 100644 db/migrate/20161201175561_create_spree_payment_capture_events.spree.rb create mode 100644 db/migrate/20161201175562_add_uncaptured_amount_to_payments.spree.rb create mode 100644 db/migrate/20161201175563_default_variant_weight_to_zero.spree.rb create mode 100644 db/migrate/20161201175564_add_tax_category_id_to_shipping_methods.spree.rb create mode 100644 db/migrate/20161201175565_add_tax_rate_id_to_shipping_rates.spree.rb create mode 100644 db/migrate/20161201175566_add_pre_tax_amount_to_line_items_and_shipments.spree.rb create mode 100644 db/migrate/20161201175567_add_more_indexes.spree.rb create mode 100644 db/migrate/20161201175568_add_considered_risky_to_orders.spree.rb create mode 100644 db/migrate/20161201175569_add_preference_store_to_everything.spree.rb create mode 100644 db/migrate/20161201175570_add_user_id_to_spree_credit_cards.spree.rb create mode 100644 db/migrate/20161201175571_migrate_old_preferences.spree.rb create mode 100644 db/migrate/20161201175572_create_spree_stores.spree.rb create mode 100644 db/migrate/20161201175573_create_store_from_preferences.spree.rb create mode 100644 db/migrate/20161201175574_add_timestamps_to_spree_assets.spree.rb create mode 100644 db/migrate/20161201175575_create_spree_taxons_promotion_rules.spree.rb create mode 100644 db/migrate/20161201175576_add_additional_store_fields.spree.rb create mode 100644 db/migrate/20161201175577_add_many_missing_indexes.spree.rb create mode 100644 db/migrate/20161201175578_correct_some_polymorphic_index_and_add_more_missing.spree.rb create mode 100644 db/migrate/20161201175579_add_user_id_created_by_id_index_to_order.spree.rb create mode 100644 db/migrate/20161201175580_change_spree_price_amount_precision.spree.rb create mode 100644 db/migrate/20161201175581_add_token_to_spree_orders.spree.rb create mode 100644 db/migrate/20161201175582_move_order_token_from_tokenized_permission.spree.rb create mode 100644 db/migrate/20161201175583_set_shipment_total_for_users_upgrading.spree.rb create mode 100644 db/migrate/20161201175584_drop_credit_card_first_name_and_last_name.spree.rb create mode 100644 db/migrate/20161201175585_add_deleted_at_to_spree_promotion_actions.spree.rb create mode 100644 db/migrate/20161201175586_remove_uncaptured_amount_from_spree_payments.spree.rb create mode 100644 db/migrate/20161201175587_create_spree_refunds.spree.rb create mode 100644 db/migrate/20161201175588_create_spree_return_authorization_inventory_unit.spree.rb create mode 100644 db/migrate/20161201175589_rename_return_authorization_inventory_unit_to_return_items.spree.rb create mode 100644 db/migrate/20161201175590_backfill_line_item_pre_tax_amount.spree.rb create mode 100644 db/migrate/20161201175591_recreate_spree_return_authorizations.spree.rb create mode 100644 db/migrate/20161201175592_add_amount_fields_to_return_items.spree.rb create mode 100644 db/migrate/20161201175593_drop_return_authorization_amount.spree.rb create mode 100644 db/migrate/20161201175594_create_spree_return_authorization_reasons.spree.rb create mode 100644 db/migrate/20161201175595_create_spree_refund_reasons.spree.rb create mode 100644 db/migrate/20161201175596_rename_return_authorization_reason.spree.rb create mode 100644 db/migrate/20161201175597_create_spree_promotion_categories.spree.rb create mode 100644 db/migrate/20161201175598_drop_received_at_on_return_items.spree.rb create mode 100644 db/migrate/20161201175599_add_reception_and_acceptance_status_to_return_items.spree.rb create mode 100644 db/migrate/20161201175600_create_default_refund_reason.spree.rb create mode 100644 db/migrate/20161201175601_add_default_to_spree_stock_locations.spree.rb create mode 100644 db/migrate/20161201175602_create_spree_customer_returns.spree.rb create mode 100644 db/migrate/20161201175603_add_customer_return_id_to_return_item.spree.rb create mode 100644 db/migrate/20161201175604_create_friendly_id_slugs.spree.rb create mode 100644 db/migrate/20161201175605_rename_spree_refund_return_authorization_id.spree.rb create mode 100644 db/migrate/20161201175606_increase_return_item_pre_tax_amount_precision.spree.rb create mode 100644 db/migrate/20161201175607_copy_product_slugs_to_slug_history.spree.rb create mode 100644 db/migrate/20161201175608_create_spree_reimbursements.spree.rb create mode 100644 db/migrate/20161201175609_add_promotionable_to_spree_products.spree.rb create mode 100644 db/migrate/20161201175610_add_exchange_inventory_unit_foreign_keys.spree.rb create mode 100644 db/migrate/20161201175611_add_acceptance_status_errors_to_return_item.spree.rb create mode 100644 db/migrate/20161201175612_create_spree_reimbursement_types.spree.rb create mode 100644 db/migrate/20161201175613_add_default_to_shipment_cost.spree.rb create mode 100644 db/migrate/20161201175614_add_default_to_spree_credit_cards.spree.rb create mode 100644 db/migrate/20161201175615_make_existing_credit_cards_default.spree.rb create mode 100644 db/migrate/20161201175616_add_type_to_reimbursement_type.spree.rb create mode 100644 db/migrate/20161201175617_create_spree_reimbursement_credits.spree.rb create mode 100644 db/migrate/20161201175618_add_meta_title_to_spree_products.spree.rb create mode 100644 db/migrate/20161201175619_add_kind_to_zone.spree.rb create mode 100644 db/migrate/20161201175620_add_code_to_spree_tax_categories.spree.rb create mode 100644 db/migrate/20161201175621_default_pre_tax_amount_should_be_zero.spree.rb create mode 100644 db/migrate/20161201175622_add_code_to_spree_shipping_methods.spree.rb create mode 100644 db/migrate/20161201175623_add_cancel_audit_fields_to_spree_orders.spree.rb create mode 100644 db/migrate/20161201175624_add_store_id_to_orders.spree.rb create mode 100644 db/migrate/20161201175625_create_spree_taxons_prototypes.spree.rb create mode 100644 db/migrate/20161201175626_add_state_lock_version_to_order.spree.rb create mode 100644 db/migrate/20161201175627_add_counter_cache_from_spree_variants_to_spree_stock_items.spree.rb create mode 100644 db/migrate/20161201175628_fix_adjustment_order_presence.spree.rb create mode 100644 db/migrate/20161201175629_update_classifications_positions.spree.rb create mode 100644 db/migrate/20161201175630_add_guest_token_index_to_spree_orders.spree.rb create mode 100644 db/migrate/20161201175631_remove_token_permissions_table.spree.rb create mode 100644 db/migrate/20161201175632_remove_extra_products_slug_index.spree.rb create mode 100644 db/migrate/20161201175633_update_product_slug_index.spree.rb create mode 100644 db/migrate/20161201175634_rename_identifier_to_number_for_payment.spree.rb create mode 100644 db/migrate/20161201175635_create_spree_store_credits.spree.rb create mode 100644 db/migrate/20161201175636_create_spree_store_credit_categories.spree.rb create mode 100644 db/migrate/20161201175637_create_spree_store_credit_events.spree.rb create mode 100644 db/migrate/20161201175638_create_spree_store_credit_types.spree.rb create mode 100644 db/migrate/20161201175639_remove_environment_from_payment_method.spree.rb create mode 100644 db/migrate/20161201175640_add_resellable_to_return_items.spree.rb create mode 100644 db/migrate/20161201175641_add_code_to_spree_promotion_categories.spree.rb create mode 100644 db/migrate/20161201175642_remove_environment_from_tracker.spree.rb create mode 100644 db/migrate/20161201175643_remove_spree_configurations.spree.rb create mode 100644 db/migrate/20161201175644_add_index_to_spree_stock_items_variant_id.spree.rb create mode 100644 db/migrate/20161201175645_ensure_payments_have_numbers.spree.rb create mode 100644 db/migrate/20161201175646_add_missing_indexes_on_spree_tables.spree.rb create mode 100644 db/migrate/20161201175647_remove_duplicated_indexes_from_multi_columns.spree.rb create mode 100644 db/migrate/20161201175648_remove_user_index_from_spree_state_changes.spree.rb create mode 100644 db/migrate/20161201175649_fix_adjustment_order_id.spree.rb create mode 100644 db/migrate/20161201175650_add_position_to_spree_payment_methods.spree.rb create mode 100644 db/migrate/20161201175651_add_deleted_at_to_friendly_id_slugs.spree.rb create mode 100644 db/migrate/20161201175652_increase_scale_on_pre_tax_amounts.spree.rb create mode 100644 db/migrate/20161201175653_add_taxable_adjustment_total_to_line_item.spree.rb create mode 100644 db/migrate/20161201175654_migrate_payment_methods_display.spree.rb create mode 100644 db/migrate/20161201175655_enable_acts_as_paranoid_on_calculators.spree.rb create mode 100644 db/migrate/20161201175656_spree_payment_method_store_credits.spree.rb create mode 100644 db/migrate/20161201175657_rename_has_and_belongs_to_associations_to_model_names.spree.rb create mode 100644 db/migrate/20161201175658_spree_store_credit_types.spree.rb create mode 100644 db/migrate/20161201175659_add_discontinued_to_products_and_variants.spree.rb create mode 100644 db/migrate/20161201175660_remove_shipping_method_id_from_spree_orders.spree.rb create mode 100644 db/migrate/20161201175661_add_id_column_to_earlier_habtm_tables.spree.rb create mode 100644 db/migrate/20161201175662_add_indexes.spree.rb create mode 100644 db/migrate/20161201175663_add_api_key_to_spree_users.spree_api.rb create mode 100644 db/migrate/20161201175664_resize_api_key_field.spree_api.rb create mode 100644 db/migrate/20161201175665_rename_api_key_to_spree_api_key.spree_api.rb create mode 100644 db/migrate/20161201175666_add_index_to_user_spree_api_key.spree_api.rb create mode 100644 db/migrate/20161201175667_create_users.spree_auth.rb create mode 100644 db/migrate/20161201175668_rename_columns_for_devise.spree_auth.rb create mode 100644 db/migrate/20161201175669_convert_user_remember_field.spree_auth.rb create mode 100644 db/migrate/20161201175670_add_reset_password_sent_at_to_spree_users.spree_auth.rb create mode 100644 db/migrate/20161201175671_make_users_email_index_unique.spree_auth.rb create mode 100644 db/migrate/20161201175672_add_deleted_at_to_users.spree_auth.rb create mode 100644 db/migrate/20161201175673_add_confirmable_to_users.spree_auth.rb create mode 100644 db/migrate/20161201175674_add_missing_indices_on_user.spree_auth.rb create mode 100644 db/migrate/20161201175675_create_skrill_transactions.spree_gateway.rb create mode 100644 db/migrate/20161201175676_update_braintree_payment_method_type.spree_gateway.rb create mode 100644 db/migrate/20161201175677_update_stripe_payment_method_type.spree_gateway.rb create mode 100644 db/migrate/20161201175678_update_balanced_payment_method_type.spree_gateway.rb create mode 100644 db/migrate/20161201175679_update_paypal_payment_method_type.spree_gateway.rb create mode 100644 db/migrate/20161201175680_migrate_stripe_preferences.spree_gateway.rb create mode 100644 db/schema.rb create mode 100644 db/seeds.rb create mode 100644 lib/assets/.keep create mode 100644 lib/tasks/.keep create mode 100644 log/.keep create mode 100644 public/404.html create mode 100644 public/422.html create mode 100644 public/500.html create mode 100644 public/favicon.ico create mode 100644 public/robots.txt create mode 100644 vendor/assets/javascripts/.keep create mode 100644 vendor/assets/javascripts/spree/backend/all.js create mode 100644 vendor/assets/javascripts/spree/frontend/all.js create mode 100644 vendor/assets/stylesheets/.keep create mode 100644 vendor/assets/stylesheets/spree/backend/all.css create mode 100644 vendor/assets/stylesheets/spree/frontend/all.css diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..8483561 --- /dev/null +++ b/.gitignore @@ -0,0 +1,18 @@ +# See https://help.github.com/articles/ignoring-files for more about ignoring files. +# +# If you find yourself ignoring temporary files generated by your text editor +# or operating system, you probably want to add a global ignore instead: +# git config --global core.excludesfile '~/.gitignore_global' + +# Ignore bundler config. +/.bundle + +# Ignore the default SQLite database. +/db/*.sqlite3 +/db/*.sqlite3-journal + +# Ignore all logfiles and tempfiles. +/log/* +!/log/.keep +/tmp +/public/spree/ \ No newline at end of file diff --git a/Gemfile b/Gemfile new file mode 100644 index 0000000..8c08574 --- /dev/null +++ b/Gemfile @@ -0,0 +1,52 @@ +source 'https://rubygems.org' + + +# Bundle edge Rails instead: gem 'rails', github: 'rails/rails' +gem 'rails', '4.2.6' +# Use SCSS for stylesheets +gem 'sass-rails', '~> 5.0' +# Use Uglifier as compressor for JavaScript assets +gem 'uglifier', '>= 1.3.0' +# Use CoffeeScript for .coffee assets and views +gem 'coffee-rails', '~> 4.1.0' +# See https://github.com/rails/execjs#readme for more supported runtimes +# gem 'therubyracer', platforms: :ruby + +# Use jquery as the JavaScript library +gem 'jquery-rails' +# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks +gem 'turbolinks' +# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder +gem 'jbuilder', '~> 2.0' +# bundle exec rake doc:rails generates the API under doc/api. +gem 'sdoc', '~> 0.4.0', group: :doc +gem 'spree', '~> 3.1.0' +gem 'spree_auth_devise', '~> 3.1.0' +gem 'spree_gateway', '~> 3.1.0' +# Use ActiveModel has_secure_password +# gem 'bcrypt', '~> 3.1.7' + +# Use Unicorn as the app server +# gem 'unicorn' + +# Use Capistrano for deployment +# gem 'capistrano-rails', group: :development + +group :development, :test do + # Call 'byebug' anywhere in the code to stop execution and get a debugger console + gem 'byebug' + # Use sqlite3 as the database for Active Record + gem 'sqlite3' +end + +group :development do + # Access an IRB console on exception pages or by using <%= console %> in views + gem 'web-console', '~> 2.0' + + # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring + gem 'spring' +end + +group :production do + gem 'pg' +end diff --git a/Gemfile.lock b/Gemfile.lock new file mode 100644 index 0000000..945fa61 --- /dev/null +++ b/Gemfile.lock @@ -0,0 +1,339 @@ +GEM + remote: https://rubygems.org/ + specs: + actionmailer (4.2.6) + actionpack (= 4.2.6) + actionview (= 4.2.6) + activejob (= 4.2.6) + mail (~> 2.5, >= 2.5.4) + rails-dom-testing (~> 1.0, >= 1.0.5) + actionpack (4.2.6) + actionview (= 4.2.6) + activesupport (= 4.2.6) + rack (~> 1.6) + rack-test (~> 0.6.2) + rails-dom-testing (~> 1.0, >= 1.0.5) + rails-html-sanitizer (~> 1.0, >= 1.0.2) + actionview (4.2.6) + activesupport (= 4.2.6) + builder (~> 3.1) + erubis (~> 2.7.0) + rails-dom-testing (~> 1.0, >= 1.0.5) + rails-html-sanitizer (~> 1.0, >= 1.0.2) + activejob (4.2.6) + activesupport (= 4.2.6) + globalid (>= 0.3.0) + activemerchant (1.61.0) + activesupport (>= 3.2.14, < 5.1) + builder (>= 2.1.2, < 4.0.0) + i18n (>= 0.6.9) + nokogiri (~> 1.4) + activemodel (4.2.6) + activesupport (= 4.2.6) + builder (~> 3.1) + activerecord (4.2.6) + activemodel (= 4.2.6) + activesupport (= 4.2.6) + arel (~> 6.0) + activesupport (4.2.6) + i18n (~> 0.7) + json (~> 1.7, >= 1.7.7) + minitest (~> 5.1) + thread_safe (~> 0.3, >= 0.3.4) + tzinfo (~> 1.1) + acts_as_list (0.7.2) + activerecord (>= 3.0) + addressable (2.5.0) + public_suffix (~> 2.0, >= 2.0.2) + arel (6.0.3) + autoprefixer-rails (6.5.3) + execjs + awesome_nested_set (3.0.3) + activerecord (>= 4.0.0, < 5) + bcrypt (3.1.11) + binding_of_caller (0.7.2) + debug_inspector (>= 0.0.1) + bootstrap-sass (3.3.7) + autoprefixer-rails (>= 5.2.1) + sass (>= 3.3.4) + builder (3.2.2) + byebug (9.0.6) + camertron-eprun (1.1.1) + cancancan (1.10.1) + canonical-rails (0.0.11) + rails (>= 3.1, < 5.0) + carmen (1.0.2) + activesupport (>= 3.0.0) + cldr-plurals-runtime-rb (1.0.1) + climate_control (0.0.3) + activesupport (>= 3.0) + cocaine (0.5.8) + climate_control (>= 0.0.3, < 1.0) + coffee-rails (4.1.1) + coffee-script (>= 2.2.0) + railties (>= 4.0.0, < 5.1.x) + coffee-script (2.4.1) + coffee-script-source + execjs + coffee-script-source (1.11.1) + colorize (0.8.1) + concurrent-ruby (1.0.2) + css_parser (1.4.7) + addressable + debug_inspector (0.0.2) + deface (1.0.2) + colorize (>= 0.5.8) + nokogiri (~> 1.6.0) + polyglot + rails (>= 3.1) + devise (3.5.10) + bcrypt (~> 3.0) + orm_adapter (~> 0.1) + railties (>= 3.2.6, < 5) + responders + thread_safe (~> 0.1) + warden (~> 1.2.3) + devise-encryptable (0.1.2) + devise (>= 2.1.0) + erubis (2.7.0) + execjs (2.7.0) + ffaker (2.2.0) + font-awesome-rails (4.7.0.0) + railties (>= 3.2, < 5.1) + friendly_id (5.1.0) + activerecord (>= 4.0.0) + globalid (0.3.7) + activesupport (>= 4.1.0) + highline (1.6.21) + htmlentities (4.3.4) + i18n (0.7.0) + jbuilder (2.6.1) + activesupport (>= 3.0.0, < 5.1) + multi_json (~> 1.2) + jquery-rails (4.2.1) + rails-dom-testing (>= 1, < 3) + railties (>= 4.2.0) + thor (>= 0.14, < 2.0) + jquery-ui-rails (5.0.5) + railties (>= 3.2.16) + json (1.8.3) + kaminari (0.17.0) + actionpack (>= 3.0.0) + activesupport (>= 3.0.0) + loofah (2.0.3) + nokogiri (>= 1.5.9) + mail (2.6.4) + mime-types (>= 1.16, < 4) + mime-types (3.1) + mime-types-data (~> 3.2015) + mime-types-data (3.2016.0521) + mimemagic (0.3.0) + mini_portile2 (2.1.0) + minitest (5.10.0) + monetize (1.4.0) + money (~> 6.7) + money (6.7.1) + i18n (>= 0.6.4, <= 0.7.0) + sixarm_ruby_unaccent (>= 1.1.1, < 2) + multi_json (1.12.1) + nokogiri (1.6.8.1) + mini_portile2 (~> 2.1.0) + orm_adapter (0.5.0) + paperclip (4.3.7) + activemodel (>= 3.2.0) + activesupport (>= 3.2.0) + cocaine (~> 0.5.5) + mime-types + mimemagic (= 0.3.0) + paranoia (2.1.5) + activerecord (~> 4.0) + pg (0.19.0) + polyamorous (1.3.1) + activerecord (>= 3.0) + polyglot (0.3.5) + premailer (1.8.7) + css_parser (>= 1.4.5) + htmlentities (>= 4.0.0) + premailer-rails (1.9.4) + actionmailer (>= 3, < 6) + premailer (~> 1.7, >= 1.7.9) + public_suffix (2.0.4) + rabl (0.12.0) + activesupport (>= 2.3.14) + rack (1.6.5) + rack-test (0.6.3) + rack (>= 1.0) + rails (4.2.6) + actionmailer (= 4.2.6) + actionpack (= 4.2.6) + actionview (= 4.2.6) + activejob (= 4.2.6) + activemodel (= 4.2.6) + activerecord (= 4.2.6) + activesupport (= 4.2.6) + bundler (>= 1.3.0, < 2.0) + railties (= 4.2.6) + sprockets-rails + rails-deprecated_sanitizer (1.0.3) + activesupport (>= 4.2.0.alpha) + rails-dom-testing (1.0.7) + activesupport (>= 4.2.0.beta, < 5.0) + nokogiri (~> 1.6.0) + rails-deprecated_sanitizer (>= 1.0.1) + rails-html-sanitizer (1.0.3) + loofah (~> 2.0) + railties (4.2.6) + actionpack (= 4.2.6) + activesupport (= 4.2.6) + rake (>= 0.8.7) + thor (>= 0.18.1, < 2.0) + rake (11.3.0) + ransack (1.4.1) + actionpack (>= 3.0) + activerecord (>= 3.0) + activesupport (>= 3.0) + i18n + polyamorous (~> 1.1) + rdoc (4.3.0) + responders (2.3.0) + railties (>= 4.2.0, < 5.1) + sass (3.4.22) + sass-rails (5.0.6) + railties (>= 4.0.0, < 6) + sass (~> 3.1) + sprockets (>= 2.8, < 4.0) + sprockets-rails (>= 2.0, < 4.0) + tilt (>= 1.1, < 3) + sdoc (0.4.2) + json (~> 1.7, >= 1.7.7) + rdoc (~> 4.0) + select2-rails (3.5.9.1) + thor (~> 0.14) + sixarm_ruby_unaccent (1.1.1) + spree (3.1.3) + spree_api (= 3.1.3) + spree_backend (= 3.1.3) + spree_cmd (= 3.1.3) + spree_core (= 3.1.3) + spree_frontend (= 3.1.3) + spree_sample (= 3.1.3) + spree_api (3.1.3) + rabl (~> 0.12.0) + spree_core (= 3.1.3) + versioncake (~> 2.3.1) + spree_auth_devise (3.1.0) + devise (~> 3.5.4) + devise-encryptable (= 0.1.2) + spree_core (~> 3.1.0.beta) + spree_backend (3.1.3) + bootstrap-sass (~> 3.3) + jquery-rails (~> 4.1) + jquery-ui-rails (~> 5.0) + select2-rails (= 3.5.9.1) + spree_api (= 3.1.3) + spree_core (= 3.1.3) + spree_cmd (3.1.3) + thor (~> 0.14) + spree_core (3.1.3) + activemerchant (~> 1.59) + acts_as_list (= 0.7.2) + awesome_nested_set (~> 3.0.1) + cancancan (~> 1.10.1) + carmen (~> 1.0.0) + deface (~> 1.0.0) + ffaker (~> 2.2.0) + font-awesome-rails (~> 4.0) + friendly_id (~> 5.1.0) + highline (~> 1.6.18) + kaminari (~> 0.17) + monetize (~> 1.1) + paperclip (~> 4.3.0) + paranoia (~> 2.1.0) + premailer-rails + rails (~> 4.2.5) + ransack (~> 1.4.1) + responders + sprockets-rails + state_machines-activerecord (~> 0.2) + stringex + truncate_html (~> 0.9.3) + twitter_cldr (~> 3.0) + spree_frontend (3.1.3) + bootstrap-sass (>= 3.3.5.1, < 3.4) + canonical-rails (~> 0.0.4) + jquery-rails (~> 4.1) + spree_api (= 3.1.3) + spree_core (= 3.1.3) + spree_gateway (3.1.0) + spree_core (~> 3.1.0.beta) + spree_sample (3.1.3) + spree_core (= 3.1.3) + spring (2.0.0) + activesupport (>= 4.2) + sprockets (3.7.0) + concurrent-ruby (~> 1.0) + rack (> 1, < 3) + sprockets-rails (3.2.0) + actionpack (>= 4.0) + activesupport (>= 4.0) + sprockets (>= 3.0.0) + sqlite3 (1.3.12) + state_machines (0.4.0) + state_machines-activemodel (0.4.0) + activemodel (>= 4.1, < 5.1) + state_machines (>= 0.4.0) + state_machines-activerecord (0.4.0) + activerecord (>= 4.1, < 5.1) + state_machines-activemodel (>= 0.3.0) + stringex (2.6.1) + thor (0.19.4) + thread_safe (0.3.5) + tilt (2.0.5) + truncate_html (0.9.3) + turbolinks (5.0.1) + turbolinks-source (~> 5) + turbolinks-source (5.0.0) + twitter_cldr (3.6.0) + camertron-eprun + cldr-plurals-runtime-rb (~> 1.0) + tzinfo + tzinfo (1.2.2) + thread_safe (~> 0.1) + uglifier (3.0.4) + execjs (>= 0.3.0, < 3) + versioncake (2.3.1) + actionpack (>= 3.2) + activesupport (>= 3.2) + railties (>= 3.2) + tzinfo + warden (1.2.6) + rack (>= 1.0) + web-console (2.3.0) + activemodel (>= 4.0) + binding_of_caller (>= 0.7.2) + railties (>= 4.0) + sprockets-rails (>= 2.0, < 4.0) + +PLATFORMS + ruby + +DEPENDENCIES + byebug + coffee-rails (~> 4.1.0) + jbuilder (~> 2.0) + jquery-rails + pg + rails (= 4.2.6) + sass-rails (~> 5.0) + sdoc (~> 0.4.0) + spree (~> 3.1.0) + spree_auth_devise (~> 3.1.0) + spree_gateway (~> 3.1.0) + spring + sqlite3 + turbolinks + uglifier (>= 1.3.0) + web-console (~> 2.0) + +BUNDLED WITH + 1.13.6 diff --git a/README.md b/README.md new file mode 100644 index 0000000..dd4e97e --- /dev/null +++ b/README.md @@ -0,0 +1,28 @@ +== README + +This README would normally document whatever steps are necessary to get the +application up and running. + +Things you may want to cover: + +* Ruby version + +* System dependencies + +* Configuration + +* Database creation + +* Database initialization + +* How to run the test suite + +* Services (job queues, cache servers, search engines, etc.) + +* Deployment instructions + +* ... + + +Please feel free to use a different markup language if you do not plan to run +rake doc:app. diff --git a/Rakefile b/Rakefile new file mode 100644 index 0000000..ba6b733 --- /dev/null +++ b/Rakefile @@ -0,0 +1,6 @@ +# Add your own tasks in files placed in lib/tasks ending in .rake, +# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake. + +require File.expand_path('../config/application', __FILE__) + +Rails.application.load_tasks diff --git a/app/assets/images/.keep b/app/assets/images/.keep new file mode 100644 index 0000000..e69de29 diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js new file mode 100644 index 0000000..e07c5a8 --- /dev/null +++ b/app/assets/javascripts/application.js @@ -0,0 +1,16 @@ +// This is a manifest file that'll be compiled into application.js, which will include all the files +// listed below. +// +// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts, +// or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path. +// +// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the +// compiled file. +// +// Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details +// about supported directives. +// +//= require jquery +//= require jquery_ujs +//= require turbolinks +//= require_tree . diff --git a/app/assets/stylesheets/application.css b/app/assets/stylesheets/application.css new file mode 100644 index 0000000..f9cd5b3 --- /dev/null +++ b/app/assets/stylesheets/application.css @@ -0,0 +1,15 @@ +/* + * This is a manifest file that'll be compiled into application.css, which will include all the files + * listed below. + * + * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets, + * or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path. + * + * You're free to add application-wide styles to this file and they'll appear at the bottom of the + * compiled file so the styles you add here take precedence over styles defined in any styles + * defined in the other CSS/SCSS files in this directory. It is generally better to create a new + * file per style scope. + * + *= require_tree . + *= require_self + */ diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb new file mode 100644 index 0000000..d83690e --- /dev/null +++ b/app/controllers/application_controller.rb @@ -0,0 +1,5 @@ +class ApplicationController < ActionController::Base + # Prevent CSRF attacks by raising an exception. + # For APIs, you may want to use :null_session instead. + protect_from_forgery with: :exception +end diff --git a/app/controllers/concerns/.keep b/app/controllers/concerns/.keep new file mode 100644 index 0000000..e69de29 diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb new file mode 100644 index 0000000..de6be79 --- /dev/null +++ b/app/helpers/application_helper.rb @@ -0,0 +1,2 @@ +module ApplicationHelper +end diff --git a/app/mailers/.keep b/app/mailers/.keep new file mode 100644 index 0000000..e69de29 diff --git a/app/models/.keep b/app/models/.keep new file mode 100644 index 0000000..e69de29 diff --git a/app/models/concerns/.keep b/app/models/concerns/.keep new file mode 100644 index 0000000..e69de29 diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb new file mode 100644 index 0000000..890ced6 --- /dev/null +++ b/app/views/layouts/application.html.erb @@ -0,0 +1,14 @@ + + + + Spreecommercedemo + <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %> + <%= javascript_include_tag 'application', 'data-turbolinks-track' => true %> + <%= csrf_meta_tags %> + + + +<%= yield %> + + + diff --git a/bin/bundle b/bin/bundle new file mode 100755 index 0000000..66e9889 --- /dev/null +++ b/bin/bundle @@ -0,0 +1,3 @@ +#!/usr/bin/env ruby +ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__) +load Gem.bin_path('bundler', 'bundle') diff --git a/bin/rails b/bin/rails new file mode 100755 index 0000000..5191e69 --- /dev/null +++ b/bin/rails @@ -0,0 +1,4 @@ +#!/usr/bin/env ruby +APP_PATH = File.expand_path('../../config/application', __FILE__) +require_relative '../config/boot' +require 'rails/commands' diff --git a/bin/rake b/bin/rake new file mode 100755 index 0000000..1724048 --- /dev/null +++ b/bin/rake @@ -0,0 +1,4 @@ +#!/usr/bin/env ruby +require_relative '../config/boot' +require 'rake' +Rake.application.run diff --git a/bin/setup b/bin/setup new file mode 100755 index 0000000..acdb2c1 --- /dev/null +++ b/bin/setup @@ -0,0 +1,29 @@ +#!/usr/bin/env ruby +require 'pathname' + +# path to your application root. +APP_ROOT = Pathname.new File.expand_path('../../', __FILE__) + +Dir.chdir APP_ROOT do + # This script is a starting point to setup your application. + # Add necessary setup steps to this file: + + puts "== Installing dependencies ==" + system "gem install bundler --conservative" + system "bundle check || bundle install" + + # puts "\n== Copying sample files ==" + # unless File.exist?("config/database.yml") + # system "cp config/database.yml.sample config/database.yml" + # end + + puts "\n== Preparing database ==" + system "bin/rake db:setup" + + puts "\n== Removing old logs and tempfiles ==" + system "rm -f log/*" + system "rm -rf tmp/cache" + + puts "\n== Restarting application server ==" + system "touch tmp/restart.txt" +end diff --git a/config.ru b/config.ru new file mode 100644 index 0000000..bd83b25 --- /dev/null +++ b/config.ru @@ -0,0 +1,4 @@ +# This file is used by Rack-based servers to start the application. + +require ::File.expand_path('../config/environment', __FILE__) +run Rails.application diff --git a/config/application.rb b/config/application.rb new file mode 100644 index 0000000..be5913d --- /dev/null +++ b/config/application.rb @@ -0,0 +1,39 @@ +require File.expand_path('../boot', __FILE__) + +require 'rails/all' + +# Require the gems listed in Gemfile, including any gems +# you've limited to :test, :development, or :production. +Bundler.require(*Rails.groups) + +module Spreecommercedemo + class Application < Rails::Application + + config.to_prepare do + # Load application's model / class decorators + Dir.glob(File.join(File.dirname(__FILE__), "../app/**/*_decorator*.rb")) do |c| + Rails.configuration.cache_classes ? require(c) : load(c) + end + + # Load application's view overrides + Dir.glob(File.join(File.dirname(__FILE__), "../app/overrides/*.rb")) do |c| + Rails.configuration.cache_classes ? require(c) : load(c) + end + end + + # Settings in config/environments/* take precedence over those specified here. + # Application configuration should go into files in config/initializers + # -- all .rb files in that directory are automatically loaded. + + # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone. + # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC. + # config.time_zone = 'Central Time (US & Canada)' + + # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded. + # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s] + # config.i18n.default_locale = :de + + # Do not swallow errors in after_commit/after_rollback callbacks. + config.active_record.raise_in_transactional_callbacks = true + end +end diff --git a/config/boot.rb b/config/boot.rb new file mode 100644 index 0000000..6b750f0 --- /dev/null +++ b/config/boot.rb @@ -0,0 +1,3 @@ +ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__) + +require 'bundler/setup' # Set up gems listed in the Gemfile. diff --git a/config/database.yml b/config/database.yml new file mode 100644 index 0000000..1c1a37c --- /dev/null +++ b/config/database.yml @@ -0,0 +1,25 @@ +# SQLite version 3.x +# gem install sqlite3 +# +# Ensure the SQLite 3 gem is defined in your Gemfile +# gem 'sqlite3' +# +default: &default + adapter: sqlite3 + pool: 5 + timeout: 5000 + +development: + <<: *default + database: db/development.sqlite3 + +# Warning: The database defined as "test" will be erased and +# re-generated from your development database when you run "rake". +# Do not set this db to the same as development or production. +test: + <<: *default + database: db/test.sqlite3 + +production: + <<: *default + database: db/production.sqlite3 diff --git a/config/environment.rb b/config/environment.rb new file mode 100644 index 0000000..ee8d90d --- /dev/null +++ b/config/environment.rb @@ -0,0 +1,5 @@ +# Load the Rails application. +require File.expand_path('../application', __FILE__) + +# Initialize the Rails application. +Rails.application.initialize! diff --git a/config/environments/development.rb b/config/environments/development.rb new file mode 100644 index 0000000..b55e214 --- /dev/null +++ b/config/environments/development.rb @@ -0,0 +1,41 @@ +Rails.application.configure do + # Settings specified here will take precedence over those in config/application.rb. + + # In the development environment your application's code is reloaded on + # every request. This slows down response time but is perfect for development + # since you don't have to restart the web server when you make code changes. + config.cache_classes = false + + # Do not eager load code on boot. + config.eager_load = false + + # Show full error reports and disable caching. + config.consider_all_requests_local = true + config.action_controller.perform_caching = false + + # Don't care if the mailer can't send. + config.action_mailer.raise_delivery_errors = false + + # Print deprecation notices to the Rails logger. + config.active_support.deprecation = :log + + # Raise an error on page load if there are pending migrations. + config.active_record.migration_error = :page_load + + # Debug mode disables concatenation and preprocessing of assets. + # This option may cause significant delays in view rendering with a large + # number of complex assets. + config.assets.debug = true + + # Asset digests allow you to set far-future HTTP expiration dates on all assets, + # yet still be able to expire them through the digest params. + config.assets.digest = true + + # Adds additional error checking when serving assets at runtime. + # Checks for improperly declared sprockets dependencies. + # Raises helpful error messages. + config.assets.raise_runtime_errors = true + + # Raises error for missing translations + # config.action_view.raise_on_missing_translations = true +end diff --git a/config/environments/production.rb b/config/environments/production.rb new file mode 100644 index 0000000..10a93dd --- /dev/null +++ b/config/environments/production.rb @@ -0,0 +1,79 @@ +Rails.application.configure do + # Settings specified here will take precedence over those in config/application.rb. + + # Code is not reloaded between requests. + config.cache_classes = true + + # Eager load code on boot. This eager loads most of Rails and + # your application in memory, allowing both threaded web servers + # and those relying on copy on write to perform better. + # Rake tasks automatically ignore this option for performance. + config.eager_load = true + + # Full error reports are disabled and caching is turned on. + config.consider_all_requests_local = false + config.action_controller.perform_caching = true + + # Enable Rack::Cache to put a simple HTTP cache in front of your application + # Add `rack-cache` to your Gemfile before enabling this. + # For large-scale production use, consider using a caching reverse proxy like + # NGINX, varnish or squid. + # config.action_dispatch.rack_cache = true + + # Disable serving static files from the `/public` folder by default since + # Apache or NGINX already handles this. + config.serve_static_files = ENV['RAILS_SERVE_STATIC_FILES'].present? + + # Compress JavaScripts and CSS. + config.assets.js_compressor = :uglifier + # config.assets.css_compressor = :sass + + # Do not fallback to assets pipeline if a precompiled asset is missed. + config.assets.compile = true + + # Asset digests allow you to set far-future HTTP expiration dates on all assets, + # yet still be able to expire them through the digest params. + config.assets.digest = true + + # `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb + + # Specifies the header that your server uses for sending files. + # config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache + # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX + + # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies. + # config.force_ssl = true + + # Use the lowest log level to ensure availability of diagnostic information + # when problems arise. + config.log_level = :debug + + # Prepend all log lines with the following tags. + # config.log_tags = [ :subdomain, :uuid ] + + # Use a different logger for distributed setups. + # config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new) + + # Use a different cache store in production. + # config.cache_store = :mem_cache_store + + # Enable serving of images, stylesheets, and JavaScripts from an asset server. + # config.action_controller.asset_host = 'http://assets.example.com' + + # Ignore bad email addresses and do not raise email delivery errors. + # Set this to true and configure the email server for immediate delivery to raise delivery errors. + # config.action_mailer.raise_delivery_errors = false + + # Enable locale fallbacks for I18n (makes lookups for any locale fall back to + # the I18n.default_locale when a translation cannot be found). + config.i18n.fallbacks = true + + # Send deprecation notices to registered listeners. + config.active_support.deprecation = :notify + + # Use default logging formatter so that PID and timestamp are not suppressed. + config.log_formatter = ::Logger::Formatter.new + + # Do not dump schema after migrations. + config.active_record.dump_schema_after_migration = false +end diff --git a/config/environments/test.rb b/config/environments/test.rb new file mode 100644 index 0000000..1c19f08 --- /dev/null +++ b/config/environments/test.rb @@ -0,0 +1,42 @@ +Rails.application.configure do + # Settings specified here will take precedence over those in config/application.rb. + + # The test environment is used exclusively to run your application's + # test suite. You never need to work with it otherwise. Remember that + # your test database is "scratch space" for the test suite and is wiped + # and recreated between test runs. Don't rely on the data there! + config.cache_classes = true + + # Do not eager load code on boot. This avoids loading your whole application + # just for the purpose of running a single test. If you are using a tool that + # preloads Rails for running tests, you may have to set it to true. + config.eager_load = false + + # Configure static file server for tests with Cache-Control for performance. + config.serve_static_files = true + config.static_cache_control = 'public, max-age=3600' + + # Show full error reports and disable caching. + config.consider_all_requests_local = true + config.action_controller.perform_caching = false + + # Raise exceptions instead of rendering exception templates. + config.action_dispatch.show_exceptions = false + + # Disable request forgery protection in test environment. + config.action_controller.allow_forgery_protection = false + + # Tell Action Mailer not to deliver emails to the real world. + # The :test delivery method accumulates sent emails in the + # ActionMailer::Base.deliveries array. + config.action_mailer.delivery_method = :test + + # Randomize the order test cases are executed. + config.active_support.test_order = :random + + # Print deprecation notices to the stderr. + config.active_support.deprecation = :stderr + + # Raises error for missing translations + # config.action_view.raise_on_missing_translations = true +end diff --git a/config/initializers/assets.rb b/config/initializers/assets.rb new file mode 100644 index 0000000..01ef3e6 --- /dev/null +++ b/config/initializers/assets.rb @@ -0,0 +1,11 @@ +# Be sure to restart your server when you modify this file. + +# Version of your assets, change this if you want to expire all your assets. +Rails.application.config.assets.version = '1.0' + +# Add additional assets to the asset load path +# Rails.application.config.assets.paths << Emoji.images_path + +# Precompile additional assets. +# application.js, application.css, and all non-JS/CSS in app/assets folder are already added. +# Rails.application.config.assets.precompile += %w( search.js ) diff --git a/config/initializers/backtrace_silencers.rb b/config/initializers/backtrace_silencers.rb new file mode 100644 index 0000000..59385cd --- /dev/null +++ b/config/initializers/backtrace_silencers.rb @@ -0,0 +1,7 @@ +# Be sure to restart your server when you modify this file. + +# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces. +# Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ } + +# You can also remove all the silencers if you're trying to debug a problem that might stem from framework code. +# Rails.backtrace_cleaner.remove_silencers! diff --git a/config/initializers/cookies_serializer.rb b/config/initializers/cookies_serializer.rb new file mode 100644 index 0000000..7f70458 --- /dev/null +++ b/config/initializers/cookies_serializer.rb @@ -0,0 +1,3 @@ +# Be sure to restart your server when you modify this file. + +Rails.application.config.action_dispatch.cookies_serializer = :json diff --git a/config/initializers/devise.rb b/config/initializers/devise.rb new file mode 100644 index 0000000..c1bd449 --- /dev/null +++ b/config/initializers/devise.rb @@ -0,0 +1 @@ +Devise.secret_key = "11c9d30aa1ebd16d66d91f68b41fd6ca4fb490b03e471a002d9a97499492f671c8d7665f44555f3113a46047eebb9ee89274" \ No newline at end of file diff --git a/config/initializers/filter_parameter_logging.rb b/config/initializers/filter_parameter_logging.rb new file mode 100644 index 0000000..4a994e1 --- /dev/null +++ b/config/initializers/filter_parameter_logging.rb @@ -0,0 +1,4 @@ +# Be sure to restart your server when you modify this file. + +# Configure sensitive parameters which will be filtered from the log file. +Rails.application.config.filter_parameters += [:password] diff --git a/config/initializers/inflections.rb b/config/initializers/inflections.rb new file mode 100644 index 0000000..ac033bf --- /dev/null +++ b/config/initializers/inflections.rb @@ -0,0 +1,16 @@ +# Be sure to restart your server when you modify this file. + +# Add new inflection rules using the following format. Inflections +# are locale specific, and you may define rules for as many different +# locales as you wish. All of these examples are active by default: +# ActiveSupport::Inflector.inflections(:en) do |inflect| +# inflect.plural /^(ox)$/i, '\1en' +# inflect.singular /^(ox)en/i, '\1' +# inflect.irregular 'person', 'people' +# inflect.uncountable %w( fish sheep ) +# end + +# These inflection rules are supported but not enabled by default: +# ActiveSupport::Inflector.inflections(:en) do |inflect| +# inflect.acronym 'RESTful' +# end diff --git a/config/initializers/mime_types.rb b/config/initializers/mime_types.rb new file mode 100644 index 0000000..dc18996 --- /dev/null +++ b/config/initializers/mime_types.rb @@ -0,0 +1,4 @@ +# Be sure to restart your server when you modify this file. + +# Add new mime types for use in respond_to blocks: +# Mime::Type.register "text/richtext", :rtf diff --git a/config/initializers/session_store.rb b/config/initializers/session_store.rb new file mode 100644 index 0000000..65ad48a --- /dev/null +++ b/config/initializers/session_store.rb @@ -0,0 +1,3 @@ +# Be sure to restart your server when you modify this file. + +Rails.application.config.session_store :cookie_store, key: '_spreecommercedemo_session' diff --git a/config/initializers/spree.rb b/config/initializers/spree.rb new file mode 100644 index 0000000..5cec07b --- /dev/null +++ b/config/initializers/spree.rb @@ -0,0 +1,18 @@ +# Configure Spree Preferences +# +# Note: Initializing preferences available within the Admin will overwrite any changes that were made through the user interface when you restart. +# If you would like users to be able to update a setting with the Admin it should NOT be set here. +# +# Note: If a preference is set here it will be stored within the cache & database upon initialization. +# Just removing an entry from this initializer will not make the preference value go away. +# Instead you must either set a new value or remove entry, clear cache, and remove database entry. +# +# In order to initialize a setting do: +# config.setting_name = 'new value' +Spree.config do |config| + # Example: + # Uncomment to stop tracking inventory levels in the application + # config.track_inventory_levels = false +end + +Spree.user_class = "Spree::User" diff --git a/config/initializers/wrap_parameters.rb b/config/initializers/wrap_parameters.rb new file mode 100644 index 0000000..33725e9 --- /dev/null +++ b/config/initializers/wrap_parameters.rb @@ -0,0 +1,14 @@ +# Be sure to restart your server when you modify this file. + +# This file contains settings for ActionController::ParamsWrapper which +# is enabled by default. + +# Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array. +ActiveSupport.on_load(:action_controller) do + wrap_parameters format: [:json] if respond_to?(:wrap_parameters) +end + +# To enable root element in JSON for ActiveRecord objects. +# ActiveSupport.on_load(:active_record) do +# self.include_root_in_json = true +# end diff --git a/config/locales/en.yml b/config/locales/en.yml new file mode 100644 index 0000000..0653957 --- /dev/null +++ b/config/locales/en.yml @@ -0,0 +1,23 @@ +# Files in the config/locales directory are used for internationalization +# and are automatically loaded by Rails. If you want to use locales other +# than English, add the necessary files in this directory. +# +# To use the locales, use `I18n.t`: +# +# I18n.t 'hello' +# +# In views, this is aliased to just `t`: +# +# <%= t('hello') %> +# +# To use a different locale, set it with `I18n.locale`: +# +# I18n.locale = :es +# +# This would use the information in config/locales/es.yml. +# +# To learn more, please read the Rails Internationalization guide +# available at http://guides.rubyonrails.org/i18n.html. + +en: + hello: "Hello world" diff --git a/config/routes.rb b/config/routes.rb new file mode 100644 index 0000000..661036f --- /dev/null +++ b/config/routes.rb @@ -0,0 +1,63 @@ +Rails.application.routes.draw do + + # This line mounts Spree's routes at the root of your application. + # This means, any requests to URLs such as /products, will go to Spree::ProductsController. + # If you would like to change where this engine is mounted, simply change the :at option to something different. + # + # We ask that you don't use the :as option here, as Spree relies on it being the default of "spree" + mount Spree::Core::Engine, at: '/' + # The priority is based upon order of creation: first created -> highest priority. + # See how all your routes lay out with "rake routes". + + # You can have the root of your site routed with "root" + # root 'welcome#index' + + # Example of regular route: + # get 'products/:id' => 'catalog#view' + + # Example of named route that can be invoked with purchase_url(id: product.id) + # get 'products/:id/purchase' => 'catalog#purchase', as: :purchase + + # Example resource route (maps HTTP verbs to controller actions automatically): + # resources :products + + # Example resource route with options: + # resources :products do + # member do + # get 'short' + # post 'toggle' + # end + # + # collection do + # get 'sold' + # end + # end + + # Example resource route with sub-resources: + # resources :products do + # resources :comments, :sales + # resource :seller + # end + + # Example resource route with more complex sub-resources: + # resources :products do + # resources :comments + # resources :sales do + # get 'recent', on: :collection + # end + # end + + # Example resource route with concerns: + # concern :toggleable do + # post 'toggle' + # end + # resources :posts, concerns: :toggleable + # resources :photos, concerns: :toggleable + + # Example resource route within a namespace: + # namespace :admin do + # # Directs /admin/products/* to Admin::ProductsController + # # (app/controllers/admin/products_controller.rb) + # resources :products + # end +end diff --git a/config/secrets.yml b/config/secrets.yml new file mode 100644 index 0000000..f7cc4e5 --- /dev/null +++ b/config/secrets.yml @@ -0,0 +1,22 @@ +# Be sure to restart your server when you modify this file. + +# Your secret key is used for verifying the integrity of signed cookies. +# If you change this key, all old signed cookies will become invalid! + +# Make sure the secret is at least 30 characters and all random, +# no regular words or you'll be exposed to dictionary attacks. +# You can use `rake secret` to generate a secure secret key. + +# Make sure the secrets in this file are kept private +# if you're sharing your code publicly. + +development: + secret_key_base: eca91fe2f32f3f4bcd4dba2cb84342c173233ab2315bf9404090a2b17358cf23f2b6f9e42d9d8fa5de00ecdbc52cca0f07d521a92ab8665ef88a29e18e6132af + +test: + secret_key_base: 9a7bbd981f7c29bd9b0c4644f28430f3555b093a500dd0b92f81662bd36f3a1b07017b0e86b157b96441dd1c9be4549a790aaa0e358ed766f086b8bbe0ce09c6 + +# Do not keep production secrets in the repository, +# instead read values from the environment. +production: + secret_key_base: <%= ENV["SECRET_KEY_BASE"] %> diff --git a/db/migrate/20161201175440_spree_one_two.spree.rb b/db/migrate/20161201175440_spree_one_two.spree.rb new file mode 100644 index 0000000..63fe16f --- /dev/null +++ b/db/migrate/20161201175440_spree_one_two.spree.rb @@ -0,0 +1,482 @@ +# 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 null: false + 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 null: false + 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 null: false + 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 null: false + end + + create_table :spree_configurations do |t| + t.string :name + t.string :type, :limit => 50 + t.timestamps null: false + 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 null: false + 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 null: false + 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 null: false + 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 null: false + 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 null: false + end + + create_table :spree_mail_methods do |t| + t.string :environment + t.boolean :active, :default => true + t.timestamps null: false + 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 null: false + 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 null: false + 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 null: false + 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 null: false + 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 null: false + 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 null: false + 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 null: false + end + + create_table :spree_product_properties do |t| + t.string :value + t.references :product + t.references :property + t.timestamps null: false + 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 null: false + 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 null: false + 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 null: false + 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 null: false + 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 null: false + end + + add_index :spree_shipments, [:number], :name => 'index_shipments_on_number' + + create_table :spree_shipping_categories do |t| + t.string :name + t.timestamps null: false + 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 null: false + 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 null: false + 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 null: false + 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 null: false + end + + create_table :spree_taxonomies do |t| + t.string :name, :null => false + t.timestamps null: false + 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 null: false + 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 null: false + 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 null: false + 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 null: false + 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 null: false + 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 null: false + end + end +end diff --git a/db/migrate/20161201175441_spree_promo_one_two.spree.rb b/db/migrate/20161201175441_spree_promo_one_two.spree.rb new file mode 100644 index 0000000..b272ffd --- /dev/null +++ b/db/migrate/20161201175441_spree_promo_one_two.spree.rb @@ -0,0 +1,46 @@ +# This migration comes from spree (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 null: false + 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/20161201175442_add_tax_rate_label.spree.rb b/db/migrate/20161201175442_add_tax_rate_label.spree.rb new file mode 100644 index 0000000..c39a83c --- /dev/null +++ b/db/migrate/20161201175442_add_tax_rate_label.spree.rb @@ -0,0 +1,6 @@ +# 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/20161201175443_add_toggle_tax_rate_display.spree.rb b/db/migrate/20161201175443_add_toggle_tax_rate_display.spree.rb new file mode 100644 index 0000000..83da18b --- /dev/null +++ b/db/migrate/20161201175443_add_toggle_tax_rate_display.spree.rb @@ -0,0 +1,6 @@ +# 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/20161201175444_remove_unused_preference_columns.spree.rb b/db/migrate/20161201175444_remove_unused_preference_columns.spree.rb new file mode 100644 index 0000000..6c049da --- /dev/null +++ b/db/migrate/20161201175444_remove_unused_preference_columns.spree.rb @@ -0,0 +1,9 @@ +# 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/20161201175445_add_lock_version_to_variant.spree.rb b/db/migrate/20161201175445_add_lock_version_to_variant.spree.rb new file mode 100644 index 0000000..0e8cc92 --- /dev/null +++ b/db/migrate/20161201175445_add_lock_version_to_variant.spree.rb @@ -0,0 +1,6 @@ +# 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/20161201175446_add_states_required_to_countries.spree.rb b/db/migrate/20161201175446_add_states_required_to_countries.spree.rb new file mode 100644 index 0000000..415001d --- /dev/null +++ b/db/migrate/20161201175446_add_states_required_to_countries.spree.rb @@ -0,0 +1,6 @@ +# 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/20161201175447_add_on_demand_to_product_and_variant.spree.rb b/db/migrate/20161201175447_add_on_demand_to_product_and_variant.spree.rb new file mode 100644 index 0000000..ba258eb --- /dev/null +++ b/db/migrate/20161201175447_add_on_demand_to_product_and_variant.spree.rb @@ -0,0 +1,7 @@ +# 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/20161201175448_remove_not_null_constraint_from_products_on_hand.spree.rb b/db/migrate/20161201175448_remove_not_null_constraint_from_products_on_hand.spree.rb new file mode 100644 index 0000000..acbebfc --- /dev/null +++ b/db/migrate/20161201175448_remove_not_null_constraint_from_products_on_hand.spree.rb @@ -0,0 +1,12 @@ +# 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/20161201175449_split_prices_from_variants.spree.rb b/db/migrate/20161201175449_split_prices_from_variants.spree.rb new file mode 100644 index 0000000..f227534 --- /dev/null +++ b/db/migrate/20161201175449_split_prices_from_variants.spree.rb @@ -0,0 +1,32 @@ +# 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/20161201175450_remove_not_null_from_spree_prices_amount.spree.rb b/db/migrate/20161201175450_remove_not_null_from_spree_prices_amount.spree.rb new file mode 100644 index 0000000..beb5f7a --- /dev/null +++ b/db/migrate/20161201175450_remove_not_null_from_spree_prices_amount.spree.rb @@ -0,0 +1,10 @@ +# 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/20161201175451_add_currency_to_line_items.spree.rb b/db/migrate/20161201175451_add_currency_to_line_items.spree.rb new file mode 100644 index 0000000..b0732ee --- /dev/null +++ b/db/migrate/20161201175451_add_currency_to_line_items.spree.rb @@ -0,0 +1,6 @@ +# 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/20161201175452_add_currency_to_orders.spree.rb b/db/migrate/20161201175452_add_currency_to_orders.spree.rb new file mode 100644 index 0000000..d84bc3b --- /dev/null +++ b/db/migrate/20161201175452_add_currency_to_orders.spree.rb @@ -0,0 +1,6 @@ +# 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/20161201175453_add_cost_currency_to_variants.spree.rb b/db/migrate/20161201175453_add_cost_currency_to_variants.spree.rb new file mode 100644 index 0000000..a31b964 --- /dev/null +++ b/db/migrate/20161201175453_add_cost_currency_to_variants.spree.rb @@ -0,0 +1,6 @@ +# 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/20161201175454_remove_display_on_from_payment_methods.spree.rb b/db/migrate/20161201175454_remove_display_on_from_payment_methods.spree.rb new file mode 100644 index 0000000..c45e413 --- /dev/null +++ b/db/migrate/20161201175454_remove_display_on_from_payment_methods.spree.rb @@ -0,0 +1,6 @@ +# This migration comes from spree (originally 20121111231553) +class RemoveDisplayOnFromPaymentMethods < ActiveRecord::Migration + def up + remove_column :spree_payment_methods, :display_on + end +end diff --git a/db/migrate/20161201175455_add_position_to_taxonomies.spree.rb b/db/migrate/20161201175455_add_position_to_taxonomies.spree.rb new file mode 100644 index 0000000..177870b --- /dev/null +++ b/db/migrate/20161201175455_add_position_to_taxonomies.spree.rb @@ -0,0 +1,6 @@ +# 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/20161201175456_add_last_ip_to_spree_orders.spree.rb b/db/migrate/20161201175456_add_last_ip_to_spree_orders.spree.rb new file mode 100644 index 0000000..e85fc41 --- /dev/null +++ b/db/migrate/20161201175456_add_last_ip_to_spree_orders.spree.rb @@ -0,0 +1,6 @@ +# 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/20161201175457_add_state_to_spree_adjustments.spree.rb b/db/migrate/20161201175457_add_state_to_spree_adjustments.spree.rb new file mode 100644 index 0000000..a422467 --- /dev/null +++ b/db/migrate/20161201175457_add_state_to_spree_adjustments.spree.rb @@ -0,0 +1,7 @@ +# 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/20161201175458_add_display_on_to_spree_payment_methods.spree.rb b/db/migrate/20161201175458_add_display_on_to_spree_payment_methods.spree.rb new file mode 100644 index 0000000..240870b --- /dev/null +++ b/db/migrate/20161201175458_add_display_on_to_spree_payment_methods.spree.rb @@ -0,0 +1,10 @@ +# 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/20161201175459_add_position_to_product_properties.spree.rb b/db/migrate/20161201175459_add_position_to_product_properties.spree.rb new file mode 100644 index 0000000..93da5d8 --- /dev/null +++ b/db/migrate/20161201175459_add_position_to_product_properties.spree.rb @@ -0,0 +1,7 @@ +# 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/20161201175460_add_identifier_to_spree_payments.spree.rb b/db/migrate/20161201175460_add_identifier_to_spree_payments.spree.rb new file mode 100644 index 0000000..91a65d9 --- /dev/null +++ b/db/migrate/20161201175460_add_identifier_to_spree_payments.spree.rb @@ -0,0 +1,6 @@ +# 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/20161201175461_add_order_id_index_to_payments.spree.rb b/db/migrate/20161201175461_add_order_id_index_to_payments.spree.rb new file mode 100644 index 0000000..49b378a --- /dev/null +++ b/db/migrate/20161201175461_add_order_id_index_to_payments.spree.rb @@ -0,0 +1,10 @@ +# 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/20161201175462_add_primary_to_spree_products_taxons.spree.rb b/db/migrate/20161201175462_add_primary_to_spree_products_taxons.spree.rb new file mode 100644 index 0000000..fd438d5 --- /dev/null +++ b/db/migrate/20161201175462_add_primary_to_spree_products_taxons.spree.rb @@ -0,0 +1,6 @@ +# 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/20161201175463_create_spree_stock_items.spree.rb b/db/migrate/20161201175463_create_spree_stock_items.spree.rb new file mode 100644 index 0000000..517f474 --- /dev/null +++ b/db/migrate/20161201175463_create_spree_stock_items.spree.rb @@ -0,0 +1,15 @@ +# 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 null: false + 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/20161201175464_create_spree_stock_locations.spree.rb b/db/migrate/20161201175464_create_spree_stock_locations.spree.rb new file mode 100644 index 0000000..7c094b6 --- /dev/null +++ b/db/migrate/20161201175464_create_spree_stock_locations.spree.rb @@ -0,0 +1,12 @@ +# 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 null: false + end + add_index :spree_stock_locations, :address_id + end +end diff --git a/db/migrate/20161201175465_create_default_stock.spree.rb b/db/migrate/20161201175465_create_default_stock.spree.rb new file mode 100644 index 0000000..afe2e01 --- /dev/null +++ b/db/migrate/20161201175465_create_default_stock.spree.rb @@ -0,0 +1,35 @@ +# This migration comes from spree (originally 20130213191427) +class CreateDefaultStock < ActiveRecord::Migration + def up + unless column_exists? :spree_stock_locations, :default + add_column :spree_stock_locations, :default, :boolean, null: false, default: false + end + + Spree::StockLocation.skip_callback(:create, :after, :create_stock_items) + Spree::StockLocation.skip_callback(:save, :after, :ensure_one_default) + Spree::StockItem.skip_callback(:save, :after, :process_backorders) + location = Spree::StockLocation.new(name: 'default') + location.save(validate: false) + + Spree::Variant.find_each do |variant| + stock_item = Spree::StockItem.unscoped.build(stock_location: location, variant: variant) + stock_item.send(:count_on_hand=, variant.count_on_hand) + # Avoid running default_scope defined by acts_as_paranoid, related to #3805, + # validations would run a query with a delete_at column that might not be present yet + stock_item.save! validate: false + end + + remove_column :spree_variants, :count_on_hand + end + + def down + add_column :spree_variants, :count_on_hand, :integer + + Spree::StockItem.find_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/20161201175466_add_order_id_index_to_shipments.spree.rb b/db/migrate/20161201175466_add_order_id_index_to_shipments.spree.rb new file mode 100644 index 0000000..5d0ebdb --- /dev/null +++ b/db/migrate/20161201175466_add_order_id_index_to_shipments.spree.rb @@ -0,0 +1,6 @@ +# 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/20161201175467_change_meta_description_on_spree_products_to_text.spree.rb b/db/migrate/20161201175467_change_meta_description_on_spree_products_to_text.spree.rb new file mode 100644 index 0000000..66fff52 --- /dev/null +++ b/db/migrate/20161201175467_change_meta_description_on_spree_products_to_text.spree.rb @@ -0,0 +1,6 @@ +# 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/20161201175468_add_stock_location_id_to_spree_shipments.spree.rb b/db/migrate/20161201175468_add_stock_location_id_to_spree_shipments.spree.rb new file mode 100644 index 0000000..e102d7f --- /dev/null +++ b/db/migrate/20161201175468_add_stock_location_id_to_spree_shipments.spree.rb @@ -0,0 +1,6 @@ +# 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/20161201175469_add_pending_to_inventory_unit.spree.rb b/db/migrate/20161201175469_add_pending_to_inventory_unit.spree.rb new file mode 100644 index 0000000..c3879d3 --- /dev/null +++ b/db/migrate/20161201175469_add_pending_to_inventory_unit.spree.rb @@ -0,0 +1,7 @@ +# 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/20161201175470_remove_on_demand_from_product_and_variant.spree.rb b/db/migrate/20161201175470_remove_on_demand_from_product_and_variant.spree.rb new file mode 100644 index 0000000..72ac77b --- /dev/null +++ b/db/migrate/20161201175470_remove_on_demand_from_product_and_variant.spree.rb @@ -0,0 +1,7 @@ +# This migration comes from spree (originally 20130228164411) +class RemoveOnDemandFromProductAndVariant < ActiveRecord::Migration + def change + remove_column :spree_products, :on_demand + remove_column :spree_variants, :on_demand + end +end diff --git a/db/migrate/20161201175471_create_shipping_method_zone.spree.rb b/db/migrate/20161201175471_create_shipping_method_zone.spree.rb new file mode 100644 index 0000000..fd55fea --- /dev/null +++ b/db/migrate/20161201175471_create_shipping_method_zone.spree.rb @@ -0,0 +1,22 @@ +# This migration comes from spree (originally 20130228210442) +class CreateShippingMethodZone < ActiveRecord::Migration + class ShippingMethodZone < ActiveRecord::Base + self.table_name = 'shipping_methods_zones' + end + def up + create_table :shipping_methods_zones, :id => false do |t| + t.integer :shipping_method_id + t.integer :zone_id + end + Spree::ShippingMethod.all.each do |sm| + ShippingMethodZone.create!(zone_id: sm.zone_id, shipping_method_id: sm.id) + end + + 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/20161201175472_remove_shipping_category_id_from_shipping_method.spree.rb b/db/migrate/20161201175472_remove_shipping_category_id_from_shipping_method.spree.rb new file mode 100644 index 0000000..f686ac4 --- /dev/null +++ b/db/migrate/20161201175472_remove_shipping_category_id_from_shipping_method.spree.rb @@ -0,0 +1,6 @@ +# 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/20161201175473_create_shipping_method_categories.spree.rb b/db/migrate/20161201175473_create_shipping_method_categories.spree.rb new file mode 100644 index 0000000..c00db73 --- /dev/null +++ b/db/migrate/20161201175473_create_shipping_method_categories.spree.rb @@ -0,0 +1,14 @@ +# 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 null: false + 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/20161201175474_add_tracking_url_to_spree_shipping_methods.spree.rb b/db/migrate/20161201175474_add_tracking_url_to_spree_shipping_methods.spree.rb new file mode 100644 index 0000000..28a9807 --- /dev/null +++ b/db/migrate/20161201175474_add_tracking_url_to_spree_shipping_methods.spree.rb @@ -0,0 +1,6 @@ +# 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/20161201175475_create_spree_shipping_rates.spree.rb b/db/migrate/20161201175475_create_spree_shipping_rates.spree.rb new file mode 100644 index 0000000..693ba1c --- /dev/null +++ b/db/migrate/20161201175475_create_spree_shipping_rates.spree.rb @@ -0,0 +1,25 @@ +# 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 null: false + 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/20161201175476_remove_category_match_attributes_from_shipping_method.spree.rb b/db/migrate/20161201175476_remove_category_match_attributes_from_shipping_method.spree.rb new file mode 100644 index 0000000..1562aec --- /dev/null +++ b/db/migrate/20161201175476_remove_category_match_attributes_from_shipping_method.spree.rb @@ -0,0 +1,8 @@ +# 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/20161201175477_create_stock_movements.spree.rb b/db/migrate/20161201175477_create_stock_movements.spree.rb new file mode 100644 index 0000000..3e4ad79 --- /dev/null +++ b/db/migrate/20161201175477_create_stock_movements.spree.rb @@ -0,0 +1,13 @@ +# 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 null: false + end + add_index :spree_stock_movements, :stock_item_id + end +end diff --git a/db/migrate/20161201175478_add_address_fields_to_stock_location.spree.rb b/db/migrate/20161201175478_add_address_fields_to_stock_location.spree.rb new file mode 100644 index 0000000..4a16efe --- /dev/null +++ b/db/migrate/20161201175478_add_address_fields_to_stock_location.spree.rb @@ -0,0 +1,23 @@ +# 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/20161201175479_add_active_field_to_stock_locations.spree.rb b/db/migrate/20161201175479_add_active_field_to_stock_locations.spree.rb new file mode 100644 index 0000000..0e69642 --- /dev/null +++ b/db/migrate/20161201175479_add_active_field_to_stock_locations.spree.rb @@ -0,0 +1,6 @@ +# 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/20161201175480_add_backorderable_to_stock_item.spree.rb b/db/migrate/20161201175480_add_backorderable_to_stock_item.spree.rb new file mode 100644 index 0000000..839e3b3 --- /dev/null +++ b/db/migrate/20161201175480_add_backorderable_to_stock_item.spree.rb @@ -0,0 +1,6 @@ +# 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/20161201175481_add_default_quantity_to_stock_movement.spree.rb b/db/migrate/20161201175481_add_default_quantity_to_stock_movement.spree.rb new file mode 100644 index 0000000..c991b94 --- /dev/null +++ b/db/migrate/20161201175481_add_default_quantity_to_stock_movement.spree.rb @@ -0,0 +1,6 @@ +# 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/20161201175482_add_source_and_destination_to_stock_movements.spree.rb b/db/migrate/20161201175482_add_source_and_destination_to_stock_movements.spree.rb new file mode 100644 index 0000000..7e0f098 --- /dev/null +++ b/db/migrate/20161201175482_add_source_and_destination_to_stock_movements.spree.rb @@ -0,0 +1,9 @@ +# 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/20161201175483_change_orders_total_precision.spree.rb b/db/migrate/20161201175483_change_orders_total_precision.spree.rb new file mode 100644 index 0000000..cfb1c81 --- /dev/null +++ b/db/migrate/20161201175483_change_orders_total_precision.spree.rb @@ -0,0 +1,9 @@ +# 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/20161201175484_change_spree_payments_amount_precision.spree.rb b/db/migrate/20161201175484_change_spree_payments_amount_precision.spree.rb new file mode 100644 index 0000000..2ac4630 --- /dev/null +++ b/db/migrate/20161201175484_change_spree_payments_amount_precision.spree.rb @@ -0,0 +1,8 @@ +# 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/20161201175485_change_spree_return_authorization_amount_precision.spree.rb b/db/migrate/20161201175485_change_spree_return_authorization_amount_precision.spree.rb new file mode 100644 index 0000000..cf6cc4b --- /dev/null +++ b/db/migrate/20161201175485_change_spree_return_authorization_amount_precision.spree.rb @@ -0,0 +1,8 @@ +# 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/20161201175486_change_adjustments_amount_precision.spree.rb b/db/migrate/20161201175486_change_adjustments_amount_precision.spree.rb new file mode 100644 index 0000000..f391987 --- /dev/null +++ b/db/migrate/20161201175486_change_adjustments_amount_precision.spree.rb @@ -0,0 +1,8 @@ +# 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/20161201175487_add_originator_to_stock_movement.spree.rb b/db/migrate/20161201175487_add_originator_to_stock_movement.spree.rb new file mode 100644 index 0000000..7c1a746 --- /dev/null +++ b/db/migrate/20161201175487_add_originator_to_stock_movement.spree.rb @@ -0,0 +1,8 @@ +# 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/20161201175488_drop_source_and_destination_from_stock_movement.spree.rb b/db/migrate/20161201175488_drop_source_and_destination_from_stock_movement.spree.rb new file mode 100644 index 0000000..6735614 --- /dev/null +++ b/db/migrate/20161201175488_drop_source_and_destination_from_stock_movement.spree.rb @@ -0,0 +1,16 @@ +# 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/20161201175489_migrate_inventory_unit_sold_to_on_hand.spree.rb b/db/migrate/20161201175489_migrate_inventory_unit_sold_to_on_hand.spree.rb new file mode 100644 index 0000000..4f75942 --- /dev/null +++ b/db/migrate/20161201175489_migrate_inventory_unit_sold_to_on_hand.spree.rb @@ -0,0 +1,10 @@ +# 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/20161201175490_add_stock_location_to_rma.spree.rb b/db/migrate/20161201175490_add_stock_location_to_rma.spree.rb new file mode 100644 index 0000000..54d85f7 --- /dev/null +++ b/db/migrate/20161201175490_add_stock_location_to_rma.spree.rb @@ -0,0 +1,6 @@ +# 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/20161201175491_update_shipment_state_for_canceled_orders.spree.rb b/db/migrate/20161201175491_update_shipment_state_for_canceled_orders.spree.rb new file mode 100644 index 0000000..f5c1b5a --- /dev/null +++ b/db/migrate/20161201175491_update_shipment_state_for_canceled_orders.spree.rb @@ -0,0 +1,16 @@ +# 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/20161201175492_add_seo_metas_to_taxons.spree.rb b/db/migrate/20161201175492_add_seo_metas_to_taxons.spree.rb new file mode 100644 index 0000000..a947764 --- /dev/null +++ b/db/migrate/20161201175492_add_seo_metas_to_taxons.spree.rb @@ -0,0 +1,10 @@ +# 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/20161201175493_remove_stock_item_and_variant_lock.spree.rb b/db/migrate/20161201175493_remove_stock_item_and_variant_lock.spree.rb new file mode 100644 index 0000000..c522a76 --- /dev/null +++ b/db/migrate/20161201175493_remove_stock_item_and_variant_lock.spree.rb @@ -0,0 +1,15 @@ +# 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/20161201175494_add_name_to_spree_credit_cards.spree.rb b/db/migrate/20161201175494_add_name_to_spree_credit_cards.spree.rb new file mode 100644 index 0000000..cb765fc --- /dev/null +++ b/db/migrate/20161201175494_add_name_to_spree_credit_cards.spree.rb @@ -0,0 +1,6 @@ +# This migration comes from spree (originally 20130413230529) +class AddNameToSpreeCreditCards < ActiveRecord::Migration + def change + add_column :spree_credit_cards, :name, :string + end +end diff --git a/db/migrate/20161201175495_update_name_fields_on_spree_credit_cards.spree.rb b/db/migrate/20161201175495_update_name_fields_on_spree_credit_cards.spree.rb new file mode 100644 index 0000000..84258bf --- /dev/null +++ b/db/migrate/20161201175495_update_name_fields_on_spree_credit_cards.spree.rb @@ -0,0 +1,14 @@ +# This migration comes from spree (originally 20130414000512) +class UpdateNameFieldsOnSpreeCreditCards < ActiveRecord::Migration + def up + if ActiveRecord::Base.connection.adapter_name.downcase.include? "mysql" + execute "UPDATE spree_credit_cards SET name = CONCAT(first_name, ' ', last_name)" + else + execute "UPDATE spree_credit_cards SET name = first_name || ' ' || last_name" + end + end + + def down + execute "UPDATE spree_credit_cards SET name = NULL" + end +end diff --git a/db/migrate/20161201175496_add_index_to_source_columns_on_adjustments.spree.rb b/db/migrate/20161201175496_add_index_to_source_columns_on_adjustments.spree.rb new file mode 100644 index 0000000..0de2f59 --- /dev/null +++ b/db/migrate/20161201175496_add_index_to_source_columns_on_adjustments.spree.rb @@ -0,0 +1,6 @@ +# This migration comes from spree (originally 20130417120034) +class AddIndexToSourceColumnsOnAdjustments < ActiveRecord::Migration + def change + add_index :spree_adjustments, [:source_type, :source_id] + end +end diff --git a/db/migrate/20161201175497_update_adjustment_states.spree.rb b/db/migrate/20161201175497_update_adjustment_states.spree.rb new file mode 100644 index 0000000..9040709 --- /dev/null +++ b/db/migrate/20161201175497_update_adjustment_states.spree.rb @@ -0,0 +1,17 @@ +# 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/20161201175498_add_shipping_rates_to_shipments.spree.rb b/db/migrate/20161201175498_add_shipping_rates_to_shipments.spree.rb new file mode 100644 index 0000000..89c3164 --- /dev/null +++ b/db/migrate/20161201175498_add_shipping_rates_to_shipments.spree.rb @@ -0,0 +1,16 @@ +# This migration comes from spree (originally 20130417123427) +class AddShippingRatesToShipments < ActiveRecord::Migration + def up + Spree::Shipment.find_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/20161201175499_create_spree_stock_transfers.spree.rb b/db/migrate/20161201175499_create_spree_stock_transfers.spree.rb new file mode 100644 index 0000000..3cfd2d2 --- /dev/null +++ b/db/migrate/20161201175499_create_spree_stock_transfers.spree.rb @@ -0,0 +1,15 @@ +# 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 null: false + end + + add_index :spree_stock_transfers, :source_location_id + add_index :spree_stock_transfers, :destination_location_id + end +end diff --git a/db/migrate/20161201175500_drop_products_count_on_hand.spree.rb b/db/migrate/20161201175500_drop_products_count_on_hand.spree.rb new file mode 100644 index 0000000..29cb947 --- /dev/null +++ b/db/migrate/20161201175500_drop_products_count_on_hand.spree.rb @@ -0,0 +1,6 @@ +# 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/20161201175501_set_default_shipping_rate_cost.spree.rb b/db/migrate/20161201175501_set_default_shipping_rate_cost.spree.rb new file mode 100644 index 0000000..64b9ccb --- /dev/null +++ b/db/migrate/20161201175501_set_default_shipping_rate_cost.spree.rb @@ -0,0 +1,6 @@ +# 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/20161201175502_add_number_to_stock_transfer.spree.rb b/db/migrate/20161201175502_add_number_to_stock_transfer.spree.rb new file mode 100644 index 0000000..42a96ce --- /dev/null +++ b/db/migrate/20161201175502_add_number_to_stock_transfer.spree.rb @@ -0,0 +1,24 @@ +# 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.find_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/20161201175503_add_sku_index_to_spree_variants.spree.rb b/db/migrate/20161201175503_add_sku_index_to_spree_variants.spree.rb new file mode 100644 index 0000000..cd089f8 --- /dev/null +++ b/db/migrate/20161201175503_add_sku_index_to_spree_variants.spree.rb @@ -0,0 +1,6 @@ +# 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/20161201175504_add_backorderable_default_to_spree_stock_location.spree.rb b/db/migrate/20161201175504_add_backorderable_default_to_spree_stock_location.spree.rb new file mode 100644 index 0000000..29939c5 --- /dev/null +++ b/db/migrate/20161201175504_add_backorderable_default_to_spree_stock_location.spree.rb @@ -0,0 +1,6 @@ +# 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/20161201175505_add_propage_all_variants_to_spree_stock_location.spree.rb b/db/migrate/20161201175505_add_propage_all_variants_to_spree_stock_location.spree.rb new file mode 100644 index 0000000..bfc55ea --- /dev/null +++ b/db/migrate/20161201175505_add_propage_all_variants_to_spree_stock_location.spree.rb @@ -0,0 +1,6 @@ +# 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/20161201175506_rename_shipping_methods_zones_to_spree_shipping_methods_zones.spree.rb b/db/migrate/20161201175506_rename_shipping_methods_zones_to_spree_shipping_methods_zones.spree.rb new file mode 100644 index 0000000..5c7ee6d --- /dev/null +++ b/db/migrate/20161201175506_rename_shipping_methods_zones_to_spree_shipping_methods_zones.spree.rb @@ -0,0 +1,6 @@ +# 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/20161201175507_add_user_id_index_to_spree_orders.spree.rb b/db/migrate/20161201175507_add_user_id_index_to_spree_orders.spree.rb new file mode 100644 index 0000000..e8d17db --- /dev/null +++ b/db/migrate/20161201175507_add_user_id_index_to_spree_orders.spree.rb @@ -0,0 +1,6 @@ +# This migration comes from spree (originally 20130611185927) +class AddUserIdIndexToSpreeOrders < ActiveRecord::Migration + def change + add_index :spree_orders, :user_id + end +end diff --git a/db/migrate/20161201175508_add_updated_at_to_spree_countries.spree.rb b/db/migrate/20161201175508_add_updated_at_to_spree_countries.spree.rb new file mode 100644 index 0000000..6df31e2 --- /dev/null +++ b/db/migrate/20161201175508_add_updated_at_to_spree_countries.spree.rb @@ -0,0 +1,10 @@ +# This migration comes from spree (originally 20130618041418) +class AddUpdatedAtToSpreeCountries < ActiveRecord::Migration + def up + add_column :spree_countries, :updated_at, :datetime + end + + def down + remove_column :spree_countries, :updated_at + end +end diff --git a/db/migrate/20161201175509_add_updated_at_to_spree_states.spree.rb b/db/migrate/20161201175509_add_updated_at_to_spree_states.spree.rb new file mode 100644 index 0000000..0bb972b --- /dev/null +++ b/db/migrate/20161201175509_add_updated_at_to_spree_states.spree.rb @@ -0,0 +1,10 @@ +# This migration comes from spree (originally 20130619012236) +class AddUpdatedAtToSpreeStates < ActiveRecord::Migration + def up + add_column :spree_states, :updated_at, :datetime + end + + def down + remove_column :spree_states, :updated_at + end +end diff --git a/db/migrate/20161201175510_add_cvv_result_code_and_cvv_result_message_to_spree_payments.spree.rb b/db/migrate/20161201175510_add_cvv_result_code_and_cvv_result_message_to_spree_payments.spree.rb new file mode 100644 index 0000000..0f611c6 --- /dev/null +++ b/db/migrate/20161201175510_add_cvv_result_code_and_cvv_result_message_to_spree_payments.spree.rb @@ -0,0 +1,7 @@ +# 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/20161201175511_add_unique_index_to_permalink_on_spree_products.spree.rb b/db/migrate/20161201175511_add_unique_index_to_permalink_on_spree_products.spree.rb new file mode 100644 index 0000000..310d487 --- /dev/null +++ b/db/migrate/20161201175511_add_unique_index_to_permalink_on_spree_products.spree.rb @@ -0,0 +1,6 @@ +# 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/20161201175512_add_unique_index_to_orders_shipments_and_stock_transfers.spree.rb b/db/migrate/20161201175512_add_unique_index_to_orders_shipments_and_stock_transfers.spree.rb new file mode 100644 index 0000000..e551ac3 --- /dev/null +++ b/db/migrate/20161201175512_add_unique_index_to_orders_shipments_and_stock_transfers.spree.rb @@ -0,0 +1,8 @@ +# 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 + add_index "spree_stock_transfers", ["number"], :name => "number_idx_unique", :unique => true + end +end diff --git a/db/migrate/20161201175513_add_deleted_at_to_spree_tax_rates.spree.rb b/db/migrate/20161201175513_add_deleted_at_to_spree_tax_rates.spree.rb new file mode 100644 index 0000000..c804d9a --- /dev/null +++ b/db/migrate/20161201175513_add_deleted_at_to_spree_tax_rates.spree.rb @@ -0,0 +1,6 @@ +# 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/20161201175514_remove_lock_version_from_inventory_units.spree.rb b/db/migrate/20161201175514_remove_lock_version_from_inventory_units.spree.rb new file mode 100644 index 0000000..42c60bd --- /dev/null +++ b/db/migrate/20161201175514_remove_lock_version_from_inventory_units.spree.rb @@ -0,0 +1,7 @@ +# 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/20161201175515_add_cost_price_to_line_item.spree.rb b/db/migrate/20161201175515_add_cost_price_to_line_item.spree.rb new file mode 100644 index 0000000..d54222f --- /dev/null +++ b/db/migrate/20161201175515_add_cost_price_to_line_item.spree.rb @@ -0,0 +1,6 @@ +# 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/20161201175516_set_backorderable_to_default_to_false.spree.rb b/db/migrate/20161201175516_set_backorderable_to_default_to_false.spree.rb new file mode 100644 index 0000000..a05f427 --- /dev/null +++ b/db/migrate/20161201175516_set_backorderable_to_default_to_false.spree.rb @@ -0,0 +1,7 @@ +# 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/20161201175517_add_created_by_id_to_spree_orders.spree.rb b/db/migrate/20161201175517_add_created_by_id_to_spree_orders.spree.rb new file mode 100644 index 0000000..fe59c0f --- /dev/null +++ b/db/migrate/20161201175517_add_created_by_id_to_spree_orders.spree.rb @@ -0,0 +1,6 @@ +# 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/20161201175518_index_completed_at_on_spree_orders.spree.rb b/db/migrate/20161201175518_index_completed_at_on_spree_orders.spree.rb new file mode 100644 index 0000000..c4c279c --- /dev/null +++ b/db/migrate/20161201175518_index_completed_at_on_spree_orders.spree.rb @@ -0,0 +1,6 @@ +# 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/20161201175519_add_tax_category_id_to_spree_line_items.spree.rb b/db/migrate/20161201175519_add_tax_category_id_to_spree_line_items.spree.rb new file mode 100644 index 0000000..2b7e1a5 --- /dev/null +++ b/db/migrate/20161201175519_add_tax_category_id_to_spree_line_items.spree.rb @@ -0,0 +1,6 @@ +# 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/20161201175520_migrate_tax_categories_to_line_items.spree.rb b/db/migrate/20161201175520_migrate_tax_categories_to_line_items.spree.rb new file mode 100644 index 0000000..b84f3ec --- /dev/null +++ b/db/migrate/20161201175520_migrate_tax_categories_to_line_items.spree.rb @@ -0,0 +1,11 @@ +# This migration comes from spree (originally 20130802022321) +class MigrateTaxCategoriesToLineItems < ActiveRecord::Migration + def change + Spree::LineItem.find_each do |line_item| + next if line_item.variant.nil? + next if line_item.variant.product.nil? + next if line_item.product.nil? + line_item.update_column(:tax_category_id, line_item.product.tax_category_id) + end + end +end diff --git a/db/migrate/20161201175521_drop_spree_mail_methods.spree.rb b/db/migrate/20161201175521_drop_spree_mail_methods.spree.rb new file mode 100644 index 0000000..69c9f33 --- /dev/null +++ b/db/migrate/20161201175521_drop_spree_mail_methods.spree.rb @@ -0,0 +1,13 @@ +# This migration comes from spree (originally 20130806022521) +class DropSpreeMailMethods < ActiveRecord::Migration + def up + drop_table :spree_mail_methods + end + + def down + create_table(:spree_mail_methods) do |t| + t.string :environment + t.boolean :active + end + end +end diff --git a/db/migrate/20161201175522_set_default_stock_location_on_shipments.spree.rb b/db/migrate/20161201175522_set_default_stock_location_on_shipments.spree.rb new file mode 100644 index 0000000..2e032b0 --- /dev/null +++ b/db/migrate/20161201175522_set_default_stock_location_on_shipments.spree.rb @@ -0,0 +1,9 @@ +# This migration comes from spree (originally 20130806145853) +class SetDefaultStockLocationOnShipments < ActiveRecord::Migration + def change + if Spree::Shipment.where('stock_location_id IS NULL').count > 0 + location = Spree::StockLocation.find_by(name: 'default') || Spree::StockLocation.first + Spree::Shipment.where('stock_location_id IS NULL').update_all(stock_location_id: location.id) + end + end +end diff --git a/db/migrate/20161201175523_upgrade_adjustments.spree.rb b/db/migrate/20161201175523_upgrade_adjustments.spree.rb new file mode 100644 index 0000000..de0fa74 --- /dev/null +++ b/db/migrate/20161201175523_upgrade_adjustments.spree.rb @@ -0,0 +1,41 @@ +# This migration comes from spree (originally 20130807024301) +class UpgradeAdjustments < ActiveRecord::Migration + def up + # Temporarily make originator association available + Spree::Adjustment.class_eval do + belongs_to :originator, polymorphic: true + end + # Shipping adjustments are now tracked as fields on the object + Spree::Adjustment.where(:source_type => "Spree::Shipment").find_each do |adjustment| + # Account for possible invalid data + next if adjustment.source.nil? + adjustment.source.update_column(:cost, adjustment.amount) + adjustment.destroy! + end + + # Tax adjustments have their sources altered + Spree::Adjustment.where(:originator_type => "Spree::TaxRate").find_each do |adjustment| + adjustment.source_id = adjustment.originator_id + adjustment.source_type = "Spree::TaxRate" + adjustment.save! + end + + # Promotion adjustments have their source altered also + Spree::Adjustment.where(:originator_type => "Spree::PromotionAction").find_each do |adjustment| + next if adjustment.originator.nil? + adjustment.source = adjustment.originator + begin + if adjustment.source.calculator_type == "Spree::Calculator::FreeShipping" + # Previously this was a Spree::Promotion::Actions::CreateAdjustment + # And it had a calculator to work out FreeShipping + # In Spree 2.2, the "calculator" is now the action itself. + adjustment.source.becomes(Spree::Promotion::Actions::FreeShipping) + end + rescue + # Fail silently. This is primarily in instances where the calculator no longer exists + end + + adjustment.save! + end + end +end diff --git a/db/migrate/20161201175524_rename_adjustment_fields.spree.rb b/db/migrate/20161201175524_rename_adjustment_fields.spree.rb new file mode 100644 index 0000000..a39f445 --- /dev/null +++ b/db/migrate/20161201175524_rename_adjustment_fields.spree.rb @@ -0,0 +1,15 @@ +# This migration comes from spree (originally 20130807024302) +class RenameAdjustmentFields < ActiveRecord::Migration + def up + remove_column :spree_adjustments, :originator_id + remove_column :spree_adjustments, :originator_type + + add_column :spree_adjustments, :order_id, :integer unless column_exists?(:spree_adjustments, :order_id) + + # This enables the Spree::Order#all_adjustments association to work correctly + Spree::Adjustment.reset_column_information + Spree::Adjustment.where(adjustable_type: "Spree::Order").find_each do |adjustment| + adjustment.update_column(:order_id, adjustment.adjustable_id) + end + end +end diff --git a/db/migrate/20161201175525_add_admin_name_column_to_spree_shipping_methods.spree.rb b/db/migrate/20161201175525_add_admin_name_column_to_spree_shipping_methods.spree.rb new file mode 100644 index 0000000..70bec5b --- /dev/null +++ b/db/migrate/20161201175525_add_admin_name_column_to_spree_shipping_methods.spree.rb @@ -0,0 +1,6 @@ +# This migration comes from spree (originally 20130809164245) +class AddAdminNameColumnToSpreeShippingMethods < ActiveRecord::Migration + def change + add_column :spree_shipping_methods, :admin_name, :string + end +end diff --git a/db/migrate/20161201175526_add_admin_name_column_to_spree_stock_locations.spree.rb b/db/migrate/20161201175526_add_admin_name_column_to_spree_stock_locations.spree.rb new file mode 100644 index 0000000..819acfe --- /dev/null +++ b/db/migrate/20161201175526_add_admin_name_column_to_spree_stock_locations.spree.rb @@ -0,0 +1,6 @@ +# This migration comes from spree (originally 20130809164330) +class AddAdminNameColumnToSpreeStockLocations < ActiveRecord::Migration + def change + add_column :spree_stock_locations, :admin_name, :string + end +end diff --git a/db/migrate/20161201175527_add_shipment_total_to_spree_orders.spree.rb b/db/migrate/20161201175527_add_shipment_total_to_spree_orders.spree.rb new file mode 100644 index 0000000..d1d9ea4 --- /dev/null +++ b/db/migrate/20161201175527_add_shipment_total_to_spree_orders.spree.rb @@ -0,0 +1,6 @@ +# This migration comes from spree (originally 20130813004002) +class AddShipmentTotalToSpreeOrders < ActiveRecord::Migration + def change + add_column :spree_orders, :shipment_total, :decimal, :precision => 10, :scale => 2, :default => 0.0, :null => false + end +end diff --git a/db/migrate/20161201175528_expand_order_number_size.spree.rb b/db/migrate/20161201175528_expand_order_number_size.spree.rb new file mode 100644 index 0000000..51facc1 --- /dev/null +++ b/db/migrate/20161201175528_expand_order_number_size.spree.rb @@ -0,0 +1,10 @@ +# This migration comes from spree (originally 20130813140619) +class ExpandOrderNumberSize < ActiveRecord::Migration + def up + change_column :spree_orders, :number, :string, :limit => 32 + end + + def down + change_column :spree_orders, :number, :string, :limit => 15 + end +end diff --git a/db/migrate/20161201175529_rename_activators_to_promotions.spree.rb b/db/migrate/20161201175529_rename_activators_to_promotions.spree.rb new file mode 100644 index 0000000..f5182ac --- /dev/null +++ b/db/migrate/20161201175529_rename_activators_to_promotions.spree.rb @@ -0,0 +1,6 @@ +# This migration comes from spree (originally 20130813232134) +class RenameActivatorsToPromotions < ActiveRecord::Migration + def change + rename_table :spree_activators, :spree_promotions + end +end diff --git a/db/migrate/20161201175530_add_adjustment_total_to_line_items.spree.rb b/db/migrate/20161201175530_add_adjustment_total_to_line_items.spree.rb new file mode 100644 index 0000000..d2c84e7 --- /dev/null +++ b/db/migrate/20161201175530_add_adjustment_total_to_line_items.spree.rb @@ -0,0 +1,6 @@ +# This migration comes from spree (originally 20130815000406) +class AddAdjustmentTotalToLineItems < ActiveRecord::Migration + def change + add_column :spree_line_items, :adjustment_total, :decimal, :precision => 10, :scale => 2, :default => 0.0 + end +end diff --git a/db/migrate/20161201175531_add_adjustment_total_to_shipments.spree.rb b/db/migrate/20161201175531_add_adjustment_total_to_shipments.spree.rb new file mode 100644 index 0000000..9c5a382 --- /dev/null +++ b/db/migrate/20161201175531_add_adjustment_total_to_shipments.spree.rb @@ -0,0 +1,6 @@ +# This migration comes from spree (originally 20130815024413) +class AddAdjustmentTotalToShipments < ActiveRecord::Migration + def change + add_column :spree_shipments, :adjustment_total, :decimal, :precision => 10, :scale => 2, :default => 0.0 + end +end diff --git a/db/migrate/20161201175532_add_depth_to_spree_taxons.spree.rb b/db/migrate/20161201175532_add_depth_to_spree_taxons.spree.rb new file mode 100644 index 0000000..15fd9ec --- /dev/null +++ b/db/migrate/20161201175532_add_depth_to_spree_taxons.spree.rb @@ -0,0 +1,17 @@ +# This migration comes from spree (originally 20130826062534) +class AddDepthToSpreeTaxons < ActiveRecord::Migration + def up + if !Spree::Taxon.column_names.include?('depth') + add_column :spree_taxons, :depth, :integer + + say_with_time 'Update depth on all taxons' do + Spree::Taxon.reset_column_information + Spree::Taxon.all.each { |t| t.save } + end + end + end + + def down + remove_column :spree_taxons, :depth + end +end diff --git a/db/migrate/20161201175533_add_tax_total_to_line_items_shipments_and_orders.spree.rb b/db/migrate/20161201175533_add_tax_total_to_line_items_shipments_and_orders.spree.rb new file mode 100644 index 0000000..d97e645 --- /dev/null +++ b/db/migrate/20161201175533_add_tax_total_to_line_items_shipments_and_orders.spree.rb @@ -0,0 +1,9 @@ +# This migration comes from spree (originally 20130828234942) +class AddTaxTotalToLineItemsShipmentsAndOrders < ActiveRecord::Migration + def change + add_column :spree_line_items, :tax_total, :decimal, precision: 10, scale: 2, default: 0.0 + add_column :spree_shipments, :tax_total, :decimal, precision: 10, scale: 2, default: 0.0 + # This column may already be here from a 2.1.x migration + add_column :spree_orders, :tax_total, :decimal, precision: 10, scale: 2, default: 0.0 unless Spree::Order.column_names.include?("tax_total") + end +end diff --git a/db/migrate/20161201175534_add_shipping_category_to_shipping_methods_and_products.spree.rb b/db/migrate/20161201175534_add_shipping_category_to_shipping_methods_and_products.spree.rb new file mode 100644 index 0000000..5572ed0 --- /dev/null +++ b/db/migrate/20161201175534_add_shipping_category_to_shipping_methods_and_products.spree.rb @@ -0,0 +1,16 @@ +# This migration comes from spree (originally 20130830001033) +class AddShippingCategoryToShippingMethodsAndProducts < ActiveRecord::Migration + def up + default_category = Spree::ShippingCategory.first + default_category ||= Spree::ShippingCategory.create!(:name => "Default") + + Spree::ShippingMethod.all.each do |method| + method.shipping_categories << default_category if method.shipping_categories.blank? + end + + Spree::Product.where(shipping_category_id: nil).update_all(shipping_category_id: default_category.id) + end + + def down + end +end diff --git a/db/migrate/20161201175535_migrate_old_shipping_calculators.spree.rb b/db/migrate/20161201175535_migrate_old_shipping_calculators.spree.rb new file mode 100644 index 0000000..f6e7e75 --- /dev/null +++ b/db/migrate/20161201175535_migrate_old_shipping_calculators.spree.rb @@ -0,0 +1,20 @@ +# This migration comes from spree (originally 20130830001159) +class MigrateOldShippingCalculators < ActiveRecord::Migration + def up + Spree::ShippingMethod.all.each do |shipping_method| + old_calculator = shipping_method.calculator + next if old_calculator.class < Spree::ShippingCalculator # We don't want to mess with new shipping calculators + new_calculator = eval(old_calculator.class.name.sub("::Calculator::", "::Calculator::Shipping::")).new + new_calculator.preferences.keys.each do |pref| + # Preferences can't be read/set by name, you have to prefix preferred_ + pref_method = "preferred_#{pref}" + new_calculator.send("#{pref_method}=", old_calculator.send(pref_method)) + end + new_calculator.calculable = old_calculator.calculable + new_calculator.save + end + end + + def down + end +end diff --git a/db/migrate/20161201175536_add_code_to_spree_promotion_rules.spree.rb b/db/migrate/20161201175536_add_code_to_spree_promotion_rules.spree.rb new file mode 100644 index 0000000..a99e79d --- /dev/null +++ b/db/migrate/20161201175536_add_code_to_spree_promotion_rules.spree.rb @@ -0,0 +1,6 @@ +# This migration comes from spree (originally 20130903183026) +class AddCodeToSpreePromotionRules < ActiveRecord::Migration + def change + add_column :spree_promotion_rules, :code, :string + end +end diff --git a/db/migrate/20161201175537_change_states_required_for_countries.spree.rb b/db/migrate/20161201175537_change_states_required_for_countries.spree.rb new file mode 100644 index 0000000..902b442 --- /dev/null +++ b/db/migrate/20161201175537_change_states_required_for_countries.spree.rb @@ -0,0 +1,10 @@ +# This migration comes from spree (originally 20130909115621) +class ChangeStatesRequiredForCountries < ActiveRecord::Migration + def up + change_column_default :spree_countries, :states_required, false + end + + def down + change_column_default :spree_countries, :states_required, true + end +end diff --git a/db/migrate/20161201175538_add_deleted_at_to_spree_stock_items.spree.rb b/db/migrate/20161201175538_add_deleted_at_to_spree_stock_items.spree.rb new file mode 100644 index 0000000..c44b0b7 --- /dev/null +++ b/db/migrate/20161201175538_add_deleted_at_to_spree_stock_items.spree.rb @@ -0,0 +1,6 @@ +# This migration comes from spree (originally 20130915032339) +class AddDeletedAtToSpreeStockItems < ActiveRecord::Migration + def change + add_column :spree_stock_items, :deleted_at, :datetime + end +end diff --git a/db/migrate/20161201175539_remove_promotions_event_name_field.spree.rb b/db/migrate/20161201175539_remove_promotions_event_name_field.spree.rb new file mode 100644 index 0000000..83ce1c2 --- /dev/null +++ b/db/migrate/20161201175539_remove_promotions_event_name_field.spree.rb @@ -0,0 +1,6 @@ +# This migration comes from spree (originally 20130917024658) +class RemovePromotionsEventNameField < ActiveRecord::Migration + def change + remove_column :spree_promotions, :event_name + end +end diff --git a/db/migrate/20161201175540_add_promo_total_to_line_items_and_shipments_and_orders.spree.rb b/db/migrate/20161201175540_add_promo_total_to_line_items_and_shipments_and_orders.spree.rb new file mode 100644 index 0000000..b402194 --- /dev/null +++ b/db/migrate/20161201175540_add_promo_total_to_line_items_and_shipments_and_orders.spree.rb @@ -0,0 +1,8 @@ +# This migration comes from spree (originally 20130924040529) +class AddPromoTotalToLineItemsAndShipmentsAndOrders < ActiveRecord::Migration + def change + add_column :spree_line_items, :promo_total, :decimal, precision: 10, scale: 2, default: 0.0 + add_column :spree_shipments, :promo_total, :decimal, precision: 10, scale: 2, default: 0.0 + add_column :spree_orders, :promo_total, :decimal, precision: 10, scale: 2, default: 0.0 + end +end diff --git a/db/migrate/20161201175541_remove_unused_credit_card_fields.spree.rb b/db/migrate/20161201175541_remove_unused_credit_card_fields.spree.rb new file mode 100644 index 0000000..821d36f --- /dev/null +++ b/db/migrate/20161201175541_remove_unused_credit_card_fields.spree.rb @@ -0,0 +1,17 @@ +# This migration comes from spree (originally 20131001013410) +class RemoveUnusedCreditCardFields < ActiveRecord::Migration + def up + remove_column :spree_credit_cards, :start_month if column_exists?(:spree_credit_cards, :start_month) + remove_column :spree_credit_cards, :start_year if column_exists?(:spree_credit_cards, :start_year) + remove_column :spree_credit_cards, :issue_number if column_exists?(:spree_credit_cards, :issue_number) + end + def down + add_column :spree_credit_cards, :start_month, :string + add_column :spree_credit_cards, :start_year, :string + add_column :spree_credit_cards, :issue_number, :string + end + + def column_exists?(table, column) + ActiveRecord::Base.connection.column_exists?(table, column) + end +end diff --git a/db/migrate/20161201175542_add_track_inventory_to_variant.spree.rb b/db/migrate/20161201175542_add_track_inventory_to_variant.spree.rb new file mode 100644 index 0000000..d5a03f3 --- /dev/null +++ b/db/migrate/20161201175542_add_track_inventory_to_variant.spree.rb @@ -0,0 +1,6 @@ +# This migration comes from spree (originally 20131026154747) +class AddTrackInventoryToVariant < ActiveRecord::Migration + def change + add_column :spree_variants, :track_inventory, :boolean, :default => true + end +end diff --git a/db/migrate/20161201175543_add_tax_category_to_variants.spree.rb b/db/migrate/20161201175543_add_tax_category_to_variants.spree.rb new file mode 100644 index 0000000..5667e06 --- /dev/null +++ b/db/migrate/20161201175543_add_tax_category_to_variants.spree.rb @@ -0,0 +1,7 @@ +# This migration comes from spree (originally 20131107132123) +class AddTaxCategoryToVariants < ActiveRecord::Migration + def change + add_column :spree_variants, :tax_category_id, :integer + add_index :spree_variants, :tax_category_id + end +end diff --git a/db/migrate/20161201175544_add_channel_to_spree_orders.spree.rb b/db/migrate/20161201175544_add_channel_to_spree_orders.spree.rb new file mode 100644 index 0000000..c7f6d63 --- /dev/null +++ b/db/migrate/20161201175544_add_channel_to_spree_orders.spree.rb @@ -0,0 +1,6 @@ +# This migration comes from spree (originally 20131113035136) +class AddChannelToSpreeOrders < ActiveRecord::Migration + def change + add_column :spree_orders, :channel, :string, default: "spree" + end +end diff --git a/db/migrate/20161201175545_add_included_to_adjustments.spree.rb b/db/migrate/20161201175545_add_included_to_adjustments.spree.rb new file mode 100644 index 0000000..13b17ed --- /dev/null +++ b/db/migrate/20161201175545_add_included_to_adjustments.spree.rb @@ -0,0 +1,6 @@ +# This migration comes from spree (originally 20131118043959) +class AddIncludedToAdjustments < ActiveRecord::Migration + def change + add_column :spree_adjustments, :included, :boolean, :default => false unless Spree::Adjustment.column_names.include?("included") + end +end diff --git a/db/migrate/20161201175546_rename_tax_total_fields.spree.rb b/db/migrate/20161201175546_rename_tax_total_fields.spree.rb new file mode 100644 index 0000000..786cbd4 --- /dev/null +++ b/db/migrate/20161201175546_rename_tax_total_fields.spree.rb @@ -0,0 +1,12 @@ +# This migration comes from spree (originally 20131118050234) +class RenameTaxTotalFields < ActiveRecord::Migration + def change + rename_column :spree_line_items, :tax_total, :additional_tax_total + rename_column :spree_shipments, :tax_total, :additional_tax_total + rename_column :spree_orders, :tax_total, :additional_tax_total + + add_column :spree_line_items, :included_tax_total, :decimal, precision: 10, scale: 2, null: false, default: 0.0 + add_column :spree_shipments, :included_tax_total, :decimal, precision: 10, scale: 2, null: false, default: 0.0 + add_column :spree_orders, :included_tax_total, :decimal, precision: 10, scale: 2, null: false, default: 0.0 + end +end diff --git a/db/migrate/20161201175547_add_line_item_id_to_spree_inventory_units.spree.rb b/db/migrate/20161201175547_add_line_item_id_to_spree_inventory_units.spree.rb new file mode 100644 index 0000000..5b2fb0a --- /dev/null +++ b/db/migrate/20161201175547_add_line_item_id_to_spree_inventory_units.spree.rb @@ -0,0 +1,22 @@ +# This migration comes from spree (originally 20131118183431) +class AddLineItemIdToSpreeInventoryUnits < ActiveRecord::Migration + def change + # Stores running the product-assembly extension already have a line_item_id column + unless column_exists? Spree::InventoryUnit.table_name, :line_item_id + add_column :spree_inventory_units, :line_item_id, :integer + add_index :spree_inventory_units, :line_item_id + + shipments = Spree::Shipment.includes(:inventory_units, :order) + + shipments.find_each do |shipment| + shipment.inventory_units.group_by(&:variant_id).each do |variant_id, units| + + line_item = shipment.order.line_items.find_by(variant_id: variant_id) + next unless line_item + + Spree::InventoryUnit.where(id: units.map(&:id)).update_all(line_item_id: line_item.id) + end + end + end + end +end diff --git a/db/migrate/20161201175548_add_updated_at_to_variants.spree.rb b/db/migrate/20161201175548_add_updated_at_to_variants.spree.rb new file mode 100644 index 0000000..2fa010b --- /dev/null +++ b/db/migrate/20161201175548_add_updated_at_to_variants.spree.rb @@ -0,0 +1,6 @@ +# This migration comes from spree (originally 20131120234456) +class AddUpdatedAtToVariants < ActiveRecord::Migration + def change + add_column :spree_variants, :updated_at, :datetime + end +end diff --git a/db/migrate/20161201175549_add_position_to_classifications.spree.rb b/db/migrate/20161201175549_add_position_to_classifications.spree.rb new file mode 100644 index 0000000..85b4006 --- /dev/null +++ b/db/migrate/20161201175549_add_position_to_classifications.spree.rb @@ -0,0 +1,6 @@ +# This migration comes from spree (originally 20131127001002) +class AddPositionToClassifications < ActiveRecord::Migration + def change + add_column :spree_products_taxons, :position, :integer + end +end diff --git a/db/migrate/20161201175550_create_spree_orders_promotions.spree.rb b/db/migrate/20161201175550_create_spree_orders_promotions.spree.rb new file mode 100644 index 0000000..c8ffd2e --- /dev/null +++ b/db/migrate/20161201175550_create_spree_orders_promotions.spree.rb @@ -0,0 +1,9 @@ +# This migration comes from spree (originally 20131211112807) +class CreateSpreeOrdersPromotions < ActiveRecord::Migration + def change + create_table :spree_orders_promotions, :id => false do |t| + t.references :order + t.references :promotion + end + end +end diff --git a/db/migrate/20161201175551_unique_shipping_method_categories.spree.rb b/db/migrate/20161201175551_unique_shipping_method_categories.spree.rb new file mode 100644 index 0000000..8415eda --- /dev/null +++ b/db/migrate/20161201175551_unique_shipping_method_categories.spree.rb @@ -0,0 +1,25 @@ +# This migration comes from spree (originally 20131211192741) +class UniqueShippingMethodCategories < ActiveRecord::Migration + def change + klass = Spree::ShippingMethodCategory + columns = %w[shipping_category_id shipping_method_id] + + say "Find duplicate #{klass} records" + duplicates = klass. + select((columns + %w[COUNT(*)]).join(',')). + group(columns.join(',')). + having('COUNT(*) > 1'). + map { |row| row.attributes.slice(*columns) } + + say "Delete all but the oldest duplicate #{klass} record" + duplicates.each do |conditions| + klass.where(conditions).order(:created_at).drop(1).each(&:destroy) + end + + say "Add unique index to #{klass.table_name} for #{columns.inspect}" + add_index klass.table_name, columns, unique: true, name: 'unique_spree_shipping_method_categories' + + say "Remove redundant simple index on #{klass.table_name}" + remove_index klass.table_name, name: 'index_spree_shipping_method_categories_on_shipping_category_id' + end +end diff --git a/db/migrate/20161201175552_add_item_count_to_spree_orders.spree.rb b/db/migrate/20161201175552_add_item_count_to_spree_orders.spree.rb new file mode 100644 index 0000000..428a38c --- /dev/null +++ b/db/migrate/20161201175552_add_item_count_to_spree_orders.spree.rb @@ -0,0 +1,6 @@ +# This migration comes from spree (originally 20131218054603) +class AddItemCountToSpreeOrders < ActiveRecord::Migration + def change + add_column :spree_orders, :item_count, :integer, :default => 0 + end +end diff --git a/db/migrate/20161201175553_remove_value_type_from_spree_preferences.spree.rb b/db/migrate/20161201175553_remove_value_type_from_spree_preferences.spree.rb new file mode 100644 index 0000000..a747857 --- /dev/null +++ b/db/migrate/20161201175553_remove_value_type_from_spree_preferences.spree.rb @@ -0,0 +1,9 @@ +# This migration comes from spree (originally 20140106065820) +class RemoveValueTypeFromSpreePreferences < ActiveRecord::Migration + def up + remove_column :spree_preferences, :value_type + end + def down + raise ActiveRecord::IrreversableMigration + end +end diff --git a/db/migrate/20161201175554_rename_permalink_to_slug_for_products.spree.rb b/db/migrate/20161201175554_rename_permalink_to_slug_for_products.spree.rb new file mode 100644 index 0000000..614f8e7 --- /dev/null +++ b/db/migrate/20161201175554_rename_permalink_to_slug_for_products.spree.rb @@ -0,0 +1,6 @@ +# This migration comes from spree (originally 20140106224208) +class RenamePermalinkToSlugForProducts < ActiveRecord::Migration + def change + rename_column :spree_products, :permalink, :slug + end +end diff --git a/db/migrate/20161201175555_add_index_to_variant_id_and_currency_on_prices.spree.rb b/db/migrate/20161201175555_add_index_to_variant_id_and_currency_on_prices.spree.rb new file mode 100644 index 0000000..c7e6c81 --- /dev/null +++ b/db/migrate/20161201175555_add_index_to_variant_id_and_currency_on_prices.spree.rb @@ -0,0 +1,6 @@ +# This migration comes from spree (originally 20140120160805) +class AddIndexToVariantIdAndCurrencyOnPrices < ActiveRecord::Migration + def change + add_index :spree_prices, [:variant_id, :currency] + end +end diff --git a/db/migrate/20161201175556_rename_activator_id_in_rules_and_actions_to_promotion_id.spree.rb b/db/migrate/20161201175556_rename_activator_id_in_rules_and_actions_to_promotion_id.spree.rb new file mode 100644 index 0000000..98a5ee4 --- /dev/null +++ b/db/migrate/20161201175556_rename_activator_id_in_rules_and_actions_to_promotion_id.spree.rb @@ -0,0 +1,7 @@ +# This migration comes from spree (originally 20140124023232) +class RenameActivatorIdInRulesAndActionsToPromotionId < ActiveRecord::Migration + def change + rename_column :spree_promotion_rules, :activator_id, :promotion_id + rename_column :spree_promotion_actions, :activator_id, :promotion_id + end +end diff --git a/db/migrate/20161201175557_add_deleted_at_to_spree_prices.spree.rb b/db/migrate/20161201175557_add_deleted_at_to_spree_prices.spree.rb new file mode 100644 index 0000000..9f070d1 --- /dev/null +++ b/db/migrate/20161201175557_add_deleted_at_to_spree_prices.spree.rb @@ -0,0 +1,6 @@ +# This migration comes from spree (originally 20140129024326) +class AddDeletedAtToSpreePrices < ActiveRecord::Migration + def change + add_column :spree_prices, :deleted_at, :datetime + end +end diff --git a/db/migrate/20161201175558_add_approver_id_and_approved_at_to_orders.spree.rb b/db/migrate/20161201175558_add_approver_id_and_approved_at_to_orders.spree.rb new file mode 100644 index 0000000..8f3761b --- /dev/null +++ b/db/migrate/20161201175558_add_approver_id_and_approved_at_to_orders.spree.rb @@ -0,0 +1,7 @@ +# This migration comes from spree (originally 20140203161722) +class AddApproverIdAndApprovedAtToOrders < ActiveRecord::Migration + def change + add_column :spree_orders, :approver_id, :integer + add_column :spree_orders, :approved_at, :datetime + end +end diff --git a/db/migrate/20161201175559_add_confirmation_delivered_to_spree_orders.spree.rb b/db/migrate/20161201175559_add_confirmation_delivered_to_spree_orders.spree.rb new file mode 100644 index 0000000..3ab7b9e --- /dev/null +++ b/db/migrate/20161201175559_add_confirmation_delivered_to_spree_orders.spree.rb @@ -0,0 +1,6 @@ +# This migration comes from spree (originally 20140204115338) +class AddConfirmationDeliveredToSpreeOrders < ActiveRecord::Migration + def change + add_column :spree_orders, :confirmation_delivered, :boolean, default: false + end +end diff --git a/db/migrate/20161201175560_add_auto_capture_to_payment_methods.spree.rb b/db/migrate/20161201175560_add_auto_capture_to_payment_methods.spree.rb new file mode 100644 index 0000000..7dcfda8 --- /dev/null +++ b/db/migrate/20161201175560_add_auto_capture_to_payment_methods.spree.rb @@ -0,0 +1,6 @@ +# This migration comes from spree (originally 20140204192230) +class AddAutoCaptureToPaymentMethods < ActiveRecord::Migration + def change + add_column :spree_payment_methods, :auto_capture, :boolean + end +end diff --git a/db/migrate/20161201175561_create_spree_payment_capture_events.spree.rb b/db/migrate/20161201175561_create_spree_payment_capture_events.spree.rb new file mode 100644 index 0000000..c3096b8 --- /dev/null +++ b/db/migrate/20161201175561_create_spree_payment_capture_events.spree.rb @@ -0,0 +1,13 @@ +# This migration comes from spree (originally 20140205120320) +class CreateSpreePaymentCaptureEvents < ActiveRecord::Migration + def change + create_table :spree_payment_capture_events do |t| + t.decimal :amount, precision: 10, scale: 2, default: 0.0 + t.integer :payment_id + + t.timestamps null: false + end + + add_index :spree_payment_capture_events, :payment_id + end +end diff --git a/db/migrate/20161201175562_add_uncaptured_amount_to_payments.spree.rb b/db/migrate/20161201175562_add_uncaptured_amount_to_payments.spree.rb new file mode 100644 index 0000000..2bf2a63 --- /dev/null +++ b/db/migrate/20161201175562_add_uncaptured_amount_to_payments.spree.rb @@ -0,0 +1,6 @@ +# This migration comes from spree (originally 20140205144710) +class AddUncapturedAmountToPayments < ActiveRecord::Migration + def change + add_column :spree_payments, :uncaptured_amount, :decimal, precision: 10, scale: 2, default: 0.0 + end +end diff --git a/db/migrate/20161201175563_default_variant_weight_to_zero.spree.rb b/db/migrate/20161201175563_default_variant_weight_to_zero.spree.rb new file mode 100644 index 0000000..97cfb53 --- /dev/null +++ b/db/migrate/20161201175563_default_variant_weight_to_zero.spree.rb @@ -0,0 +1,12 @@ +# This migration comes from spree (originally 20140205181631) +class DefaultVariantWeightToZero < ActiveRecord::Migration + def up + Spree::Variant.unscoped.where(weight: nil).update_all("weight = 0.0") + + change_column :spree_variants, :weight, :decimal, precision: 8, scale: 2, default: 0.0 + end + + def down + change_column :spree_variants, :weight, :decimal, precision: 8, scale: 2 + end +end diff --git a/db/migrate/20161201175564_add_tax_category_id_to_shipping_methods.spree.rb b/db/migrate/20161201175564_add_tax_category_id_to_shipping_methods.spree.rb new file mode 100644 index 0000000..882be78 --- /dev/null +++ b/db/migrate/20161201175564_add_tax_category_id_to_shipping_methods.spree.rb @@ -0,0 +1,6 @@ +# This migration comes from spree (originally 20140207085910) +class AddTaxCategoryIdToShippingMethods < ActiveRecord::Migration + def change + add_column :spree_shipping_methods, :tax_category_id, :integer + end +end diff --git a/db/migrate/20161201175565_add_tax_rate_id_to_shipping_rates.spree.rb b/db/migrate/20161201175565_add_tax_rate_id_to_shipping_rates.spree.rb new file mode 100644 index 0000000..2896fc5 --- /dev/null +++ b/db/migrate/20161201175565_add_tax_rate_id_to_shipping_rates.spree.rb @@ -0,0 +1,6 @@ +# This migration comes from spree (originally 20140207093021) +class AddTaxRateIdToShippingRates < ActiveRecord::Migration + def change + add_column :spree_shipping_rates, :tax_rate_id, :integer + end +end diff --git a/db/migrate/20161201175566_add_pre_tax_amount_to_line_items_and_shipments.spree.rb b/db/migrate/20161201175566_add_pre_tax_amount_to_line_items_and_shipments.spree.rb new file mode 100644 index 0000000..f927fe5 --- /dev/null +++ b/db/migrate/20161201175566_add_pre_tax_amount_to_line_items_and_shipments.spree.rb @@ -0,0 +1,7 @@ +# This migration comes from spree (originally 20140211040159) +class AddPreTaxAmountToLineItemsAndShipments < ActiveRecord::Migration + def change + add_column :spree_line_items, :pre_tax_amount, :decimal, precision: 8, scale: 2 + add_column :spree_shipments, :pre_tax_amount, :decimal, precision: 8, scale: 2 + end +end diff --git a/db/migrate/20161201175567_add_more_indexes.spree.rb b/db/migrate/20161201175567_add_more_indexes.spree.rb new file mode 100644 index 0000000..0061034 --- /dev/null +++ b/db/migrate/20161201175567_add_more_indexes.spree.rb @@ -0,0 +1,14 @@ +# This migration comes from spree (originally 20140213184916) +class AddMoreIndexes < ActiveRecord::Migration + def change + add_index :spree_payment_methods, [:id, :type] + add_index :spree_calculators, [:id, :type] + add_index :spree_calculators, [:calculable_id, :calculable_type] + add_index :spree_payments, :payment_method_id + add_index :spree_promotion_actions, [:id, :type] + add_index :spree_promotion_actions, :promotion_id + add_index :spree_promotions, [:id, :type] + add_index :spree_option_values, :option_type_id + add_index :spree_shipments, :stock_location_id + end +end diff --git a/db/migrate/20161201175568_add_considered_risky_to_orders.spree.rb b/db/migrate/20161201175568_add_considered_risky_to_orders.spree.rb new file mode 100644 index 0000000..7d737a2 --- /dev/null +++ b/db/migrate/20161201175568_add_considered_risky_to_orders.spree.rb @@ -0,0 +1,6 @@ +# This migration comes from spree (originally 20140219060952) +class AddConsideredRiskyToOrders < ActiveRecord::Migration + def change + add_column :spree_orders, :considered_risky, :boolean, :default => false + end +end diff --git a/db/migrate/20161201175569_add_preference_store_to_everything.spree.rb b/db/migrate/20161201175569_add_preference_store_to_everything.spree.rb new file mode 100644 index 0000000..9f03385 --- /dev/null +++ b/db/migrate/20161201175569_add_preference_store_to_everything.spree.rb @@ -0,0 +1,9 @@ +# This migration comes from spree (originally 20140227112348) +class AddPreferenceStoreToEverything < ActiveRecord::Migration + def change + add_column :spree_calculators, :preferences, :text + add_column :spree_gateways, :preferences, :text + add_column :spree_payment_methods, :preferences, :text + add_column :spree_promotion_rules, :preferences, :text + end +end diff --git a/db/migrate/20161201175570_add_user_id_to_spree_credit_cards.spree.rb b/db/migrate/20161201175570_add_user_id_to_spree_credit_cards.spree.rb new file mode 100644 index 0000000..ebdde9c --- /dev/null +++ b/db/migrate/20161201175570_add_user_id_to_spree_credit_cards.spree.rb @@ -0,0 +1,14 @@ +# This migration comes from spree (originally 20140307235515) +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 + + 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/20161201175571_migrate_old_preferences.spree.rb b/db/migrate/20161201175571_migrate_old_preferences.spree.rb new file mode 100644 index 0000000..7cdd9ef --- /dev/null +++ b/db/migrate/20161201175571_migrate_old_preferences.spree.rb @@ -0,0 +1,24 @@ +# This migration comes from spree (originally 20140309023735) +class MigrateOldPreferences < ActiveRecord::Migration + def up + migrate_preferences(Spree::Calculator) + migrate_preferences(Spree::PaymentMethod) + migrate_preferences(Spree::PromotionRule) + end + + def down + end + + private + def migrate_preferences klass + klass.reset_column_information + klass.find_each do |record| + store = Spree::Preferences::ScopedStore.new(record.class.name.underscore, record.id) + record.defined_preferences.each do |key| + value = store.fetch(key){} + record.preferences[key] = value unless value.nil? + end + record.save! + end + end +end diff --git a/db/migrate/20161201175572_create_spree_stores.spree.rb b/db/migrate/20161201175572_create_spree_stores.spree.rb new file mode 100644 index 0000000..2c7fb15 --- /dev/null +++ b/db/migrate/20161201175572_create_spree_stores.spree.rb @@ -0,0 +1,26 @@ +# This migration comes from spree (originally 20140309024355) +class CreateSpreeStores < ActiveRecord::Migration + def change + if table_exists?(:spree_stores) + rename_column :spree_stores, :domains, :url + rename_column :spree_stores, :email, :mail_from_address + add_column :spree_stores, :meta_description, :text + add_column :spree_stores, :meta_keywords, :text + add_column :spree_stores, :seo_title, :string + else + create_table :spree_stores do |t| + t.string :name + t.string :url + t.text :meta_description + t.text :meta_keywords + t.string :seo_title + t.string :mail_from_address + t.string :default_currency + t.string :code + t.boolean :default, default: false, null: false + + t.timestamps null: false + end + end + end +end diff --git a/db/migrate/20161201175573_create_store_from_preferences.spree.rb b/db/migrate/20161201175573_create_store_from_preferences.spree.rb new file mode 100644 index 0000000..7e70728 --- /dev/null +++ b/db/migrate/20161201175573_create_store_from_preferences.spree.rb @@ -0,0 +1,38 @@ +# This migration comes from spree (originally 20140309033438) +class CreateStoreFromPreferences < ActiveRecord::Migration + def change + # workaround for spree_i18n and Store translations + Spree::Store.class_eval do + def self.translated?(name) + false + end + end + + preference_store = Spree::Preferences::Store.instance + if store = Spree::Store.where(default: true).first + store.meta_description = preference_store.get('spree/app_configuration/default_meta_description') {} + store.meta_keywords = preference_store.get('spree/app_configuration/default_meta_keywords') {} + store.seo_title = preference_store.get('spree/app_configuration/default_seo_title') {} + store.save! + else + # we set defaults for the things we now require + Spree::Store.new do |s| + s.name = preference_store.get 'spree/app_configuration/site_name' do + 'Spree Demo Site' + end + s.url = preference_store.get 'spree/app_configuration/site_url' do + 'demo.spreecommerce.com' + end + s.mail_from_address = preference_store.get 'spree/app_configuration/mails_from' do + 'spree@example.com' + end + + s.meta_description = preference_store.get('spree/app_configuration/default_meta_description') {} + s.meta_keywords = preference_store.get('spree/app_configuration/default_meta_keywords') {} + s.seo_title = preference_store.get('spree/app_configuration/default_seo_title') {} + s.default_currency = preference_store.get('spree/app_configuration/currency') {} + s.code = 'spree' + end.save! + end + end +end diff --git a/db/migrate/20161201175574_add_timestamps_to_spree_assets.spree.rb b/db/migrate/20161201175574_add_timestamps_to_spree_assets.spree.rb new file mode 100644 index 0000000..5e5ae04 --- /dev/null +++ b/db/migrate/20161201175574_add_timestamps_to_spree_assets.spree.rb @@ -0,0 +1,7 @@ +# This migration comes from spree (originally 20140315053743) +class AddTimestampsToSpreeAssets < ActiveRecord::Migration + def change + add_column :spree_assets, :created_at, :datetime + add_column :spree_assets, :updated_at, :datetime + end +end diff --git a/db/migrate/20161201175575_create_spree_taxons_promotion_rules.spree.rb b/db/migrate/20161201175575_create_spree_taxons_promotion_rules.spree.rb new file mode 100644 index 0000000..07d07f7 --- /dev/null +++ b/db/migrate/20161201175575_create_spree_taxons_promotion_rules.spree.rb @@ -0,0 +1,9 @@ +# This migration comes from spree (originally 20140318191500) +class CreateSpreeTaxonsPromotionRules < ActiveRecord::Migration + def change + create_table :spree_taxons_promotion_rules do |t| + t.references :taxon, index: true + t.references :promotion_rule, index: true + end + end +end diff --git a/db/migrate/20161201175576_add_additional_store_fields.spree.rb b/db/migrate/20161201175576_add_additional_store_fields.spree.rb new file mode 100644 index 0000000..9ac1168 --- /dev/null +++ b/db/migrate/20161201175576_add_additional_store_fields.spree.rb @@ -0,0 +1,9 @@ +# This migration comes from spree (originally 20140331100557) +class AddAdditionalStoreFields < ActiveRecord::Migration + def change + add_column :spree_stores, :code, :string unless column_exists?(:spree_stores, :code) + add_column :spree_stores, :default, :boolean, default: false, null: false unless column_exists?(:spree_stores, :default) + add_index :spree_stores, :code + add_index :spree_stores, :default + end +end diff --git a/db/migrate/20161201175577_add_many_missing_indexes.spree.rb b/db/migrate/20161201175577_add_many_missing_indexes.spree.rb new file mode 100644 index 0000000..cfa0d0e --- /dev/null +++ b/db/migrate/20161201175577_add_many_missing_indexes.spree.rb @@ -0,0 +1,19 @@ +# This migration comes from spree (originally 20140410141842) +class AddManyMissingIndexes < ActiveRecord::Migration + def change + add_index :spree_adjustments, [:adjustable_id, :adjustable_type] + add_index :spree_adjustments, :eligible + add_index :spree_adjustments, :order_id + add_index :spree_promotions, :code + add_index :spree_promotions, :expires_at + add_index :spree_states, :country_id + add_index :spree_stock_items, :deleted_at + add_index :spree_option_types, :position + add_index :spree_option_values, :position + add_index :spree_product_option_types, :option_type_id + add_index :spree_product_option_types, :product_id + add_index :spree_products_taxons, :position + add_index :spree_promotions, :starts_at + add_index :spree_stores, :url + end +end diff --git a/db/migrate/20161201175578_correct_some_polymorphic_index_and_add_more_missing.spree.rb b/db/migrate/20161201175578_correct_some_polymorphic_index_and_add_more_missing.spree.rb new file mode 100644 index 0000000..6f711f6 --- /dev/null +++ b/db/migrate/20161201175578_correct_some_polymorphic_index_and_add_more_missing.spree.rb @@ -0,0 +1,67 @@ +# This migration comes from spree (originally 20140410150358) +class CorrectSomePolymorphicIndexAndAddMoreMissing < ActiveRecord::Migration + def change + add_index :spree_addresses, :country_id + add_index :spree_addresses, :state_id + remove_index :spree_adjustments, [:source_type, :source_id] + add_index :spree_adjustments, [:source_id, :source_type] + add_index :spree_credit_cards, :address_id + add_index :spree_gateways, :active + add_index :spree_gateways, :test_mode + add_index :spree_inventory_units, :return_authorization_id + add_index :spree_line_items, :tax_category_id + add_index :spree_log_entries, [:source_id, :source_type] + add_index :spree_orders, :approver_id + add_index :spree_orders, :bill_address_id + add_index :spree_orders, :confirmation_delivered + add_index :spree_orders, :considered_risky + add_index :spree_orders, :created_by_id + add_index :spree_orders, :ship_address_id + add_index :spree_orders, :shipping_method_id + add_index :spree_orders_promotions, [:order_id, :promotion_id] + add_index :spree_payments, [:source_id, :source_type] + add_index :spree_prices, :deleted_at + add_index :spree_product_option_types, :position + add_index :spree_product_properties, :position + add_index :spree_product_properties, :property_id + add_index :spree_products, :shipping_category_id + add_index :spree_products, :tax_category_id + add_index :spree_promotion_action_line_items, :promotion_action_id + add_index :spree_promotion_action_line_items, :variant_id + add_index :spree_promotion_rules, :promotion_id + add_index :spree_promotions, :advertise + add_index :spree_return_authorizations, :number + add_index :spree_return_authorizations, :order_id + add_index :spree_return_authorizations, :stock_location_id + add_index :spree_shipments, :address_id + add_index :spree_shipping_methods, :deleted_at + add_index :spree_shipping_methods, :tax_category_id + add_index :spree_shipping_rates, :selected + add_index :spree_shipping_rates, :tax_rate_id + add_index :spree_state_changes, [:stateful_id, :stateful_type] + add_index :spree_state_changes, :user_id + add_index :spree_stock_items, :backorderable + add_index :spree_stock_locations, :active + add_index :spree_stock_locations, :backorderable_default + add_index :spree_stock_locations, :country_id + add_index :spree_stock_locations, :propagate_all_variants + add_index :spree_stock_locations, :state_id + add_index :spree_tax_categories, :deleted_at + add_index :spree_tax_categories, :is_default + add_index :spree_tax_rates, :deleted_at + add_index :spree_tax_rates, :included_in_price + add_index :spree_tax_rates, :show_rate_in_label + add_index :spree_tax_rates, :tax_category_id + add_index :spree_tax_rates, :zone_id + add_index :spree_taxonomies, :position + add_index :spree_taxons, :position + add_index :spree_trackers, :active + add_index :spree_variants, :deleted_at + add_index :spree_variants, :is_master + add_index :spree_variants, :position + add_index :spree_variants, :track_inventory + add_index :spree_zone_members, :zone_id + add_index :spree_zone_members, [:zoneable_id, :zoneable_type] + add_index :spree_zones, :default_tax + end +end diff --git a/db/migrate/20161201175579_add_user_id_created_by_id_index_to_order.spree.rb b/db/migrate/20161201175579_add_user_id_created_by_id_index_to_order.spree.rb new file mode 100644 index 0000000..b2d648d --- /dev/null +++ b/db/migrate/20161201175579_add_user_id_created_by_id_index_to_order.spree.rb @@ -0,0 +1,6 @@ +# This migration comes from spree (originally 20140415041315) +class AddUserIdCreatedByIdIndexToOrder < ActiveRecord::Migration + def change + add_index :spree_orders, [:user_id, :created_by_id] + end +end diff --git a/db/migrate/20161201175580_change_spree_price_amount_precision.spree.rb b/db/migrate/20161201175580_change_spree_price_amount_precision.spree.rb new file mode 100644 index 0000000..8a02e8c --- /dev/null +++ b/db/migrate/20161201175580_change_spree_price_amount_precision.spree.rb @@ -0,0 +1,9 @@ +# This migration comes from spree (originally 20140508151342) +class ChangeSpreePriceAmountPrecision < ActiveRecord::Migration + def change + change_column :spree_prices, :amount, :decimal, :precision => 10, :scale => 2 + change_column :spree_line_items, :price, :decimal, :precision => 10, :scale => 2 + change_column :spree_line_items, :cost_price, :decimal, :precision => 10, :scale => 2 + change_column :spree_variants, :cost_price, :decimal, :precision => 10, :scale => 2 + end +end diff --git a/db/migrate/20161201175581_add_token_to_spree_orders.spree.rb b/db/migrate/20161201175581_add_token_to_spree_orders.spree.rb new file mode 100644 index 0000000..5ecc87e --- /dev/null +++ b/db/migrate/20161201175581_add_token_to_spree_orders.spree.rb @@ -0,0 +1,6 @@ +# This migration comes from spree (originally 20140518174634) +class AddTokenToSpreeOrders < ActiveRecord::Migration + def change + add_column :spree_orders, :guest_token, :string + end +end diff --git a/db/migrate/20161201175582_move_order_token_from_tokenized_permission.spree.rb b/db/migrate/20161201175582_move_order_token_from_tokenized_permission.spree.rb new file mode 100644 index 0000000..a65ff27 --- /dev/null +++ b/db/migrate/20161201175582_move_order_token_from_tokenized_permission.spree.rb @@ -0,0 +1,30 @@ +# This migration comes from spree (originally 20140530024945) +class MoveOrderTokenFromTokenizedPermission < ActiveRecord::Migration + class Spree::TokenizedPermission < Spree::Base + belongs_to :permissable, polymorphic: true + end + + def up + case Spree::Order.connection.adapter_name + when 'SQLite' + Spree::Order.has_one :tokenized_permission, :as => :permissable + Spree::Order.includes(:tokenized_permission).each do |o| + o.update_column :guest_token, o.tokenized_permission.token + end + when 'Mysql2', 'MySQL' + execute "UPDATE spree_orders, spree_tokenized_permissions + SET spree_orders.guest_token = spree_tokenized_permissions.token + WHERE spree_tokenized_permissions.permissable_id = spree_orders.id + AND spree_tokenized_permissions.permissable_type = 'Spree::Order'" + else + execute "UPDATE spree_orders + SET guest_token = spree_tokenized_permissions.token + FROM spree_tokenized_permissions + WHERE spree_tokenized_permissions.permissable_id = spree_orders.id + AND spree_tokenized_permissions.permissable_type = 'Spree::Order'" + end + end + + def down + end +end diff --git a/db/migrate/20161201175583_set_shipment_total_for_users_upgrading.spree.rb b/db/migrate/20161201175583_set_shipment_total_for_users_upgrading.spree.rb new file mode 100644 index 0000000..42e9a46 --- /dev/null +++ b/db/migrate/20161201175583_set_shipment_total_for_users_upgrading.spree.rb @@ -0,0 +1,11 @@ +# This migration comes from spree (originally 20140601011216) +class SetShipmentTotalForUsersUpgrading < ActiveRecord::Migration + def up + # NOTE You might not need this at all unless you're upgrading from Spree 2.1.x + # or below. For those upgrading this should populate the Order#shipment_total + # for legacy orders + Spree::Order.complete.where('shipment_total = ?', 0).includes(:shipments).find_each do |order| + order.update_column(:shipment_total, order.shipments.sum(:cost)) + end + end +end diff --git a/db/migrate/20161201175584_drop_credit_card_first_name_and_last_name.spree.rb b/db/migrate/20161201175584_drop_credit_card_first_name_and_last_name.spree.rb new file mode 100644 index 0000000..e563b0f --- /dev/null +++ b/db/migrate/20161201175584_drop_credit_card_first_name_and_last_name.spree.rb @@ -0,0 +1,7 @@ +# This migration comes from spree (originally 20140604135309) +class DropCreditCardFirstNameAndLastName < ActiveRecord::Migration + def change + remove_column :spree_credit_cards, :first_name, :string + remove_column :spree_credit_cards, :last_name, :string + end +end diff --git a/db/migrate/20161201175585_add_deleted_at_to_spree_promotion_actions.spree.rb b/db/migrate/20161201175585_add_deleted_at_to_spree_promotion_actions.spree.rb new file mode 100644 index 0000000..870e6e6 --- /dev/null +++ b/db/migrate/20161201175585_add_deleted_at_to_spree_promotion_actions.spree.rb @@ -0,0 +1,7 @@ +# This migration comes from spree (originally 20140609201656) +class AddDeletedAtToSpreePromotionActions < ActiveRecord::Migration + def change + add_column :spree_promotion_actions, :deleted_at, :datetime + add_index :spree_promotion_actions, :deleted_at + end +end diff --git a/db/migrate/20161201175586_remove_uncaptured_amount_from_spree_payments.spree.rb b/db/migrate/20161201175586_remove_uncaptured_amount_from_spree_payments.spree.rb new file mode 100644 index 0000000..e12eb3a --- /dev/null +++ b/db/migrate/20161201175586_remove_uncaptured_amount_from_spree_payments.spree.rb @@ -0,0 +1,6 @@ +# This migration comes from spree (originally 20140616202624) +class RemoveUncapturedAmountFromSpreePayments < ActiveRecord::Migration + def change + remove_column :spree_payments, :uncaptured_amount + end +end diff --git a/db/migrate/20161201175587_create_spree_refunds.spree.rb b/db/migrate/20161201175587_create_spree_refunds.spree.rb new file mode 100644 index 0000000..e541de6 --- /dev/null +++ b/db/migrate/20161201175587_create_spree_refunds.spree.rb @@ -0,0 +1,13 @@ +# This migration comes from spree (originally 20140625214618) +class CreateSpreeRefunds < ActiveRecord::Migration + def change + create_table :spree_refunds do |t| + t.integer :payment_id + t.integer :return_authorization_id + t.decimal :amount, precision: 10, scale: 2, default: 0.0, null: false + t.string :transaction_id + + t.timestamps null: false + end + end +end diff --git a/db/migrate/20161201175588_create_spree_return_authorization_inventory_unit.spree.rb b/db/migrate/20161201175588_create_spree_return_authorization_inventory_unit.spree.rb new file mode 100644 index 0000000..1b415e2 --- /dev/null +++ b/db/migrate/20161201175588_create_spree_return_authorization_inventory_unit.spree.rb @@ -0,0 +1,13 @@ +# This migration comes from spree (originally 20140702140656) +class CreateSpreeReturnAuthorizationInventoryUnit < ActiveRecord::Migration + def change + create_table :spree_return_authorization_inventory_units do |t| + t.integer :return_authorization_id + t.integer :inventory_unit_id + t.integer :exchange_variant_id + t.datetime :received_at + + t.timestamps null: false + end + end +end diff --git a/db/migrate/20161201175589_rename_return_authorization_inventory_unit_to_return_items.spree.rb b/db/migrate/20161201175589_rename_return_authorization_inventory_unit_to_return_items.spree.rb new file mode 100644 index 0000000..d9fb50c --- /dev/null +++ b/db/migrate/20161201175589_rename_return_authorization_inventory_unit_to_return_items.spree.rb @@ -0,0 +1,6 @@ +# This migration comes from spree (originally 20140707125621) +class RenameReturnAuthorizationInventoryUnitToReturnItems < ActiveRecord::Migration + def change + rename_table :spree_return_authorization_inventory_units, :spree_return_items + end +end diff --git a/db/migrate/20161201175590_backfill_line_item_pre_tax_amount.spree.rb b/db/migrate/20161201175590_backfill_line_item_pre_tax_amount.spree.rb new file mode 100644 index 0000000..6897a88 --- /dev/null +++ b/db/migrate/20161201175590_backfill_line_item_pre_tax_amount.spree.rb @@ -0,0 +1,11 @@ +# This migration comes from spree (originally 20140709160534) +class BackfillLineItemPreTaxAmount < ActiveRecord::Migration + def change + # set pre_tax_amount to discounted_amount - included_tax_total + execute(<<-SQL) + UPDATE spree_line_items + SET pre_tax_amount = ((price * quantity) + promo_total) - included_tax_total + WHERE pre_tax_amount IS NULL; + SQL + end +end diff --git a/db/migrate/20161201175591_recreate_spree_return_authorizations.spree.rb b/db/migrate/20161201175591_recreate_spree_return_authorizations.spree.rb new file mode 100644 index 0000000..b59c2a3 --- /dev/null +++ b/db/migrate/20161201175591_recreate_spree_return_authorizations.spree.rb @@ -0,0 +1,56 @@ +# This migration comes from spree (originally 20140710041921) +class RecreateSpreeReturnAuthorizations < ActiveRecord::Migration + def up + # If the app has any legacy return authorizations then rename the table & columns and leave them there + # for the spree_legacy_return_authorizations extension to pick up with. + # Otherwise just drop the tables/columns as they are no longer used in stock spree. The spree_legacy_return_authorizations + # extension will recreate these tables for dev environments & etc as needed. + if Spree::ReturnAuthorization.exists? + rename_table :spree_return_authorizations, :spree_legacy_return_authorizations + rename_column :spree_inventory_units, :return_authorization_id, :legacy_return_authorization_id + else + drop_table :spree_return_authorizations + remove_column :spree_inventory_units, :return_authorization_id + end + + Spree::Adjustment.where(source_type: 'Spree::ReturnAuthorization').update_all(source_type: 'Spree::LegacyReturnAuthorization') + + # For now just recreate the table as it was. Future changes to the schema (including dropping "amount") will be coming in a + # separate commit. + create_table :spree_return_authorizations do |t| + t.string "number" + t.string "state" + t.decimal "amount", precision: 10, scale: 2, default: 0.0, null: false + t.integer "order_id" + t.text "reason" + t.datetime "created_at" + t.datetime "updated_at" + t.integer "stock_location_id" + end + + end + + def down + drop_table :spree_return_authorizations + + Spree::Adjustment.where(source_type: 'Spree::LegacyReturnAuthorization').update_all(source_type: 'Spree::ReturnAuthorization') + + if table_exists?(:spree_legacy_return_authorizations) + rename_table :spree_legacy_return_authorizations, :spree_return_authorizations + rename_column :spree_inventory_units, :legacy_return_authorization_id, :return_authorization_id + else + create_table :spree_return_authorizations do |t| + t.string "number" + t.string "state" + t.decimal "amount", precision: 10, scale: 2, default: 0.0, null: false + t.integer "order_id" + t.text "reason" + t.datetime "created_at" + t.datetime "updated_at" + t.integer "stock_location_id" + end + add_column :spree_inventory_units, :return_authorization_id, :integer, after: :shipment_id + add_index :spree_inventory_units, :return_authorization_id + end + end +end diff --git a/db/migrate/20161201175592_add_amount_fields_to_return_items.spree.rb b/db/migrate/20161201175592_add_amount_fields_to_return_items.spree.rb new file mode 100644 index 0000000..87bb829 --- /dev/null +++ b/db/migrate/20161201175592_add_amount_fields_to_return_items.spree.rb @@ -0,0 +1,8 @@ +# This migration comes from spree (originally 20140710181204) +class AddAmountFieldsToReturnItems < ActiveRecord::Migration + def change + add_column :spree_return_items, :pre_tax_amount, :decimal, precision: 10, scale: 2, default: 0.0, null: false + add_column :spree_return_items, :included_tax_total, :decimal, precision: 10, scale: 2, default: 0.0, null: false + add_column :spree_return_items, :additional_tax_total, :decimal, precision: 10, scale: 2, default: 0.0, null: false + end +end diff --git a/db/migrate/20161201175593_drop_return_authorization_amount.spree.rb b/db/migrate/20161201175593_drop_return_authorization_amount.spree.rb new file mode 100644 index 0000000..6c86f2b --- /dev/null +++ b/db/migrate/20161201175593_drop_return_authorization_amount.spree.rb @@ -0,0 +1,6 @@ +# This migration comes from spree (originally 20140710190048) +class DropReturnAuthorizationAmount < ActiveRecord::Migration + def change + remove_column :spree_return_authorizations, :amount + end +end diff --git a/db/migrate/20161201175594_create_spree_return_authorization_reasons.spree.rb b/db/migrate/20161201175594_create_spree_return_authorization_reasons.spree.rb new file mode 100644 index 0000000..2404e3d --- /dev/null +++ b/db/migrate/20161201175594_create_spree_return_authorization_reasons.spree.rb @@ -0,0 +1,29 @@ +# This migration comes from spree (originally 20140713140455) +class CreateSpreeReturnAuthorizationReasons < ActiveRecord::Migration + def change + create_table :spree_return_authorization_reasons do |t| + t.string :name + t.boolean :active, default: true + t.boolean :mutable, default: true + + t.timestamps null: false + end + + reversible do |direction| + direction.up do + Spree::ReturnAuthorizationReason.create!(name: 'Better price available') + Spree::ReturnAuthorizationReason.create!(name: 'Missed estimated delivery date') + Spree::ReturnAuthorizationReason.create!(name: 'Missing parts or accessories') + Spree::ReturnAuthorizationReason.create!(name: 'Damaged/Defective') + Spree::ReturnAuthorizationReason.create!(name: 'Different from what was ordered') + Spree::ReturnAuthorizationReason.create!(name: 'Different from description') + Spree::ReturnAuthorizationReason.create!(name: 'No longer needed/wanted') + Spree::ReturnAuthorizationReason.create!(name: 'Accidental order') + Spree::ReturnAuthorizationReason.create!(name: 'Unauthorized purchase') + end + end + + add_column :spree_return_authorizations, :return_authorization_reason_id, :integer + add_index :spree_return_authorizations, :return_authorization_reason_id, name: 'index_return_authorizations_on_return_authorization_reason_id' + end +end diff --git a/db/migrate/20161201175595_create_spree_refund_reasons.spree.rb b/db/migrate/20161201175595_create_spree_refund_reasons.spree.rb new file mode 100644 index 0000000..c4aeb2a --- /dev/null +++ b/db/migrate/20161201175595_create_spree_refund_reasons.spree.rb @@ -0,0 +1,15 @@ +# This migration comes from spree (originally 20140713140527) +class CreateSpreeRefundReasons < ActiveRecord::Migration + def change + create_table :spree_refund_reasons do |t| + t.string :name + t.boolean :active, default: true + t.boolean :mutable, default: true + + t.timestamps null: false + end + + add_column :spree_refunds, :refund_reason_id, :integer + add_index :spree_refunds, :refund_reason_id, name: 'index_refunds_on_refund_reason_id' + end +end diff --git a/db/migrate/20161201175596_rename_return_authorization_reason.spree.rb b/db/migrate/20161201175596_rename_return_authorization_reason.spree.rb new file mode 100644 index 0000000..cd3658a --- /dev/null +++ b/db/migrate/20161201175596_rename_return_authorization_reason.spree.rb @@ -0,0 +1,6 @@ +# This migration comes from spree (originally 20140713142214) +class RenameReturnAuthorizationReason < ActiveRecord::Migration + def change + rename_column :spree_return_authorizations, :reason, :memo + end +end diff --git a/db/migrate/20161201175597_create_spree_promotion_categories.spree.rb b/db/migrate/20161201175597_create_spree_promotion_categories.spree.rb new file mode 100644 index 0000000..623a41b --- /dev/null +++ b/db/migrate/20161201175597_create_spree_promotion_categories.spree.rb @@ -0,0 +1,12 @@ +# This migration comes from spree (originally 20140715182625) +class CreateSpreePromotionCategories < ActiveRecord::Migration + def change + create_table :spree_promotion_categories do |t| + t.string :name + t.timestamps null: false + end + + add_column :spree_promotions, :promotion_category_id, :integer + add_index :spree_promotions, :promotion_category_id + end +end diff --git a/db/migrate/20161201175598_drop_received_at_on_return_items.spree.rb b/db/migrate/20161201175598_drop_received_at_on_return_items.spree.rb new file mode 100644 index 0000000..29b54b8 --- /dev/null +++ b/db/migrate/20161201175598_drop_received_at_on_return_items.spree.rb @@ -0,0 +1,10 @@ +# This migration comes from spree (originally 20140716204111) +class DropReceivedAtOnReturnItems < ActiveRecord::Migration + def up + remove_column :spree_return_items, :received_at + end + + def down + add_column :spree_return_items, :received_at, :datetime + end +end diff --git a/db/migrate/20161201175599_add_reception_and_acceptance_status_to_return_items.spree.rb b/db/migrate/20161201175599_add_reception_and_acceptance_status_to_return_items.spree.rb new file mode 100644 index 0000000..2190962 --- /dev/null +++ b/db/migrate/20161201175599_add_reception_and_acceptance_status_to_return_items.spree.rb @@ -0,0 +1,7 @@ +# This migration comes from spree (originally 20140716212330) +class AddReceptionAndAcceptanceStatusToReturnItems < ActiveRecord::Migration + def change + add_column :spree_return_items, :reception_status, :string + add_column :spree_return_items, :acceptance_status, :string + end +end diff --git a/db/migrate/20161201175600_create_default_refund_reason.spree.rb b/db/migrate/20161201175600_create_default_refund_reason.spree.rb new file mode 100644 index 0000000..5de95bb --- /dev/null +++ b/db/migrate/20161201175600_create_default_refund_reason.spree.rb @@ -0,0 +1,10 @@ +# This migration comes from spree (originally 20140717155155) +class CreateDefaultRefundReason < ActiveRecord::Migration + def up + Spree::RefundReason.create!(name: Spree::RefundReason::RETURN_PROCESSING_REASON, mutable: false) + end + + def down + Spree::RefundReason.find_by(name: Spree::RefundReason::RETURN_PROCESSING_REASON, mutable: false).destroy + end +end diff --git a/db/migrate/20161201175601_add_default_to_spree_stock_locations.spree.rb b/db/migrate/20161201175601_add_default_to_spree_stock_locations.spree.rb new file mode 100644 index 0000000..2ed7de6 --- /dev/null +++ b/db/migrate/20161201175601_add_default_to_spree_stock_locations.spree.rb @@ -0,0 +1,8 @@ +# This migration comes from spree (originally 20140717185932) +class AddDefaultToSpreeStockLocations < ActiveRecord::Migration + def change + unless column_exists? :spree_stock_locations, :default + add_column :spree_stock_locations, :default, :boolean, null: false, default: false + end + end +end diff --git a/db/migrate/20161201175602_create_spree_customer_returns.spree.rb b/db/migrate/20161201175602_create_spree_customer_returns.spree.rb new file mode 100644 index 0000000..84cc836 --- /dev/null +++ b/db/migrate/20161201175602_create_spree_customer_returns.spree.rb @@ -0,0 +1,10 @@ +# This migration comes from spree (originally 20140718133010) +class CreateSpreeCustomerReturns < ActiveRecord::Migration + def change + create_table :spree_customer_returns do |t| + t.string :number + t.integer :stock_location_id + t.timestamps null: false + end + end +end diff --git a/db/migrate/20161201175603_add_customer_return_id_to_return_item.spree.rb b/db/migrate/20161201175603_add_customer_return_id_to_return_item.spree.rb new file mode 100644 index 0000000..304cf79 --- /dev/null +++ b/db/migrate/20161201175603_add_customer_return_id_to_return_item.spree.rb @@ -0,0 +1,7 @@ +# This migration comes from spree (originally 20140718133349) +class AddCustomerReturnIdToReturnItem < ActiveRecord::Migration + def change + add_column :spree_return_items, :customer_return_id, :integer + add_index :spree_return_items, :customer_return_id, name: 'index_return_items_on_customer_return_id' + end +end diff --git a/db/migrate/20161201175604_create_friendly_id_slugs.spree.rb b/db/migrate/20161201175604_create_friendly_id_slugs.spree.rb new file mode 100644 index 0000000..6717789 --- /dev/null +++ b/db/migrate/20161201175604_create_friendly_id_slugs.spree.rb @@ -0,0 +1,16 @@ +# This migration comes from spree (originally 20140718195325) +class CreateFriendlyIdSlugs < ActiveRecord::Migration + def change + create_table :friendly_id_slugs do |t| + t.string :slug, :null => false + t.integer :sluggable_id, :null => false + t.string :sluggable_type, :limit => 50 + t.string :scope + t.datetime :created_at + end + add_index :friendly_id_slugs, :sluggable_id + add_index :friendly_id_slugs, [:slug, :sluggable_type] + add_index :friendly_id_slugs, [:slug, :sluggable_type, :scope], :unique => true + add_index :friendly_id_slugs, :sluggable_type + end +end diff --git a/db/migrate/20161201175605_rename_spree_refund_return_authorization_id.spree.rb b/db/migrate/20161201175605_rename_spree_refund_return_authorization_id.spree.rb new file mode 100644 index 0000000..0bacaeb --- /dev/null +++ b/db/migrate/20161201175605_rename_spree_refund_return_authorization_id.spree.rb @@ -0,0 +1,6 @@ +# This migration comes from spree (originally 20140723004419) +class RenameSpreeRefundReturnAuthorizationId < ActiveRecord::Migration + def change + rename_column :spree_refunds, :return_authorization_id, :customer_return_id + end +end diff --git a/db/migrate/20161201175606_increase_return_item_pre_tax_amount_precision.spree.rb b/db/migrate/20161201175606_increase_return_item_pre_tax_amount_precision.spree.rb new file mode 100644 index 0000000..7d93058 --- /dev/null +++ b/db/migrate/20161201175606_increase_return_item_pre_tax_amount_precision.spree.rb @@ -0,0 +1,14 @@ +# This migration comes from spree (originally 20140723152808) +class IncreaseReturnItemPreTaxAmountPrecision < ActiveRecord::Migration + def up + change_column :spree_return_items, :pre_tax_amount, :decimal, precision: 12, scale: 4, default: 0.0, null: false + change_column :spree_return_items, :included_tax_total, :decimal, precision: 12, scale: 4, default: 0.0, null: false + change_column :spree_return_items, :additional_tax_total, :decimal, precision: 12, scale: 4, default: 0.0, null: false + end + + def down + change_column :spree_return_items, :pre_tax_amount, :decimal, precision: 10, scale: 2, default: 0.0, null: false + change_column :spree_return_items, :included_tax_total, :decimal, precision: 10, scale: 2, default: 0.0, null: false + change_column :spree_return_items, :additional_tax_total, :decimal, precision: 10, scale: 2, default: 0.0, null: false + end +end diff --git a/db/migrate/20161201175607_copy_product_slugs_to_slug_history.spree.rb b/db/migrate/20161201175607_copy_product_slugs_to_slug_history.spree.rb new file mode 100644 index 0000000..21cb01b --- /dev/null +++ b/db/migrate/20161201175607_copy_product_slugs_to_slug_history.spree.rb @@ -0,0 +1,16 @@ +# This migration comes from spree (originally 20140723214541) +class CopyProductSlugsToSlugHistory < ActiveRecord::Migration + def change + + # do what sql does best: copy all slugs into history table in a single query + # rather than load potentially millions of products into memory + Spree::Product.connection.execute <<-SQL +INSERT INTO #{FriendlyId::Slug.table_name} (slug, sluggable_id, sluggable_type, created_at) + SELECT slug, id, '#{Spree::Product.to_s}', #{ActiveRecord::Base.send(:sanitize_sql_array, ['?', Time.current])} + FROM #{Spree::Product.table_name} + WHERE slug IS NOT NULL + ORDER BY id +SQL + + end +end diff --git a/db/migrate/20161201175608_create_spree_reimbursements.spree.rb b/db/migrate/20161201175608_create_spree_reimbursements.spree.rb new file mode 100644 index 0000000..e9d90a3 --- /dev/null +++ b/db/migrate/20161201175608_create_spree_reimbursements.spree.rb @@ -0,0 +1,22 @@ +# This migration comes from spree (originally 20140725131539) +class CreateSpreeReimbursements < ActiveRecord::Migration + def change + create_table :spree_reimbursements do |t| + t.string :number + t.string :reimbursement_status + t.integer :customer_return_id + t.integer :order_id + t.decimal :total, precision: 10, scale: 2 + + t.timestamps null: false + end + + add_index :spree_reimbursements, :customer_return_id + add_index :spree_reimbursements, :order_id + + remove_column :spree_refunds, :customer_return_id, :integer + add_column :spree_refunds, :reimbursement_id, :integer + + add_column :spree_return_items, :reimbursement_id, :integer + end +end diff --git a/db/migrate/20161201175609_add_promotionable_to_spree_products.spree.rb b/db/migrate/20161201175609_add_promotionable_to_spree_products.spree.rb new file mode 100644 index 0000000..11b4038 --- /dev/null +++ b/db/migrate/20161201175609_add_promotionable_to_spree_products.spree.rb @@ -0,0 +1,6 @@ +# This migration comes from spree (originally 20140728225422) +class AddPromotionableToSpreeProducts < ActiveRecord::Migration + def change + add_column :spree_products, :promotionable, :boolean, default: true + end +end diff --git a/db/migrate/20161201175610_add_exchange_inventory_unit_foreign_keys.spree.rb b/db/migrate/20161201175610_add_exchange_inventory_unit_foreign_keys.spree.rb new file mode 100644 index 0000000..3ff2eb5 --- /dev/null +++ b/db/migrate/20161201175610_add_exchange_inventory_unit_foreign_keys.spree.rb @@ -0,0 +1,8 @@ +# This migration comes from spree (originally 20140729133613) +class AddExchangeInventoryUnitForeignKeys < ActiveRecord::Migration + def change + add_column :spree_return_items, :exchange_inventory_unit_id, :integer + + add_index :spree_return_items, :exchange_inventory_unit_id + end +end diff --git a/db/migrate/20161201175611_add_acceptance_status_errors_to_return_item.spree.rb b/db/migrate/20161201175611_add_acceptance_status_errors_to_return_item.spree.rb new file mode 100644 index 0000000..a5d69d6 --- /dev/null +++ b/db/migrate/20161201175611_add_acceptance_status_errors_to_return_item.spree.rb @@ -0,0 +1,6 @@ +# This migration comes from spree (originally 20140730155938) +class AddAcceptanceStatusErrorsToReturnItem < ActiveRecord::Migration + def change + add_column :spree_return_items, :acceptance_status_errors, :text + end +end diff --git a/db/migrate/20161201175612_create_spree_reimbursement_types.spree.rb b/db/migrate/20161201175612_create_spree_reimbursement_types.spree.rb new file mode 100644 index 0000000..d1f453e --- /dev/null +++ b/db/migrate/20161201175612_create_spree_reimbursement_types.spree.rb @@ -0,0 +1,21 @@ +# This migration comes from spree (originally 20140731150017) +class CreateSpreeReimbursementTypes < ActiveRecord::Migration + def change + create_table :spree_reimbursement_types do |t| + t.string :name + t.boolean :active, default: true + t.boolean :mutable, default: true + + t.timestamps null: false + end + + reversible do |direction| + direction.up do + Spree::ReimbursementType.create!(name: Spree::ReimbursementType::ORIGINAL) + end + end + + add_column :spree_return_items, :preferred_reimbursement_type_id, :integer + add_column :spree_return_items, :override_reimbursement_type_id, :integer + end +end diff --git a/db/migrate/20161201175613_add_default_to_shipment_cost.spree.rb b/db/migrate/20161201175613_add_default_to_shipment_cost.spree.rb new file mode 100644 index 0000000..6adffa8 --- /dev/null +++ b/db/migrate/20161201175613_add_default_to_shipment_cost.spree.rb @@ -0,0 +1,11 @@ +# This migration comes from spree (originally 20140804185157) +class AddDefaultToShipmentCost < ActiveRecord::Migration + def up + change_column :spree_shipments, :cost, :decimal, precision: 10, scale: 2, default: 0.0 + Spree::Shipment.where(cost: nil).update_all(cost: 0) + end + + def down + change_column :spree_shipments, :cost, :decimal, precision: 10, scale: 2 + end +end diff --git a/db/migrate/20161201175614_add_default_to_spree_credit_cards.spree.rb b/db/migrate/20161201175614_add_default_to_spree_credit_cards.spree.rb new file mode 100644 index 0000000..9ed541e --- /dev/null +++ b/db/migrate/20161201175614_add_default_to_spree_credit_cards.spree.rb @@ -0,0 +1,6 @@ +# This migration comes from spree (originally 20140805171035) +class AddDefaultToSpreeCreditCards < ActiveRecord::Migration + def change + add_column :spree_credit_cards, :default, :boolean, null: false, default: false + end +end diff --git a/db/migrate/20161201175615_make_existing_credit_cards_default.spree.rb b/db/migrate/20161201175615_make_existing_credit_cards_default.spree.rb new file mode 100644 index 0000000..df68c8e --- /dev/null +++ b/db/migrate/20161201175615_make_existing_credit_cards_default.spree.rb @@ -0,0 +1,11 @@ +# This migration comes from spree (originally 20140805171219) +class MakeExistingCreditCardsDefault < ActiveRecord::Migration + def up + # set the newest credit card for every user to be the default; SQL technique from + # http://stackoverflow.com/questions/121387/fetch-the-row-which-has-the-max-value-for-a-column + Spree::CreditCard.where.not(user_id: nil).joins("LEFT OUTER JOIN spree_credit_cards cc2 ON cc2.user_id = spree_credit_cards.user_id AND spree_credit_cards.created_at < cc2.created_at").where("cc2.user_id IS NULL").update_all(default: true) + end + def down + # do nothing + end +end diff --git a/db/migrate/20161201175616_add_type_to_reimbursement_type.spree.rb b/db/migrate/20161201175616_add_type_to_reimbursement_type.spree.rb new file mode 100644 index 0000000..72d468c --- /dev/null +++ b/db/migrate/20161201175616_add_type_to_reimbursement_type.spree.rb @@ -0,0 +1,10 @@ +# This migration comes from spree (originally 20140806144901) +class AddTypeToReimbursementType < ActiveRecord::Migration + def change + add_column :spree_reimbursement_types, :type, :string + add_index :spree_reimbursement_types, :type + + Spree::ReimbursementType.reset_column_information + Spree::ReimbursementType.find_by(name: Spree::ReimbursementType::ORIGINAL).update_attributes!(type: 'Spree::ReimbursementType::OriginalPayment') + end +end diff --git a/db/migrate/20161201175617_create_spree_reimbursement_credits.spree.rb b/db/migrate/20161201175617_create_spree_reimbursement_credits.spree.rb new file mode 100644 index 0000000..79d0ec3 --- /dev/null +++ b/db/migrate/20161201175617_create_spree_reimbursement_credits.spree.rb @@ -0,0 +1,11 @@ +# This migration comes from spree (originally 20140808184039) +class CreateSpreeReimbursementCredits < ActiveRecord::Migration + def change + create_table :spree_reimbursement_credits do |t| + t.decimal :amount, precision: 10, scale: 2, default: 0.0, null: false + t.integer :reimbursement_id + t.integer :creditable_id + t.string :creditable_type + end + end +end diff --git a/db/migrate/20161201175618_add_meta_title_to_spree_products.spree.rb b/db/migrate/20161201175618_add_meta_title_to_spree_products.spree.rb new file mode 100644 index 0000000..cc776f7 --- /dev/null +++ b/db/migrate/20161201175618_add_meta_title_to_spree_products.spree.rb @@ -0,0 +1,8 @@ +# This migration comes from spree (originally 20140827170513) +class AddMetaTitleToSpreeProducts < ActiveRecord::Migration + def change + change_table :spree_products do |t| + t.string :meta_title + end + end +end diff --git a/db/migrate/20161201175619_add_kind_to_zone.spree.rb b/db/migrate/20161201175619_add_kind_to_zone.spree.rb new file mode 100644 index 0000000..f81660a --- /dev/null +++ b/db/migrate/20161201175619_add_kind_to_zone.spree.rb @@ -0,0 +1,12 @@ +# This migration comes from spree (originally 20140911173301) +class AddKindToZone < ActiveRecord::Migration + def change + add_column :spree_zones, :kind, :string + add_index :spree_zones, :kind + + Spree::Zone.find_each do |zone| + last_type = zone.members.where.not(zoneable_type: nil).pluck(:zoneable_type).last + zone.update_column :kind, last_type.demodulize.underscore if last_type + end + end +end diff --git a/db/migrate/20161201175620_add_code_to_spree_tax_categories.spree.rb b/db/migrate/20161201175620_add_code_to_spree_tax_categories.spree.rb new file mode 100644 index 0000000..e5f0793 --- /dev/null +++ b/db/migrate/20161201175620_add_code_to_spree_tax_categories.spree.rb @@ -0,0 +1,6 @@ +# This migration comes from spree (originally 20140924164824) +class AddCodeToSpreeTaxCategories < ActiveRecord::Migration + def change + add_column :spree_tax_categories, :tax_code, :string + end +end diff --git a/db/migrate/20161201175621_default_pre_tax_amount_should_be_zero.spree.rb b/db/migrate/20161201175621_default_pre_tax_amount_should_be_zero.spree.rb new file mode 100644 index 0000000..0f0e024 --- /dev/null +++ b/db/migrate/20161201175621_default_pre_tax_amount_should_be_zero.spree.rb @@ -0,0 +1,7 @@ +# This migration comes from spree (originally 20140927193717) +class DefaultPreTaxAmountShouldBeZero < ActiveRecord::Migration + def change + change_column :spree_line_items, :pre_tax_amount, :decimal, precision: 8, scale: 2, default: 0 + change_column :spree_shipments, :pre_tax_amount, :decimal, precision: 8, scale: 2, default: 0 + end +end diff --git a/db/migrate/20161201175622_add_code_to_spree_shipping_methods.spree.rb b/db/migrate/20161201175622_add_code_to_spree_shipping_methods.spree.rb new file mode 100644 index 0000000..121bcb0 --- /dev/null +++ b/db/migrate/20161201175622_add_code_to_spree_shipping_methods.spree.rb @@ -0,0 +1,6 @@ +# This migration comes from spree (originally 20141002191113) +class AddCodeToSpreeShippingMethods < ActiveRecord::Migration + def change + add_column :spree_shipping_methods, :code, :string + end +end diff --git a/db/migrate/20161201175623_add_cancel_audit_fields_to_spree_orders.spree.rb b/db/migrate/20161201175623_add_cancel_audit_fields_to_spree_orders.spree.rb new file mode 100644 index 0000000..d8af420 --- /dev/null +++ b/db/migrate/20161201175623_add_cancel_audit_fields_to_spree_orders.spree.rb @@ -0,0 +1,7 @@ +# This migration comes from spree (originally 20141007230328) +class AddCancelAuditFieldsToSpreeOrders < ActiveRecord::Migration + def change + add_column :spree_orders, :canceled_at, :datetime + add_column :spree_orders, :canceler_id, :integer + end +end diff --git a/db/migrate/20161201175624_add_store_id_to_orders.spree.rb b/db/migrate/20161201175624_add_store_id_to_orders.spree.rb new file mode 100644 index 0000000..af67742 --- /dev/null +++ b/db/migrate/20161201175624_add_store_id_to_orders.spree.rb @@ -0,0 +1,9 @@ +# This migration comes from spree (originally 20141009204607) +class AddStoreIdToOrders < ActiveRecord::Migration + def change + add_column :spree_orders, :store_id, :integer + if Spree::Store.default.persisted? + Spree::Order.where(store_id: nil).update_all(store_id: Spree::Store.default.id) + end + end +end diff --git a/db/migrate/20161201175625_create_spree_taxons_prototypes.spree.rb b/db/migrate/20161201175625_create_spree_taxons_prototypes.spree.rb new file mode 100644 index 0000000..32f1480 --- /dev/null +++ b/db/migrate/20161201175625_create_spree_taxons_prototypes.spree.rb @@ -0,0 +1,9 @@ +# This migration comes from spree (originally 20141012083513) +class CreateSpreeTaxonsPrototypes < ActiveRecord::Migration + def change + create_table :spree_taxons_prototypes do |t| + t.belongs_to :taxon, index: true + t.belongs_to :prototype, index: true + end + end +end diff --git a/db/migrate/20161201175626_add_state_lock_version_to_order.spree.rb b/db/migrate/20161201175626_add_state_lock_version_to_order.spree.rb new file mode 100644 index 0000000..3f781d1 --- /dev/null +++ b/db/migrate/20161201175626_add_state_lock_version_to_order.spree.rb @@ -0,0 +1,6 @@ +# This migration comes from spree (originally 20141021194502) +class AddStateLockVersionToOrder < ActiveRecord::Migration + def change + add_column :spree_orders, :state_lock_version, :integer, default: 0, null: false + end +end diff --git a/db/migrate/20161201175627_add_counter_cache_from_spree_variants_to_spree_stock_items.spree.rb b/db/migrate/20161201175627_add_counter_cache_from_spree_variants_to_spree_stock_items.spree.rb new file mode 100644 index 0000000..0363406 --- /dev/null +++ b/db/migrate/20161201175627_add_counter_cache_from_spree_variants_to_spree_stock_items.spree.rb @@ -0,0 +1,14 @@ +# This migration comes from spree (originally 20141023005240) +class AddCounterCacheFromSpreeVariantsToSpreeStockItems < ActiveRecord::Migration + def up + add_column :spree_variants, :stock_items_count, :integer, default: 0, null: false + + Spree::Variant.find_each do |variant| + Spree::Variant.reset_counters(variant.id, :stock_items) + end + end + + def down + remove_column :spree_variants, :stock_items_count + end +end diff --git a/db/migrate/20161201175628_fix_adjustment_order_presence.spree.rb b/db/migrate/20161201175628_fix_adjustment_order_presence.spree.rb new file mode 100644 index 0000000..22a8a3e --- /dev/null +++ b/db/migrate/20161201175628_fix_adjustment_order_presence.spree.rb @@ -0,0 +1,14 @@ +# This migration comes from spree (originally 20141101231208) +class FixAdjustmentOrderPresence < ActiveRecord::Migration + def change + say 'Fixing adjustments without direct order reference' + Spree::Adjustment.where(order: nil).find_each do |adjustment| + adjustable = adjustment.adjustable + if adjustable.is_a? Spree::Order + adjustment.update_attributes!(order_id: adjustable.id) + else + adjustment.update_attributes!(adjustable: adjustable.order) + end + end + end +end diff --git a/db/migrate/20161201175629_update_classifications_positions.spree.rb b/db/migrate/20161201175629_update_classifications_positions.spree.rb new file mode 100644 index 0000000..ac18a99 --- /dev/null +++ b/db/migrate/20161201175629_update_classifications_positions.spree.rb @@ -0,0 +1,10 @@ +# This migration comes from spree (originally 20141105213646) +class UpdateClassificationsPositions < ActiveRecord::Migration + def up + Spree::Taxon.all.each do |taxon| + taxon.classifications.each_with_index do |c12n, i| + c12n.set_list_position(i + 1) + end + end + end +end diff --git a/db/migrate/20161201175630_add_guest_token_index_to_spree_orders.spree.rb b/db/migrate/20161201175630_add_guest_token_index_to_spree_orders.spree.rb new file mode 100644 index 0000000..18ad9d9 --- /dev/null +++ b/db/migrate/20161201175630_add_guest_token_index_to_spree_orders.spree.rb @@ -0,0 +1,6 @@ +# This migration comes from spree (originally 20141120135441) +class AddGuestTokenIndexToSpreeOrders < ActiveRecord::Migration + def change + add_index :spree_orders, :guest_token + end +end diff --git a/db/migrate/20161201175631_remove_token_permissions_table.spree.rb b/db/migrate/20161201175631_remove_token_permissions_table.spree.rb new file mode 100644 index 0000000..0fe53dc --- /dev/null +++ b/db/migrate/20161201175631_remove_token_permissions_table.spree.rb @@ -0,0 +1,7 @@ +# This migration comes from spree (originally 20141215232040) +class RemoveTokenPermissionsTable < ActiveRecord::Migration + def change + # The MoveOrderTokenFromTokenizedPermission migration never dropped this. + drop_table :spree_tokenized_permissions + end +end diff --git a/db/migrate/20161201175632_remove_extra_products_slug_index.spree.rb b/db/migrate/20161201175632_remove_extra_products_slug_index.spree.rb new file mode 100644 index 0000000..7af3ac1 --- /dev/null +++ b/db/migrate/20161201175632_remove_extra_products_slug_index.spree.rb @@ -0,0 +1,6 @@ +# This migration comes from spree (originally 20141215235502) +class RemoveExtraProductsSlugIndex < ActiveRecord::Migration + def change + remove_index :spree_products, name: :permalink_idx_unique + end +end diff --git a/db/migrate/20161201175633_update_product_slug_index.spree.rb b/db/migrate/20161201175633_update_product_slug_index.spree.rb new file mode 100644 index 0000000..cd61c84 --- /dev/null +++ b/db/migrate/20161201175633_update_product_slug_index.spree.rb @@ -0,0 +1,7 @@ +# This migration comes from spree (originally 20141217215630) +class UpdateProductSlugIndex < ActiveRecord::Migration + def change + remove_index :spree_products, :slug if index_exists?(:spree_products, :slug) + add_index :spree_products, :slug, unique: true + end +end diff --git a/db/migrate/20161201175634_rename_identifier_to_number_for_payment.spree.rb b/db/migrate/20161201175634_rename_identifier_to_number_for_payment.spree.rb new file mode 100644 index 0000000..0b6ea8e --- /dev/null +++ b/db/migrate/20161201175634_rename_identifier_to_number_for_payment.spree.rb @@ -0,0 +1,6 @@ +# This migration comes from spree (originally 20141218025915) +class RenameIdentifierToNumberForPayment < ActiveRecord::Migration + def change + rename_column :spree_payments, :identifier, :number + end +end diff --git a/db/migrate/20161201175635_create_spree_store_credits.spree.rb b/db/migrate/20161201175635_create_spree_store_credits.spree.rb new file mode 100644 index 0000000..58d2043 --- /dev/null +++ b/db/migrate/20161201175635_create_spree_store_credits.spree.rb @@ -0,0 +1,25 @@ +# This migration comes from spree (originally 20150118210639) +class CreateSpreeStoreCredits < ActiveRecord::Migration + def change + create_table :spree_store_credits do |t| + t.references :user + t.references :category + t.references :created_by + t.decimal :amount, precision: 8, scale: 2, default: 0.0, null: false + t.decimal :amount_used, precision: 8, scale: 2, default: 0.0, null: false + t.text :memo + t.datetime :deleted_at + t.string :currency + t.decimal :amount_authorized, precision: 8, scale: 2, default: 0.0, null: false + t.integer :originator_id + t.string :originator_type + t.integer :type_id + t.timestamps null: false + end + + add_index :spree_store_credits, :deleted_at + add_index :spree_store_credits, :user_id + add_index :spree_store_credits, :type_id + add_index :spree_store_credits, [:originator_id, :originator_type], name: :spree_store_credits_originator + end +end diff --git a/db/migrate/20161201175636_create_spree_store_credit_categories.spree.rb b/db/migrate/20161201175636_create_spree_store_credit_categories.spree.rb new file mode 100644 index 0000000..a4c98e4 --- /dev/null +++ b/db/migrate/20161201175636_create_spree_store_credit_categories.spree.rb @@ -0,0 +1,9 @@ +# This migration comes from spree (originally 20150118211500) +class CreateSpreeStoreCreditCategories < ActiveRecord::Migration + def change + create_table :spree_store_credit_categories do |t| + t.string :name + t.timestamps null: false + end + end +end diff --git a/db/migrate/20161201175637_create_spree_store_credit_events.spree.rb b/db/migrate/20161201175637_create_spree_store_credit_events.spree.rb new file mode 100644 index 0000000..8f327d5 --- /dev/null +++ b/db/migrate/20161201175637_create_spree_store_credit_events.spree.rb @@ -0,0 +1,18 @@ +# This migration comes from spree (originally 20150118212051) +class CreateSpreeStoreCreditEvents < ActiveRecord::Migration + def change + create_table :spree_store_credit_events do |t| + t.integer :store_credit_id, null: false + t.string :action, null: false + t.decimal :amount, precision: 8, scale: 2 + t.string :authorization_code, null: false + t.decimal :user_total_amount, precision: 8, scale: 2, default: 0.0, null: false + t.integer :originator_id + t.string :originator_type + t.datetime :deleted_at + t.timestamps null: false + end + add_index :spree_store_credit_events, :store_credit_id + add_index :spree_store_credit_events, [:originator_id, :originator_type], name: :spree_store_credit_events_originator + end +end diff --git a/db/migrate/20161201175638_create_spree_store_credit_types.spree.rb b/db/migrate/20161201175638_create_spree_store_credit_types.spree.rb new file mode 100644 index 0000000..b75c029 --- /dev/null +++ b/db/migrate/20161201175638_create_spree_store_credit_types.spree.rb @@ -0,0 +1,11 @@ +# This migration comes from spree (originally 20150118212101) +class CreateSpreeStoreCreditTypes < ActiveRecord::Migration + def change + create_table :spree_store_credit_types do |t| + t.string :name + t.integer :priority + t.timestamps null: false + end + add_index :spree_store_credit_types, :priority + end +end diff --git a/db/migrate/20161201175639_remove_environment_from_payment_method.spree.rb b/db/migrate/20161201175639_remove_environment_from_payment_method.spree.rb new file mode 100644 index 0000000..00e6836 --- /dev/null +++ b/db/migrate/20161201175639_remove_environment_from_payment_method.spree.rb @@ -0,0 +1,7 @@ +# This migration comes from spree (originally 20150121022521) +class RemoveEnvironmentFromPaymentMethod < ActiveRecord::Migration + def up + Spree::PaymentMethod.where('environment != ?', Rails.env).update_all(active: false) + remove_column :spree_payment_methods, :environment + end +end diff --git a/db/migrate/20161201175640_add_resellable_to_return_items.spree.rb b/db/migrate/20161201175640_add_resellable_to_return_items.spree.rb new file mode 100644 index 0000000..5ae45e2 --- /dev/null +++ b/db/migrate/20161201175640_add_resellable_to_return_items.spree.rb @@ -0,0 +1,6 @@ +# This migration comes from spree (originally 20150122145607) +class AddResellableToReturnItems < ActiveRecord::Migration + def change + add_column :spree_return_items, :resellable, :boolean, default: true, null: false + end +end diff --git a/db/migrate/20161201175641_add_code_to_spree_promotion_categories.spree.rb b/db/migrate/20161201175641_add_code_to_spree_promotion_categories.spree.rb new file mode 100644 index 0000000..eec28fe --- /dev/null +++ b/db/migrate/20161201175641_add_code_to_spree_promotion_categories.spree.rb @@ -0,0 +1,6 @@ +# This migration comes from spree (originally 20150122202432) +class AddCodeToSpreePromotionCategories < ActiveRecord::Migration + def change + add_column :spree_promotion_categories, :code, :string + end +end diff --git a/db/migrate/20161201175642_remove_environment_from_tracker.spree.rb b/db/migrate/20161201175642_remove_environment_from_tracker.spree.rb new file mode 100644 index 0000000..6594dfd --- /dev/null +++ b/db/migrate/20161201175642_remove_environment_from_tracker.spree.rb @@ -0,0 +1,7 @@ +# This migration comes from spree (originally 20150128032538) +class RemoveEnvironmentFromTracker < ActiveRecord::Migration + def up + Spree::Tracker.where('environment != ?', Rails.env).update_all(active: false) + remove_column :spree_trackers, :environment + end +end diff --git a/db/migrate/20161201175643_remove_spree_configurations.spree.rb b/db/migrate/20161201175643_remove_spree_configurations.spree.rb new file mode 100644 index 0000000..fa0bd59 --- /dev/null +++ b/db/migrate/20161201175643_remove_spree_configurations.spree.rb @@ -0,0 +1,17 @@ +# This migration comes from spree (originally 20150128060325) +class RemoveSpreeConfigurations < ActiveRecord::Migration + def up + drop_table "spree_configurations" + end + + def down + create_table "spree_configurations", force: true do |t| + t.string "name" + t.string "type", limit: 50 + t.datetime "created_at" + t.datetime "updated_at" + end + + add_index "spree_configurations", ["name", "type"], name: "index_spree_configurations_on_name_and_type" + end +end diff --git a/db/migrate/20161201175644_add_index_to_spree_stock_items_variant_id.spree.rb b/db/migrate/20161201175644_add_index_to_spree_stock_items_variant_id.spree.rb new file mode 100644 index 0000000..e36e331 --- /dev/null +++ b/db/migrate/20161201175644_add_index_to_spree_stock_items_variant_id.spree.rb @@ -0,0 +1,14 @@ +# This migration comes from spree (originally 20150216173445) +class AddIndexToSpreeStockItemsVariantId < ActiveRecord::Migration + def up + unless index_exists? :spree_stock_items, :variant_id + add_index :spree_stock_items, :variant_id + end + end + + def down + if index_exists? :spree_stock_items, :variant_id + remove_index :spree_stock_items, :variant_id + end + end +end diff --git a/db/migrate/20161201175645_ensure_payments_have_numbers.spree.rb b/db/migrate/20161201175645_ensure_payments_have_numbers.spree.rb new file mode 100644 index 0000000..5040f39 --- /dev/null +++ b/db/migrate/20161201175645_ensure_payments_have_numbers.spree.rb @@ -0,0 +1,10 @@ +# This migration comes from spree (originally 20150309161154) +class EnsurePaymentsHaveNumbers < ActiveRecord::Migration + def change + add_index :spree_payments, :number unless index_exists?(:spree_payments, :number) + Spree::Payment.where(number: nil).find_each do |payment| + payment.generate_number + payment.update_columns(number: payment.number) + end + end +end diff --git a/db/migrate/20161201175646_add_missing_indexes_on_spree_tables.spree.rb b/db/migrate/20161201175646_add_missing_indexes_on_spree_tables.spree.rb new file mode 100644 index 0000000..b8b236d --- /dev/null +++ b/db/migrate/20161201175646_add_missing_indexes_on_spree_tables.spree.rb @@ -0,0 +1,68 @@ +# This migration comes from spree (originally 20150314013438) +class AddMissingIndexesOnSpreeTables < ActiveRecord::Migration + def change + if table_exists?(:spree_promotion_rules_users) && !index_exists?(:spree_promotion_rules_users, + [:user_id, :promotion_rule_id], + name: 'index_promotion_rules_users_on_user_id_and_promotion_rule_id') + add_index :spree_promotion_rules_users, + [:user_id, :promotion_rule_id], + name: 'index_promotion_rules_users_on_user_id_and_promotion_rule_id' + end + + if table_exists?(:spree_products_promotion_rules) && !index_exists?(:spree_products_promotion_rules, + [:promotion_rule_id, :product_id], + name: 'index_products_promotion_rules_on_promotion_rule_and_product') + add_index :spree_products_promotion_rules, + [:promotion_rule_id, :product_id], + name: 'index_products_promotion_rules_on_promotion_rule_and_product' + end + + unless index_exists? :spree_orders, :canceler_id + add_index :spree_orders, :canceler_id + end + + unless index_exists? :spree_orders, :store_id + add_index :spree_orders, :store_id + end + + if table_exists?(:spree_orders_promotions) && !index_exists?(:spree_orders_promotions, [:promotion_id, :order_id]) + add_index :spree_orders_promotions, [:promotion_id, :order_id] + end + + if table_exists?(:spree_properties_prototypes) && !index_exists?(:spree_properties_prototypes, :prototype_id) + add_index :spree_properties_prototypes, :prototype_id + end + + if table_exists?(:spree_properties_prototypes) && !index_exists?(:spree_properties_prototypes, + [:prototype_id, :property_id], + name: 'index_properties_prototypes_on_prototype_and_property') + add_index :spree_properties_prototypes, + [:prototype_id, :property_id], + name: 'index_properties_prototypes_on_prototype_and_property' + end + + if table_exists?(:spree_taxons_prototypes) && !index_exists?(:spree_taxons_prototypes, [:prototype_id, :taxon_id]) + add_index :spree_taxons_prototypes, [:prototype_id, :taxon_id] + end + + if table_exists?(:spree_option_types_prototypes) && !index_exists?(:spree_option_types_prototypes, :prototype_id) + add_index :spree_option_types_prototypes, :prototype_id + end + + if table_exists?(:spree_option_types_prototypes) && !index_exists?(:spree_option_types_prototypes, + [:prototype_id, :option_type_id], + name: 'index_option_types_prototypes_on_prototype_and_option_type') + add_index :spree_option_types_prototypes, + [:prototype_id, :option_type_id], + name: 'index_option_types_prototypes_on_prototype_and_option_type' + end + + if table_exists?(:spree_option_values_variants) && !index_exists?(:spree_option_values_variants, + [:option_value_id, :variant_id], + name: 'index_option_values_variants_on_option_value_and_variant') + add_index :spree_option_values_variants, + [:option_value_id, :variant_id], + name: 'index_option_values_variants_on_option_value_and_variant' + end + end +end diff --git a/db/migrate/20161201175647_remove_duplicated_indexes_from_multi_columns.spree.rb b/db/migrate/20161201175647_remove_duplicated_indexes_from_multi_columns.spree.rb new file mode 100644 index 0000000..7918679 --- /dev/null +++ b/db/migrate/20161201175647_remove_duplicated_indexes_from_multi_columns.spree.rb @@ -0,0 +1,19 @@ +# This migration comes from spree (originally 20150317174308) +class RemoveDuplicatedIndexesFromMultiColumns < ActiveRecord::Migration + def change + remove_index :spree_adjustments, name: "index_adjustments_on_order_id" + remove_index :spree_option_types_prototypes, :prototype_id + add_index :spree_option_types_prototypes, :option_type_id + remove_index :spree_option_values_variants, name: 'index_option_values_variants_on_option_value_and_variant' + remove_index :spree_option_values_variants, :variant_id + add_index :spree_option_values_variants, :option_value_id + remove_index :spree_orders, :user_id + remove_index :spree_orders_promotions, [:order_id, :promotion_id] + add_index :spree_orders_promotions, :order_id + remove_index :spree_products_promotion_rules, name: "index_products_promotion_rules_on_promotion_rule_id" + remove_index :spree_promotion_rules_users, name: "index_promotion_rules_users_on_user_id" + remove_index :spree_properties_prototypes, :prototype_id + remove_index :spree_stock_items, :stock_location_id + remove_index :spree_taxons_prototypes, :prototype_id + end +end diff --git a/db/migrate/20161201175648_remove_user_index_from_spree_state_changes.spree.rb b/db/migrate/20161201175648_remove_user_index_from_spree_state_changes.spree.rb new file mode 100644 index 0000000..10537c6 --- /dev/null +++ b/db/migrate/20161201175648_remove_user_index_from_spree_state_changes.spree.rb @@ -0,0 +1,15 @@ +# This migration comes from spree (originally 20150324104002) +class RemoveUserIndexFromSpreeStateChanges < ActiveRecord::Migration + def up + if index_exists? :spree_state_changes, :user_id + remove_index :spree_state_changes, :user_id + end + + end + + def down + unless index_exists? :spree_state_changes, :user_id + add_index :spree_state_changes, :user_id + end + end +end diff --git a/db/migrate/20161201175649_fix_adjustment_order_id.spree.rb b/db/migrate/20161201175649_fix_adjustment_order_id.spree.rb new file mode 100644 index 0000000..b3fd9f8 --- /dev/null +++ b/db/migrate/20161201175649_fix_adjustment_order_id.spree.rb @@ -0,0 +1,71 @@ +# This migration comes from spree (originally 20150515211137) +class FixAdjustmentOrderId < ActiveRecord::Migration + def change + say 'Populate order_id from adjustable_id where appropriate' + execute(<<-SQL.squish) + UPDATE + spree_adjustments + SET + order_id = adjustable_id + WHERE + adjustable_type = 'Spree::Order' + ; + SQL + + # Submitter of change does not care about MySQL, as it is not officially supported. + # Still spree officials decided to provide a working code path for MySQL users, hence + # submitter made a AR code path he could validate on PostgreSQL. + # + # Whoever runs a big enough MySQL installation where the AR solution hurts: + # Will have to write a better MySQL specific equivalent. + if Spree::Order.connection.adapter_name.eql?('MySQL') + Spree::Adjustment.where(adjustable_type: 'Spree::LineItem').find_each do |adjustment| + adjustment.update_columns(order_id: Spree::LineItem.find(adjustment.adjustable_id).order_id) + end + else + execute(<<-SQL.squish) + UPDATE + spree_adjustments + SET + order_id = + (SELECT order_id FROM spree_line_items WHERE spree_line_items.id = spree_adjustments.adjustable_id) + WHERE + adjustable_type = 'Spree::LineItem' + SQL + end + + say 'Fix schema for spree_adjustments order_id column' + change_table :spree_adjustments do |t| + t.change :order_id, :integer, null: false + end + + # Improved schema for postgresql, uncomment if you like it: + # + # # Negated Logical implication. + # # + # # When adjustable_type is 'Spree::Order' (p) the adjustable_id must be order_id (q). + # # + # # When adjustable_type is NOT 'Spree::Order' the adjustable id allowed to be any value (including of order_id in + # # case foreign keys match). XOR does not work here. + # # + # # Postgresql does not have an operator for logical implication. So we need to build the following truth table + # # via AND with OR: + # # + # # p q | CHECK = !(p -> q) + # # ----------- + # # t t | t + # # t f | f + # # f t | t + # # f f | t + # # + # # According to de-morgans law the logical implication q -> p is equivalent to !p || q + # # + # execute(<<-SQL.squish) + # ALTER TABLE ONLY spree_adjustments + # ADD CONSTRAINT fk_spree_adjustments FOREIGN KEY (order_id) + # REFERENCES spree_orders(id) ON UPDATE RESTRICT ON DELETE RESTRICT, + # ADD CONSTRAINT check_spree_adjustments_order_id CHECK + # (adjustable_type <> 'Spree::Order' OR order_id = adjustable_id); + # SQL + end +end diff --git a/db/migrate/20161201175650_add_position_to_spree_payment_methods.spree.rb b/db/migrate/20161201175650_add_position_to_spree_payment_methods.spree.rb new file mode 100644 index 0000000..895228d --- /dev/null +++ b/db/migrate/20161201175650_add_position_to_spree_payment_methods.spree.rb @@ -0,0 +1,6 @@ +# This migration comes from spree (originally 20150522071831) +class AddPositionToSpreePaymentMethods < ActiveRecord::Migration + def change + add_column :spree_payment_methods, :position, :integer, default: 0 + end +end diff --git a/db/migrate/20161201175651_add_deleted_at_to_friendly_id_slugs.spree.rb b/db/migrate/20161201175651_add_deleted_at_to_friendly_id_slugs.spree.rb new file mode 100644 index 0000000..1c0bc81 --- /dev/null +++ b/db/migrate/20161201175651_add_deleted_at_to_friendly_id_slugs.spree.rb @@ -0,0 +1,7 @@ +# This migration comes from spree (originally 20150522181728) +class AddDeletedAtToFriendlyIdSlugs < ActiveRecord::Migration + def change + add_column :friendly_id_slugs, :deleted_at, :datetime + add_index :friendly_id_slugs, :deleted_at + end +end diff --git a/db/migrate/20161201175652_increase_scale_on_pre_tax_amounts.spree.rb b/db/migrate/20161201175652_increase_scale_on_pre_tax_amounts.spree.rb new file mode 100644 index 0000000..046cbb4 --- /dev/null +++ b/db/migrate/20161201175652_increase_scale_on_pre_tax_amounts.spree.rb @@ -0,0 +1,17 @@ +# This migration comes from spree (originally 20150609093816) +class IncreaseScaleOnPreTaxAmounts < ActiveRecord::Migration + def change + # set pre_tax_amount on shipments to discounted_amount - included_tax_total + # so that the null: false option on the shipment pre_tax_amount doesn't generate + # errors. + # + execute(<<-SQL) + UPDATE spree_shipments + SET pre_tax_amount = (cost + promo_total) - included_tax_total + WHERE pre_tax_amount IS NULL; + SQL + + change_column :spree_line_items, :pre_tax_amount, :decimal, precision: 12, scale: 4, default: 0.0, null: false + change_column :spree_shipments, :pre_tax_amount, :decimal, precision: 12, scale: 4, default: 0.0, null: false + end +end diff --git a/db/migrate/20161201175653_add_taxable_adjustment_total_to_line_item.spree.rb b/db/migrate/20161201175653_add_taxable_adjustment_total_to_line_item.spree.rb new file mode 100644 index 0000000..7644e9b --- /dev/null +++ b/db/migrate/20161201175653_add_taxable_adjustment_total_to_line_item.spree.rb @@ -0,0 +1,20 @@ +# This migration comes from spree (originally 20150626181949) +class AddTaxableAdjustmentTotalToLineItem < ActiveRecord::Migration + def change + add_column :spree_line_items, :taxable_adjustment_total, :decimal, + precision: 10, scale: 2, default: 0.0, null: false + add_column :spree_line_items, :non_taxable_adjustment_total, :decimal, + precision: 10, scale: 2, default: 0.0, null: false + + add_column :spree_shipments, :taxable_adjustment_total, :decimal, + precision: 10, scale: 2, default: 0.0, null: false + add_column :spree_shipments, :non_taxable_adjustment_total, :decimal, + precision: 10, scale: 2, default: 0.0, null: false + + add_column :spree_orders, :taxable_adjustment_total, :decimal, + precision: 10, scale: 2, default: 0.0, null: false + add_column :spree_orders, :non_taxable_adjustment_total, :decimal, + precision: 10, scale: 2, default: 0.0, null: false + # TODO migration that updates old orders + end +end diff --git a/db/migrate/20161201175654_migrate_payment_methods_display.spree.rb b/db/migrate/20161201175654_migrate_payment_methods_display.spree.rb new file mode 100644 index 0000000..3c10c24 --- /dev/null +++ b/db/migrate/20161201175654_migrate_payment_methods_display.spree.rb @@ -0,0 +1,13 @@ +# This migration comes from spree (originally 20150627090949) +class MigratePaymentMethodsDisplay < ActiveRecord::Migration + def change + Spree::PaymentMethod.all.each do |method| + if method.display_on.blank? + method.display_on = "both" + method.save + end + end + + change_column :spree_payment_methods, :display_on, :string, default: "both" + end +end diff --git a/db/migrate/20161201175655_enable_acts_as_paranoid_on_calculators.spree.rb b/db/migrate/20161201175655_enable_acts_as_paranoid_on_calculators.spree.rb new file mode 100644 index 0000000..53b7c7a --- /dev/null +++ b/db/migrate/20161201175655_enable_acts_as_paranoid_on_calculators.spree.rb @@ -0,0 +1,7 @@ +# This migration comes from spree (originally 20150707204155) +class EnableActsAsParanoidOnCalculators < ActiveRecord::Migration + def change + add_column :spree_calculators, :deleted_at, :datetime + add_index :spree_calculators, :deleted_at + end +end diff --git a/db/migrate/20161201175656_spree_payment_method_store_credits.spree.rb b/db/migrate/20161201175656_spree_payment_method_store_credits.spree.rb new file mode 100644 index 0000000..e5f22d3 --- /dev/null +++ b/db/migrate/20161201175656_spree_payment_method_store_credits.spree.rb @@ -0,0 +1,13 @@ +# This migration comes from spree (originally 20150714154102) +class SpreePaymentMethodStoreCredits < ActiveRecord::Migration + def up + # Reload to pick up new position column for acts_as_list + Spree::PaymentMethod.reset_column_information + Spree::PaymentMethod::StoreCredit.find_or_create_by(name: 'Store Credit', description: 'Store Credit', + active: true, display_on: 'back_end') + end + + def down + Spree::PaymentMethod.find_by(type: 'Spree::PaymentMethod::StoreCredit', name: 'Store Credit').try(&:destroy) + end +end diff --git a/db/migrate/20161201175657_rename_has_and_belongs_to_associations_to_model_names.spree.rb b/db/migrate/20161201175657_rename_has_and_belongs_to_associations_to_model_names.spree.rb new file mode 100644 index 0000000..05fa415 --- /dev/null +++ b/db/migrate/20161201175657_rename_has_and_belongs_to_associations_to_model_names.spree.rb @@ -0,0 +1,19 @@ +# This migration comes from spree (originally 20150726141425) +class RenameHasAndBelongsToAssociationsToModelNames < ActiveRecord::Migration + def change + { + 'spree_option_types_prototypes' => 'spree_option_type_prototypes', + 'spree_option_values_variants' => 'spree_option_value_variants', + 'spree_orders_promotions' => 'spree_order_promotions', + 'spree_products_promotion_rules' => 'spree_product_promotion_rules', + 'spree_taxons_promotion_rules' => 'spree_promotion_rule_taxons', + 'spree_promotion_rules_users' => 'spree_promotion_rule_users', + 'spree_properties_prototypes' => 'spree_property_prototypes', + 'spree_taxons_prototypes' => 'spree_prototype_taxons', + 'spree_roles_users' => 'spree_role_users', + 'spree_shipping_methods_zones' => 'spree_shipping_method_zones' + }.each do |old_name, new_name| + rename_table old_name, new_name + end + end +end diff --git a/db/migrate/20161201175658_spree_store_credit_types.spree.rb b/db/migrate/20161201175658_spree_store_credit_types.spree.rb new file mode 100644 index 0000000..1561a87 --- /dev/null +++ b/db/migrate/20161201175658_spree_store_credit_types.spree.rb @@ -0,0 +1,12 @@ +# This migration comes from spree (originally 20150727191614) +class SpreeStoreCreditTypes < ActiveRecord::Migration + def up + Spree::StoreCreditType.find_or_create_by(name: 'Expiring', priority: 1) + Spree::StoreCreditType.find_or_create_by(name: 'Non-expiring', priority: 2) + end + + def down + Spree::StoreCreditType.find_by(name: 'Expiring').try(&:destroy) + Spree::StoreCreditType.find_by(name: 'Non-expiring').try(&:destroy) + end +end diff --git a/db/migrate/20161201175659_add_discontinued_to_products_and_variants.spree.rb b/db/migrate/20161201175659_add_discontinued_to_products_and_variants.spree.rb new file mode 100644 index 0000000..5b9c1f3 --- /dev/null +++ b/db/migrate/20161201175659_add_discontinued_to_products_and_variants.spree.rb @@ -0,0 +1,69 @@ +# This migration comes from spree (originally 20150819154308) +class AddDiscontinuedToProductsAndVariants < ActiveRecord::Migration + def up + add_column :spree_products, :discontinue_on, :datetime, after: :available_on + add_column :spree_variants, :discontinue_on, :datetime, after: :deleted_at + + add_index :spree_products, :discontinue_on + add_index :spree_variants, :discontinue_on + + puts "Warning: This migration changes the meaning of 'deleted'. Before this change, 'deleted' meant products that were no longer being sold in your store. After this change, you can only delete a product or variant if it has not already been sold to a customer (a model-level check enforces this). Instead, you should use the new field 'discontinue_on' for products or variants which were sold in the past but no longer for sale. This fixes bugs when other objects are attached to deleted products and variants. (Even though acts_as_paranoid gem keeps the records in the database, most associations are automatically scoped to exclude the deleted records.) In thew meaning of 'deleted,' you can still use the delete function on products & variants which are *truly user-error mistakes*, specifically before an order has been placed or the items have gone on sale. You also must use the soft-delete function (which still works after this change) to clean up slug (product) and SKU (variant) duplicates. Otherwise, you should generally over ever need to discontinue products. + +Data Fix: We will attempt to reverse engineer the old meaning of 'deleted' (no longer for sale) to the new database field 'discontinue_on'. However, since Slugs and SKUs cannot be duplicated on Products and Variants, we cannot gaurantee this to be foolproof if you have deteled Products and Variants that have duplicate Slugs or SKUs in non-deleted records. In these cases, we recommend you use the additional rake task to clean up your old records (see rake db:fix_orphan_line_items). If you have such records, this migration will leave them in place, preferring the non-deleted records over the deleted ones. However, since old line items will still be associated with deleted objects, you will still the bugs in your app until you run: + +rake db:fix_orphan_line_items + +We will print out a report of the data we are fixing now: " + + Spree::Product.only_deleted.each do |product| + # determine if there is a slug duplicate + the_dup = Spree::Product.find_by(slug: product.slug) + if the_dup.nil? + # check to see if there are line items attached to any variants + if Spree::Variant.with_deleted.where(product_id: product.id).map(&:line_items).any? + puts "recovering deleted product id #{product.id} ... this will un-delete the record and set it to be discontinued" + + old_deleted = product.deleted_at + product.update_column(:deleted_at, nil) # for some reason .recover doesn't appear to be a method + product.update_column(:discontinue_on, old_deleted) + else + puts "leaving product id #{product.id} deleted because there are no line items attached to it..." + end + else + puts "leaving product id #{product.id} deleted because there is a duplicate slug for '#{product.slug}' (product id #{the_dup.id}) " + if product.variants.map(&:line_items).any? + puts "WARNING: You may still have bugs with product id #{product.id} (#{product.name}) until you run rake db:fix_orphan_line_items" + end + end + end + + Spree::Variant.only_deleted.each do |variant| + # determine if there is a slug duplicate + the_dup = Spree::Variant.find_by(sku: variant.sku) + if the_dup.nil? + # check to see if there are line items attached to any variants + if variant.line_items.any? + puts "recovering deleted variant id #{variant.id} ... this will un-delete the record and set it to be discontinued" + old_deleted = variant.deleted_at + variant.update_column(:deleted_at, nil) # for some reason .recover doesn't appear to be a method + variant.update_column(:discontinue_on, old_deleted) + else + puts "leaving variant id #{variant.id} deleted because there are no line items attached to it..." + end + else + puts "leaving variant id #{variant.id} deleted because there is a duplicate SKU for '#{variant.sku}' (variant id #{the_dup.id}) " + if variant.line_items.any? + puts "WARNING: You may still have bugs with variant id #{variant.id} (#{variant.name}) until you run rake db:fix_orphan_line_items" + end + end + end + end + + def down + execute "UPDATE spree_products SET deleted_at = discontinue_on WHERE deleted_at IS NULL" + execute "UPDATE spree_variants SET deleted_at = discontinue_on WHERE deleted_at IS NULL" + + remove_column :spree_products, :discontinue_on + remove_column :spree_variants, :discontinue_on + end +end diff --git a/db/migrate/20161201175660_remove_shipping_method_id_from_spree_orders.spree.rb b/db/migrate/20161201175660_remove_shipping_method_id_from_spree_orders.spree.rb new file mode 100644 index 0000000..66c2b9d --- /dev/null +++ b/db/migrate/20161201175660_remove_shipping_method_id_from_spree_orders.spree.rb @@ -0,0 +1,14 @@ +# This migration comes from spree (originally 20151220072838) +class RemoveShippingMethodIdFromSpreeOrders < ActiveRecord::Migration + def up + if column_exists?(:spree_orders, :shipping_method_id, :integer) + remove_column :spree_orders, :shipping_method_id, :integer + end + end + + def down + unless column_exists?(:spree_orders, :shipping_method_id, :integer) + add_column :spree_orders, :shipping_method_id, :integer + end + end +end diff --git a/db/migrate/20161201175661_add_id_column_to_earlier_habtm_tables.spree.rb b/db/migrate/20161201175661_add_id_column_to_earlier_habtm_tables.spree.rb new file mode 100644 index 0000000..4cf524d --- /dev/null +++ b/db/migrate/20161201175661_add_id_column_to_earlier_habtm_tables.spree.rb @@ -0,0 +1,17 @@ +# This migration comes from spree (originally 20160207191757) +class AddIdColumnToEarlierHabtmTables < ActiveRecord::Migration + def up + add_column :spree_option_type_prototypes, :id, :primary_key + add_column :spree_option_value_variants, :id, :primary_key + add_column :spree_order_promotions, :id, :primary_key + add_column :spree_product_promotion_rules, :id, :primary_key + add_column :spree_promotion_rule_users, :id, :primary_key + add_column :spree_property_prototypes, :id, :primary_key + add_column :spree_role_users, :id, :primary_key + add_column :spree_shipping_method_zones, :id, :primary_key + end + + def down + raise ActiveRecord::IrreversibleMigration + end +end diff --git a/db/migrate/20161201175662_add_indexes.spree.rb b/db/migrate/20161201175662_add_indexes.spree.rb new file mode 100644 index 0000000..42f0595 --- /dev/null +++ b/db/migrate/20161201175662_add_indexes.spree.rb @@ -0,0 +1,15 @@ +# This migration comes from spree (originally 20160219165458) +class AddIndexes < ActiveRecord::Migration + def change + add_index :spree_assets, :position + add_index :spree_option_types, :name + add_index :spree_option_values, :name + add_index :spree_prices, :variant_id + add_index :spree_properties, :name + add_index :spree_roles, :name + add_index :spree_shipping_categories, :name + add_index :spree_taxons, :lft + add_index :spree_taxons, :rgt + add_index :spree_taxons, :name + end +end diff --git a/db/migrate/20161201175663_add_api_key_to_spree_users.spree_api.rb b/db/migrate/20161201175663_add_api_key_to_spree_users.spree_api.rb new file mode 100644 index 0000000..b9e3fe3 --- /dev/null +++ b/db/migrate/20161201175663_add_api_key_to_spree_users.spree_api.rb @@ -0,0 +1,8 @@ +# 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/20161201175664_resize_api_key_field.spree_api.rb b/db/migrate/20161201175664_resize_api_key_field.spree_api.rb new file mode 100644 index 0000000..778c105 --- /dev/null +++ b/db/migrate/20161201175664_resize_api_key_field.spree_api.rb @@ -0,0 +1,8 @@ +# This migration comes from spree_api (originally 20120411123334) +class ResizeApiKeyField < ActiveRecord::Migration + def change + unless defined?(User) + change_column :spree_users, :api_key, :string, :limit => 48 + end + end +end diff --git a/db/migrate/20161201175665_rename_api_key_to_spree_api_key.spree_api.rb b/db/migrate/20161201175665_rename_api_key_to_spree_api_key.spree_api.rb new file mode 100644 index 0000000..7fd09d3 --- /dev/null +++ b/db/migrate/20161201175665_rename_api_key_to_spree_api_key.spree_api.rb @@ -0,0 +1,8 @@ +# 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/20161201175666_add_index_to_user_spree_api_key.spree_api.rb b/db/migrate/20161201175666_add_index_to_user_spree_api_key.spree_api.rb new file mode 100644 index 0000000..757fa67 --- /dev/null +++ b/db/migrate/20161201175666_add_index_to_user_spree_api_key.spree_api.rb @@ -0,0 +1,8 @@ +# This migration comes from spree_api (originally 20131017162334) +class AddIndexToUserSpreeApiKey < ActiveRecord::Migration + def change + unless defined?(User) + add_index :spree_users, :spree_api_key + end + end +end diff --git a/db/migrate/20161201175667_create_users.spree_auth.rb b/db/migrate/20161201175667_create_users.spree_auth.rb new file mode 100644 index 0000000..a4e8e60 --- /dev/null +++ b/db/migrate/20161201175667_create_users.spree_auth.rb @@ -0,0 +1,30 @@ +# 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/20161201175668_rename_columns_for_devise.spree_auth.rb b/db/migrate/20161201175668_rename_columns_for_devise.spree_auth.rb new file mode 100644 index 0000000..6aa647e --- /dev/null +++ b/db/migrate/20161201175668_rename_columns_for_devise.spree_auth.rb @@ -0,0 +1,38 @@ +# This migration comes from spree_auth (originally 20101026184950) +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, :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 :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/20161201175669_convert_user_remember_field.spree_auth.rb b/db/migrate/20161201175669_convert_user_remember_field.spree_auth.rb new file mode 100644 index 0000000..9e6a94f --- /dev/null +++ b/db/migrate/20161201175669_convert_user_remember_field.spree_auth.rb @@ -0,0 +1,12 @@ +# This migration comes from spree_auth (originally 20101214150824) +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/20161201175670_add_reset_password_sent_at_to_spree_users.spree_auth.rb b/db/migrate/20161201175670_add_reset_password_sent_at_to_spree_users.spree_auth.rb new file mode 100644 index 0000000..262727e --- /dev/null +++ b/db/migrate/20161201175670_add_reset_password_sent_at_to_spree_users.spree_auth.rb @@ -0,0 +1,9 @@ +# This migration comes from spree_auth (originally 20120203010234) +class AddResetPasswordSentAtToSpreeUsers < ActiveRecord::Migration + def change + Spree::User.reset_column_information + unless Spree::User.column_names.include?("reset_password_sent_at") + add_column :spree_users, :reset_password_sent_at, :datetime + end + end +end diff --git a/db/migrate/20161201175671_make_users_email_index_unique.spree_auth.rb b/db/migrate/20161201175671_make_users_email_index_unique.spree_auth.rb new file mode 100644 index 0000000..00f6f14 --- /dev/null +++ b/db/migrate/20161201175671_make_users_email_index_unique.spree_auth.rb @@ -0,0 +1,10 @@ +# This migration comes from spree_auth (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" + end +end diff --git a/db/migrate/20161201175672_add_deleted_at_to_users.spree_auth.rb b/db/migrate/20161201175672_add_deleted_at_to_users.spree_auth.rb new file mode 100644 index 0000000..6796024 --- /dev/null +++ b/db/migrate/20161201175672_add_deleted_at_to_users.spree_auth.rb @@ -0,0 +1,7 @@ +# This migration comes from spree_auth (originally 20140904000425) +class AddDeletedAtToUsers < ActiveRecord::Migration + def change + add_column :spree_users, :deleted_at, :datetime + add_index :spree_users, :deleted_at + end +end diff --git a/db/migrate/20161201175673_add_confirmable_to_users.spree_auth.rb b/db/migrate/20161201175673_add_confirmable_to_users.spree_auth.rb new file mode 100644 index 0000000..7521e27 --- /dev/null +++ b/db/migrate/20161201175673_add_confirmable_to_users.spree_auth.rb @@ -0,0 +1,8 @@ +# This migration comes from spree_auth (originally 20141002154641) +class AddConfirmableToUsers < ActiveRecord::Migration + def change + add_column :spree_users, :confirmation_token, :string + add_column :spree_users, :confirmed_at, :datetime + add_column :spree_users, :confirmation_sent_at, :datetime + end +end diff --git a/db/migrate/20161201175674_add_missing_indices_on_user.spree_auth.rb b/db/migrate/20161201175674_add_missing_indices_on_user.spree_auth.rb new file mode 100644 index 0000000..d833ac3 --- /dev/null +++ b/db/migrate/20161201175674_add_missing_indices_on_user.spree_auth.rb @@ -0,0 +1,11 @@ +# This migration comes from spree_auth (originally 20150416152553) +class AddMissingIndicesOnUser < ActiveRecord::Migration + def change + unless index_exists?(:spree_users, :bill_address_id) + add_index :spree_users, :bill_address_id + end + unless index_exists?(:spree_users, :ship_address_id) + add_index :spree_users, :ship_address_id + end + end +end diff --git a/db/migrate/20161201175675_create_skrill_transactions.spree_gateway.rb b/db/migrate/20161201175675_create_skrill_transactions.spree_gateway.rb new file mode 100644 index 0000000..2a6e267 --- /dev/null +++ b/db/migrate/20161201175675_create_skrill_transactions.spree_gateway.rb @@ -0,0 +1,14 @@ +# This migration comes from spree_gateway (originally 20111118164631) +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 null: true + end + end +end diff --git a/db/migrate/20161201175676_update_braintree_payment_method_type.spree_gateway.rb b/db/migrate/20161201175676_update_braintree_payment_method_type.spree_gateway.rb new file mode 100644 index 0000000..1232b6d --- /dev/null +++ b/db/migrate/20161201175676_update_braintree_payment_method_type.spree_gateway.rb @@ -0,0 +1,10 @@ +# This migration comes from spree_gateway (originally 20121017004102) +class UpdateBraintreePaymentMethodType < ActiveRecord::Migration + def up + Spree::PaymentMethod.where(:type => "Spree::Gateway::Braintree").update_all(:type => "Spree::Gateway::BraintreeGateway") + end + + def down + Spree::PaymentMethod.where(:type => "Spree::Gateway::BraintreeGateway").update_all(:type => "Spree::Gateway::Braintree") + end +end diff --git a/db/migrate/20161201175677_update_stripe_payment_method_type.spree_gateway.rb b/db/migrate/20161201175677_update_stripe_payment_method_type.spree_gateway.rb new file mode 100644 index 0000000..04d4160 --- /dev/null +++ b/db/migrate/20161201175677_update_stripe_payment_method_type.spree_gateway.rb @@ -0,0 +1,10 @@ +# This migration comes from spree_gateway (originally 20130213222555) +class UpdateStripePaymentMethodType < ActiveRecord::Migration + def up + Spree::PaymentMethod.where(:type => "Spree::Gateway::Stripe").update_all(:type => "Spree::Gateway::StripeGateway") + end + + def down + Spree::PaymentMethod.where(:type => "Spree::Gateway::StripeGateway").update_all(:type => "Spree::Gateway::Stripe") + end +end diff --git a/db/migrate/20161201175678_update_balanced_payment_method_type.spree_gateway.rb b/db/migrate/20161201175678_update_balanced_payment_method_type.spree_gateway.rb new file mode 100644 index 0000000..5da7474 --- /dev/null +++ b/db/migrate/20161201175678_update_balanced_payment_method_type.spree_gateway.rb @@ -0,0 +1,10 @@ +# This migration comes from spree_gateway (originally 20130415222802) +class UpdateBalancedPaymentMethodType < ActiveRecord::Migration + def up + Spree::PaymentMethod.where(:type => "Spree::Gateway::Balanced").update_all(:type => "Spree::Gateway::BalancedGateway") + end + + def down + Spree::PaymentMethod.where(:type => "Spree::Gateway::BalancedGateway").update_all(:type => "Spree::Gateway::Balanced") + end +end \ No newline at end of file diff --git a/db/migrate/20161201175679_update_paypal_payment_method_type.spree_gateway.rb b/db/migrate/20161201175679_update_paypal_payment_method_type.spree_gateway.rb new file mode 100644 index 0000000..4e6ec77 --- /dev/null +++ b/db/migrate/20161201175679_update_paypal_payment_method_type.spree_gateway.rb @@ -0,0 +1,10 @@ +# This migration comes from spree_gateway (originally 20131008221012) +class UpdatePaypalPaymentMethodType < ActiveRecord::Migration + def up + Spree::PaymentMethod.where(:type => "Spree::Gateway::PayPal").update_all(:type => "Spree::Gateway::PayPalGateway") + end + + def down + Spree::PaymentMethod.where(:type => "Spree::Gateway::PayPalGateway").update_all(:type => "Spree::Gateway::PayPal") + end +end diff --git a/db/migrate/20161201175680_migrate_stripe_preferences.spree_gateway.rb b/db/migrate/20161201175680_migrate_stripe_preferences.spree_gateway.rb new file mode 100644 index 0000000..25aef43 --- /dev/null +++ b/db/migrate/20161201175680_migrate_stripe_preferences.spree_gateway.rb @@ -0,0 +1,9 @@ +# This migration comes from spree_gateway (originally 20131112133401) +class MigrateStripePreferences < ActiveRecord::Migration + def up + Spree::Preference.where("#{ActiveRecord::Base.connection.quote_column_name("key")} LIKE 'spree/gateway/stripe_gateway/login%'").each do |pref| + pref.key = pref.key.gsub('login', 'secret_key') + pref.save + end + end +end diff --git a/db/schema.rb b/db/schema.rb new file mode 100644 index 0000000..cda0f17 --- /dev/null +++ b/db/schema.rb @@ -0,0 +1,1079 @@ +# encoding: UTF-8 +# This file is auto-generated from the current state of the database. Instead +# of editing this file, please use the migrations feature of Active Record to +# incrementally modify your database, and then regenerate this schema definition. +# +# Note that this schema.rb definition is the authoritative source for your +# database schema. If you need to create the application database on another +# system, you should be using db:schema:load, not running all the migrations +# from scratch. The latter is a flawed and unsustainable approach (the more migrations +# you'll amass, the slower it'll run and the greater likelihood for issues). +# +# It's strongly recommended that you check this file into your version control system. + +ActiveRecord::Schema.define(version: 20161201175680) do + + create_table "friendly_id_slugs", force: :cascade do |t| + t.string "slug", null: false + t.integer "sluggable_id", null: false + t.string "sluggable_type", limit: 50 + t.string "scope" + t.datetime "created_at" + t.datetime "deleted_at" + end + + add_index "friendly_id_slugs", ["deleted_at"], name: "index_friendly_id_slugs_on_deleted_at" + add_index "friendly_id_slugs", ["slug", "sluggable_type", "scope"], name: "index_friendly_id_slugs_on_slug_and_sluggable_type_and_scope", unique: true + add_index "friendly_id_slugs", ["slug", "sluggable_type"], name: "index_friendly_id_slugs_on_slug_and_sluggable_type" + add_index "friendly_id_slugs", ["sluggable_id"], name: "index_friendly_id_slugs_on_sluggable_id" + add_index "friendly_id_slugs", ["sluggable_type"], name: "index_friendly_id_slugs_on_sluggable_type" + + create_table "spree_addresses", force: :cascade 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.integer "state_id" + t.integer "country_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + end + + add_index "spree_addresses", ["country_id"], name: "index_spree_addresses_on_country_id" + add_index "spree_addresses", ["firstname"], name: "index_addresses_on_firstname" + add_index "spree_addresses", ["lastname"], name: "index_addresses_on_lastname" + add_index "spree_addresses", ["state_id"], name: "index_spree_addresses_on_state_id" + + create_table "spree_adjustments", force: :cascade do |t| + t.integer "source_id" + t.string "source_type" + t.integer "adjustable_id" + t.string "adjustable_type" + t.decimal "amount", precision: 10, scale: 2 + t.string "label" + t.boolean "mandatory" + t.boolean "eligible", default: true + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.string "state" + t.integer "order_id", null: false + t.boolean "included", default: false + end + + add_index "spree_adjustments", ["adjustable_id", "adjustable_type"], name: "index_spree_adjustments_on_adjustable_id_and_adjustable_type" + add_index "spree_adjustments", ["eligible"], name: "index_spree_adjustments_on_eligible" + add_index "spree_adjustments", ["order_id"], name: "index_spree_adjustments_on_order_id" + add_index "spree_adjustments", ["source_id", "source_type"], name: "index_spree_adjustments_on_source_id_and_source_type" + + create_table "spree_assets", force: :cascade do |t| + t.integer "viewable_id" + t.string "viewable_type" + 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" + t.datetime "created_at" + t.datetime "updated_at" + end + + add_index "spree_assets", ["position"], name: "index_spree_assets_on_position" + 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", force: :cascade do |t| + t.string "type" + t.integer "calculable_id" + t.string "calculable_type" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.text "preferences" + t.datetime "deleted_at" + end + + add_index "spree_calculators", ["calculable_id", "calculable_type"], name: "index_spree_calculators_on_calculable_id_and_calculable_type" + add_index "spree_calculators", ["deleted_at"], name: "index_spree_calculators_on_deleted_at" + add_index "spree_calculators", ["id", "type"], name: "index_spree_calculators_on_id_and_type" + + create_table "spree_countries", force: :cascade do |t| + t.string "iso_name" + t.string "iso" + t.string "iso3" + t.string "name" + t.integer "numcode" + t.boolean "states_required", default: false + t.datetime "updated_at" + end + + create_table "spree_credit_cards", force: :cascade do |t| + t.string "month" + t.string "year" + t.string "cc_type" + t.string "last_digits" + t.integer "address_id" + t.string "gateway_customer_profile_id" + t.string "gateway_payment_profile_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.string "name" + t.integer "user_id" + t.integer "payment_method_id" + t.boolean "default", default: false, null: false + end + + add_index "spree_credit_cards", ["address_id"], name: "index_spree_credit_cards_on_address_id" + add_index "spree_credit_cards", ["payment_method_id"], name: "index_spree_credit_cards_on_payment_method_id" + add_index "spree_credit_cards", ["user_id"], name: "index_spree_credit_cards_on_user_id" + + create_table "spree_customer_returns", force: :cascade do |t| + t.string "number" + t.integer "stock_location_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + end + + create_table "spree_gateways", force: :cascade 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.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.text "preferences" + end + + add_index "spree_gateways", ["active"], name: "index_spree_gateways_on_active" + add_index "spree_gateways", ["test_mode"], name: "index_spree_gateways_on_test_mode" + + create_table "spree_inventory_units", force: :cascade do |t| + t.string "state" + t.integer "variant_id" + t.integer "order_id" + t.integer "shipment_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.boolean "pending", default: true + t.integer "line_item_id" + end + + add_index "spree_inventory_units", ["line_item_id"], name: "index_spree_inventory_units_on_line_item_id" + add_index "spree_inventory_units", ["order_id"], name: "index_inventory_units_on_order_id" + add_index "spree_inventory_units", ["shipment_id"], name: "index_inventory_units_on_shipment_id" + add_index "spree_inventory_units", ["variant_id"], name: "index_inventory_units_on_variant_id" + + create_table "spree_line_items", force: :cascade do |t| + t.integer "variant_id" + t.integer "order_id" + t.integer "quantity", null: false + t.decimal "price", precision: 10, scale: 2, null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.string "currency" + t.decimal "cost_price", precision: 10, scale: 2 + t.integer "tax_category_id" + t.decimal "adjustment_total", precision: 10, scale: 2, default: 0.0 + t.decimal "additional_tax_total", precision: 10, scale: 2, default: 0.0 + t.decimal "promo_total", precision: 10, scale: 2, default: 0.0 + t.decimal "included_tax_total", precision: 10, scale: 2, default: 0.0, null: false + t.decimal "pre_tax_amount", precision: 12, scale: 4, default: 0.0, null: false + t.decimal "taxable_adjustment_total", precision: 10, scale: 2, default: 0.0, null: false + t.decimal "non_taxable_adjustment_total", precision: 10, scale: 2, default: 0.0, null: false + end + + add_index "spree_line_items", ["order_id"], name: "index_spree_line_items_on_order_id" + add_index "spree_line_items", ["tax_category_id"], name: "index_spree_line_items_on_tax_category_id" + add_index "spree_line_items", ["variant_id"], name: "index_spree_line_items_on_variant_id" + + create_table "spree_log_entries", force: :cascade do |t| + t.integer "source_id" + t.string "source_type" + t.text "details" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + end + + add_index "spree_log_entries", ["source_id", "source_type"], name: "index_spree_log_entries_on_source_id_and_source_type" + + create_table "spree_option_type_prototypes", force: :cascade do |t| + t.integer "prototype_id" + t.integer "option_type_id" + end + + add_index "spree_option_type_prototypes", ["option_type_id"], name: "index_spree_option_type_prototypes_on_option_type_id" + add_index "spree_option_type_prototypes", ["prototype_id", "option_type_id"], name: "index_option_types_prototypes_on_prototype_and_option_type" + + create_table "spree_option_types", force: :cascade do |t| + t.string "name", limit: 100 + t.string "presentation", limit: 100 + t.integer "position", default: 0, null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + end + + add_index "spree_option_types", ["name"], name: "index_spree_option_types_on_name" + add_index "spree_option_types", ["position"], name: "index_spree_option_types_on_position" + + create_table "spree_option_value_variants", force: :cascade do |t| + t.integer "variant_id" + t.integer "option_value_id" + end + + add_index "spree_option_value_variants", ["option_value_id"], name: "index_spree_option_value_variants_on_option_value_id" + add_index "spree_option_value_variants", ["variant_id", "option_value_id"], name: "index_option_values_variants_on_variant_id_and_option_value_id" + + create_table "spree_option_values", force: :cascade do |t| + t.integer "position" + t.string "name" + t.string "presentation" + t.integer "option_type_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + end + + add_index "spree_option_values", ["name"], name: "index_spree_option_values_on_name" + add_index "spree_option_values", ["option_type_id"], name: "index_spree_option_values_on_option_type_id" + add_index "spree_option_values", ["position"], name: "index_spree_option_values_on_position" + + create_table "spree_order_promotions", force: :cascade do |t| + t.integer "order_id" + t.integer "promotion_id" + end + + add_index "spree_order_promotions", ["order_id"], name: "index_spree_order_promotions_on_order_id" + add_index "spree_order_promotions", ["promotion_id", "order_id"], name: "index_spree_order_promotions_on_promotion_id_and_order_id" + + create_table "spree_orders", force: :cascade do |t| + t.string "number", limit: 32 + t.decimal "item_total", precision: 10, scale: 2, default: 0.0, null: false + t.decimal "total", precision: 10, scale: 2, default: 0.0, null: false + t.string "state" + t.decimal "adjustment_total", precision: 10, scale: 2, default: 0.0, null: false + t.integer "user_id" + t.datetime "completed_at" + t.integer "bill_address_id" + t.integer "ship_address_id" + t.decimal "payment_total", precision: 10, scale: 2, default: 0.0 + t.string "shipment_state" + t.string "payment_state" + t.string "email" + t.text "special_instructions" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.string "currency" + t.string "last_ip_address" + t.integer "created_by_id" + t.decimal "shipment_total", precision: 10, scale: 2, default: 0.0, null: false + t.decimal "additional_tax_total", precision: 10, scale: 2, default: 0.0 + t.decimal "promo_total", precision: 10, scale: 2, default: 0.0 + t.string "channel", default: "spree" + t.decimal "included_tax_total", precision: 10, scale: 2, default: 0.0, null: false + t.integer "item_count", default: 0 + t.integer "approver_id" + t.datetime "approved_at" + t.boolean "confirmation_delivered", default: false + t.boolean "considered_risky", default: false + t.string "guest_token" + t.datetime "canceled_at" + t.integer "canceler_id" + t.integer "store_id" + t.integer "state_lock_version", default: 0, null: false + t.decimal "taxable_adjustment_total", precision: 10, scale: 2, default: 0.0, null: false + t.decimal "non_taxable_adjustment_total", precision: 10, scale: 2, default: 0.0, null: false + end + + add_index "spree_orders", ["approver_id"], name: "index_spree_orders_on_approver_id" + add_index "spree_orders", ["bill_address_id"], name: "index_spree_orders_on_bill_address_id" + add_index "spree_orders", ["canceler_id"], name: "index_spree_orders_on_canceler_id" + add_index "spree_orders", ["completed_at"], name: "index_spree_orders_on_completed_at" + add_index "spree_orders", ["confirmation_delivered"], name: "index_spree_orders_on_confirmation_delivered" + add_index "spree_orders", ["considered_risky"], name: "index_spree_orders_on_considered_risky" + add_index "spree_orders", ["created_by_id"], name: "index_spree_orders_on_created_by_id" + add_index "spree_orders", ["guest_token"], name: "index_spree_orders_on_guest_token" + add_index "spree_orders", ["number"], name: "index_spree_orders_on_number" + add_index "spree_orders", ["ship_address_id"], name: "index_spree_orders_on_ship_address_id" + add_index "spree_orders", ["store_id"], name: "index_spree_orders_on_store_id" + add_index "spree_orders", ["user_id", "created_by_id"], name: "index_spree_orders_on_user_id_and_created_by_id" + + create_table "spree_payment_capture_events", force: :cascade do |t| + t.decimal "amount", precision: 10, scale: 2, default: 0.0 + t.integer "payment_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + end + + add_index "spree_payment_capture_events", ["payment_id"], name: "index_spree_payment_capture_events_on_payment_id" + + create_table "spree_payment_methods", force: :cascade do |t| + t.string "type" + t.string "name" + t.text "description" + t.boolean "active", default: true + t.datetime "deleted_at" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.string "display_on", default: "both" + t.boolean "auto_capture" + t.text "preferences" + t.integer "position", default: 0 + end + + add_index "spree_payment_methods", ["id", "type"], name: "index_spree_payment_methods_on_id_and_type" + + create_table "spree_payments", force: :cascade do |t| + t.decimal "amount", precision: 10, scale: 2, default: 0.0, null: false + t.integer "order_id" + t.integer "source_id" + t.string "source_type" + t.integer "payment_method_id" + t.string "state" + t.string "response_code" + t.string "avs_response" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.string "number" + t.string "cvv_response_code" + t.string "cvv_response_message" + end + + add_index "spree_payments", ["number"], name: "index_spree_payments_on_number" + add_index "spree_payments", ["order_id"], name: "index_spree_payments_on_order_id" + add_index "spree_payments", ["payment_method_id"], name: "index_spree_payments_on_payment_method_id" + add_index "spree_payments", ["source_id", "source_type"], name: "index_spree_payments_on_source_id_and_source_type" + + create_table "spree_preferences", force: :cascade do |t| + t.text "value" + t.string "key" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + end + + add_index "spree_preferences", ["key"], name: "index_spree_preferences_on_key", unique: true + + create_table "spree_prices", force: :cascade do |t| + t.integer "variant_id", null: false + t.decimal "amount", precision: 10, scale: 2 + t.string "currency" + t.datetime "deleted_at" + end + + add_index "spree_prices", ["deleted_at"], name: "index_spree_prices_on_deleted_at" + add_index "spree_prices", ["variant_id", "currency"], name: "index_spree_prices_on_variant_id_and_currency" + add_index "spree_prices", ["variant_id"], name: "index_spree_prices_on_variant_id" + + create_table "spree_product_option_types", force: :cascade do |t| + t.integer "position" + t.integer "product_id" + t.integer "option_type_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + end + + add_index "spree_product_option_types", ["option_type_id"], name: "index_spree_product_option_types_on_option_type_id" + add_index "spree_product_option_types", ["position"], name: "index_spree_product_option_types_on_position" + add_index "spree_product_option_types", ["product_id"], name: "index_spree_product_option_types_on_product_id" + + create_table "spree_product_promotion_rules", force: :cascade do |t| + t.integer "product_id" + t.integer "promotion_rule_id" + end + + add_index "spree_product_promotion_rules", ["product_id"], name: "index_products_promotion_rules_on_product_id" + add_index "spree_product_promotion_rules", ["promotion_rule_id", "product_id"], name: "index_products_promotion_rules_on_promotion_rule_and_product" + + create_table "spree_product_properties", force: :cascade do |t| + t.string "value" + t.integer "product_id" + t.integer "property_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.integer "position", default: 0 + end + + add_index "spree_product_properties", ["position"], name: "index_spree_product_properties_on_position" + add_index "spree_product_properties", ["product_id"], name: "index_product_properties_on_product_id" + add_index "spree_product_properties", ["property_id"], name: "index_spree_product_properties_on_property_id" + + create_table "spree_products", force: :cascade do |t| + t.string "name", default: "", null: false + t.text "description" + t.datetime "available_on" + t.datetime "deleted_at" + t.string "slug" + t.text "meta_description" + t.string "meta_keywords" + t.integer "tax_category_id" + t.integer "shipping_category_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.boolean "promotionable", default: true + t.string "meta_title" + t.datetime "discontinue_on" + 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", ["discontinue_on"], name: "index_spree_products_on_discontinue_on" + add_index "spree_products", ["name"], name: "index_spree_products_on_name" + add_index "spree_products", ["shipping_category_id"], name: "index_spree_products_on_shipping_category_id" + add_index "spree_products", ["slug"], name: "index_spree_products_on_slug", unique: true + add_index "spree_products", ["tax_category_id"], name: "index_spree_products_on_tax_category_id" + + create_table "spree_products_taxons", force: :cascade do |t| + t.integer "product_id" + t.integer "taxon_id" + t.integer "position" + end + + add_index "spree_products_taxons", ["position"], name: "index_spree_products_taxons_on_position" + 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_promotion_action_line_items", force: :cascade do |t| + t.integer "promotion_action_id" + t.integer "variant_id" + t.integer "quantity", default: 1 + end + + add_index "spree_promotion_action_line_items", ["promotion_action_id"], name: "index_spree_promotion_action_line_items_on_promotion_action_id" + add_index "spree_promotion_action_line_items", ["variant_id"], name: "index_spree_promotion_action_line_items_on_variant_id" + + create_table "spree_promotion_actions", force: :cascade do |t| + t.integer "promotion_id" + t.integer "position" + t.string "type" + t.datetime "deleted_at" + end + + add_index "spree_promotion_actions", ["deleted_at"], name: "index_spree_promotion_actions_on_deleted_at" + add_index "spree_promotion_actions", ["id", "type"], name: "index_spree_promotion_actions_on_id_and_type" + add_index "spree_promotion_actions", ["promotion_id"], name: "index_spree_promotion_actions_on_promotion_id" + + create_table "spree_promotion_categories", force: :cascade do |t| + t.string "name" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.string "code" + end + + create_table "spree_promotion_rule_taxons", force: :cascade do |t| + t.integer "taxon_id" + t.integer "promotion_rule_id" + end + + add_index "spree_promotion_rule_taxons", ["promotion_rule_id"], name: "index_spree_promotion_rule_taxons_on_promotion_rule_id" + add_index "spree_promotion_rule_taxons", ["taxon_id"], name: "index_spree_promotion_rule_taxons_on_taxon_id" + + create_table "spree_promotion_rule_users", force: :cascade do |t| + t.integer "user_id" + t.integer "promotion_rule_id" + end + + add_index "spree_promotion_rule_users", ["promotion_rule_id"], name: "index_promotion_rules_users_on_promotion_rule_id" + add_index "spree_promotion_rule_users", ["user_id", "promotion_rule_id"], name: "index_promotion_rules_users_on_user_id_and_promotion_rule_id" + + create_table "spree_promotion_rules", force: :cascade do |t| + t.integer "promotion_id" + t.integer "user_id" + t.integer "product_group_id" + t.string "type" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.string "code" + t.text "preferences" + end + + add_index "spree_promotion_rules", ["product_group_id"], name: "index_promotion_rules_on_product_group_id" + add_index "spree_promotion_rules", ["promotion_id"], name: "index_spree_promotion_rules_on_promotion_id" + add_index "spree_promotion_rules", ["user_id"], name: "index_promotion_rules_on_user_id" + + create_table "spree_promotions", force: :cascade do |t| + t.string "description" + t.datetime "expires_at" + t.datetime "starts_at" + t.string "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.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.integer "promotion_category_id" + end + + add_index "spree_promotions", ["advertise"], name: "index_spree_promotions_on_advertise" + add_index "spree_promotions", ["code"], name: "index_spree_promotions_on_code" + add_index "spree_promotions", ["expires_at"], name: "index_spree_promotions_on_expires_at" + add_index "spree_promotions", ["id", "type"], name: "index_spree_promotions_on_id_and_type" + add_index "spree_promotions", ["promotion_category_id"], name: "index_spree_promotions_on_promotion_category_id" + add_index "spree_promotions", ["starts_at"], name: "index_spree_promotions_on_starts_at" + + create_table "spree_properties", force: :cascade do |t| + t.string "name" + t.string "presentation", null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + end + + add_index "spree_properties", ["name"], name: "index_spree_properties_on_name" + + create_table "spree_property_prototypes", force: :cascade do |t| + t.integer "prototype_id" + t.integer "property_id" + end + + add_index "spree_property_prototypes", ["prototype_id", "property_id"], name: "index_properties_prototypes_on_prototype_and_property" + + create_table "spree_prototype_taxons", force: :cascade do |t| + t.integer "taxon_id" + t.integer "prototype_id" + end + + add_index "spree_prototype_taxons", ["prototype_id", "taxon_id"], name: "index_spree_prototype_taxons_on_prototype_id_and_taxon_id" + add_index "spree_prototype_taxons", ["taxon_id"], name: "index_spree_prototype_taxons_on_taxon_id" + + create_table "spree_prototypes", force: :cascade do |t| + t.string "name" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + end + + create_table "spree_refund_reasons", force: :cascade do |t| + t.string "name" + t.boolean "active", default: true + t.boolean "mutable", default: true + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + end + + create_table "spree_refunds", force: :cascade do |t| + t.integer "payment_id" + t.decimal "amount", precision: 10, scale: 2, default: 0.0, null: false + t.string "transaction_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.integer "refund_reason_id" + t.integer "reimbursement_id" + end + + add_index "spree_refunds", ["refund_reason_id"], name: "index_refunds_on_refund_reason_id" + + create_table "spree_reimbursement_credits", force: :cascade do |t| + t.decimal "amount", precision: 10, scale: 2, default: 0.0, null: false + t.integer "reimbursement_id" + t.integer "creditable_id" + t.string "creditable_type" + end + + create_table "spree_reimbursement_types", force: :cascade do |t| + t.string "name" + t.boolean "active", default: true + t.boolean "mutable", default: true + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.string "type" + end + + add_index "spree_reimbursement_types", ["type"], name: "index_spree_reimbursement_types_on_type" + + create_table "spree_reimbursements", force: :cascade do |t| + t.string "number" + t.string "reimbursement_status" + t.integer "customer_return_id" + t.integer "order_id" + t.decimal "total", precision: 10, scale: 2 + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + end + + add_index "spree_reimbursements", ["customer_return_id"], name: "index_spree_reimbursements_on_customer_return_id" + add_index "spree_reimbursements", ["order_id"], name: "index_spree_reimbursements_on_order_id" + + create_table "spree_return_authorization_reasons", force: :cascade do |t| + t.string "name" + t.boolean "active", default: true + t.boolean "mutable", default: true + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + end + + create_table "spree_return_authorizations", force: :cascade do |t| + t.string "number" + t.string "state" + t.integer "order_id" + t.text "memo" + t.datetime "created_at" + t.datetime "updated_at" + t.integer "stock_location_id" + t.integer "return_authorization_reason_id" + end + + add_index "spree_return_authorizations", ["return_authorization_reason_id"], name: "index_return_authorizations_on_return_authorization_reason_id" + + create_table "spree_return_items", force: :cascade do |t| + t.integer "return_authorization_id" + t.integer "inventory_unit_id" + t.integer "exchange_variant_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.decimal "pre_tax_amount", precision: 12, scale: 4, default: 0.0, null: false + t.decimal "included_tax_total", precision: 12, scale: 4, default: 0.0, null: false + t.decimal "additional_tax_total", precision: 12, scale: 4, default: 0.0, null: false + t.string "reception_status" + t.string "acceptance_status" + t.integer "customer_return_id" + t.integer "reimbursement_id" + t.integer "exchange_inventory_unit_id" + t.text "acceptance_status_errors" + t.integer "preferred_reimbursement_type_id" + t.integer "override_reimbursement_type_id" + t.boolean "resellable", default: true, null: false + end + + add_index "spree_return_items", ["customer_return_id"], name: "index_return_items_on_customer_return_id" + add_index "spree_return_items", ["exchange_inventory_unit_id"], name: "index_spree_return_items_on_exchange_inventory_unit_id" + + create_table "spree_role_users", force: :cascade do |t| + t.integer "role_id" + t.integer "user_id" + end + + add_index "spree_role_users", ["role_id"], name: "index_spree_role_users_on_role_id" + add_index "spree_role_users", ["user_id"], name: "index_spree_role_users_on_user_id" + + create_table "spree_roles", force: :cascade do |t| + t.string "name" + end + + add_index "spree_roles", ["name"], name: "index_spree_roles_on_name" + + create_table "spree_shipments", force: :cascade do |t| + t.string "tracking" + t.string "number" + t.decimal "cost", precision: 10, scale: 2, default: 0.0 + t.datetime "shipped_at" + t.integer "order_id" + t.integer "address_id" + t.string "state" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.integer "stock_location_id" + t.decimal "adjustment_total", precision: 10, scale: 2, default: 0.0 + t.decimal "additional_tax_total", precision: 10, scale: 2, default: 0.0 + t.decimal "promo_total", precision: 10, scale: 2, default: 0.0 + t.decimal "included_tax_total", precision: 10, scale: 2, default: 0.0, null: false + t.decimal "pre_tax_amount", precision: 12, scale: 4, default: 0.0, null: false + t.decimal "taxable_adjustment_total", precision: 10, scale: 2, default: 0.0, null: false + t.decimal "non_taxable_adjustment_total", precision: 10, scale: 2, default: 0.0, null: false + end + + add_index "spree_shipments", ["address_id"], name: "index_spree_shipments_on_address_id" + add_index "spree_shipments", ["number"], name: "index_shipments_on_number" + add_index "spree_shipments", ["order_id"], name: "index_spree_shipments_on_order_id" + add_index "spree_shipments", ["stock_location_id"], name: "index_spree_shipments_on_stock_location_id" + + create_table "spree_shipping_categories", force: :cascade do |t| + t.string "name" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + end + + add_index "spree_shipping_categories", ["name"], name: "index_spree_shipping_categories_on_name" + + create_table "spree_shipping_method_categories", force: :cascade do |t| + t.integer "shipping_method_id", null: false + t.integer "shipping_category_id", null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + end + + add_index "spree_shipping_method_categories", ["shipping_category_id", "shipping_method_id"], name: "unique_spree_shipping_method_categories", unique: true + add_index "spree_shipping_method_categories", ["shipping_method_id"], name: "index_spree_shipping_method_categories_on_shipping_method_id" + + create_table "spree_shipping_method_zones", force: :cascade do |t| + t.integer "shipping_method_id" + t.integer "zone_id" + end + + create_table "spree_shipping_methods", force: :cascade do |t| + t.string "name" + t.string "display_on" + t.datetime "deleted_at" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.string "tracking_url" + t.string "admin_name" + t.integer "tax_category_id" + t.string "code" + end + + add_index "spree_shipping_methods", ["deleted_at"], name: "index_spree_shipping_methods_on_deleted_at" + add_index "spree_shipping_methods", ["tax_category_id"], name: "index_spree_shipping_methods_on_tax_category_id" + + create_table "spree_shipping_rates", force: :cascade do |t| + t.integer "shipment_id" + t.integer "shipping_method_id" + t.boolean "selected", default: false + t.decimal "cost", precision: 8, scale: 2, default: 0.0 + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.integer "tax_rate_id" + end + + add_index "spree_shipping_rates", ["selected"], name: "index_spree_shipping_rates_on_selected" + add_index "spree_shipping_rates", ["shipment_id", "shipping_method_id"], name: "spree_shipping_rates_join_index", unique: true + add_index "spree_shipping_rates", ["tax_rate_id"], name: "index_spree_shipping_rates_on_tax_rate_id" + + create_table "spree_skrill_transactions", force: :cascade do |t| + t.string "email" + t.float "amount" + t.string "currency" + t.integer "transaction_id" + t.integer "customer_id" + t.string "payment_type" + t.datetime "created_at" + t.datetime "updated_at" + end + + create_table "spree_state_changes", force: :cascade do |t| + t.string "name" + t.string "previous_state" + t.integer "stateful_id" + t.integer "user_id" + t.string "stateful_type" + t.string "next_state" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + end + + add_index "spree_state_changes", ["stateful_id", "stateful_type"], name: "index_spree_state_changes_on_stateful_id_and_stateful_type" + + create_table "spree_states", force: :cascade do |t| + t.string "name" + t.string "abbr" + t.integer "country_id" + t.datetime "updated_at" + end + + add_index "spree_states", ["country_id"], name: "index_spree_states_on_country_id" + + create_table "spree_stock_items", force: :cascade do |t| + t.integer "stock_location_id" + t.integer "variant_id" + t.integer "count_on_hand", default: 0, null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.boolean "backorderable", default: false + t.datetime "deleted_at" + end + + add_index "spree_stock_items", ["backorderable"], name: "index_spree_stock_items_on_backorderable" + add_index "spree_stock_items", ["deleted_at"], name: "index_spree_stock_items_on_deleted_at" + add_index "spree_stock_items", ["stock_location_id", "variant_id"], name: "stock_item_by_loc_and_var_id" + add_index "spree_stock_items", ["variant_id"], name: "index_spree_stock_items_on_variant_id" + + create_table "spree_stock_locations", force: :cascade do |t| + t.string "name" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.boolean "default", default: false, null: false + t.string "address1" + t.string "address2" + t.string "city" + t.integer "state_id" + t.string "state_name" + t.integer "country_id" + t.string "zipcode" + t.string "phone" + t.boolean "active", default: true + t.boolean "backorderable_default", default: false + t.boolean "propagate_all_variants", default: true + t.string "admin_name" + end + + add_index "spree_stock_locations", ["active"], name: "index_spree_stock_locations_on_active" + add_index "spree_stock_locations", ["backorderable_default"], name: "index_spree_stock_locations_on_backorderable_default" + add_index "spree_stock_locations", ["country_id"], name: "index_spree_stock_locations_on_country_id" + add_index "spree_stock_locations", ["propagate_all_variants"], name: "index_spree_stock_locations_on_propagate_all_variants" + add_index "spree_stock_locations", ["state_id"], name: "index_spree_stock_locations_on_state_id" + + create_table "spree_stock_movements", force: :cascade do |t| + t.integer "stock_item_id" + t.integer "quantity", default: 0 + t.string "action" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.integer "originator_id" + t.string "originator_type" + end + + add_index "spree_stock_movements", ["stock_item_id"], name: "index_spree_stock_movements_on_stock_item_id" + + create_table "spree_stock_transfers", force: :cascade do |t| + t.string "type" + t.string "reference" + t.integer "source_location_id" + t.integer "destination_location_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.string "number" + end + + add_index "spree_stock_transfers", ["destination_location_id"], name: "index_spree_stock_transfers_on_destination_location_id" + add_index "spree_stock_transfers", ["number"], name: "index_spree_stock_transfers_on_number" + add_index "spree_stock_transfers", ["source_location_id"], name: "index_spree_stock_transfers_on_source_location_id" + + create_table "spree_store_credit_categories", force: :cascade do |t| + t.string "name" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + end + + create_table "spree_store_credit_events", force: :cascade do |t| + t.integer "store_credit_id", null: false + t.string "action", null: false + t.decimal "amount", precision: 8, scale: 2 + t.string "authorization_code", null: false + t.decimal "user_total_amount", precision: 8, scale: 2, default: 0.0, null: false + t.integer "originator_id" + t.string "originator_type" + t.datetime "deleted_at" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + end + + add_index "spree_store_credit_events", ["originator_id", "originator_type"], name: "spree_store_credit_events_originator" + add_index "spree_store_credit_events", ["store_credit_id"], name: "index_spree_store_credit_events_on_store_credit_id" + + create_table "spree_store_credit_types", force: :cascade do |t| + t.string "name" + t.integer "priority" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + end + + add_index "spree_store_credit_types", ["priority"], name: "index_spree_store_credit_types_on_priority" + + create_table "spree_store_credits", force: :cascade do |t| + t.integer "user_id" + t.integer "category_id" + t.integer "created_by_id" + t.decimal "amount", precision: 8, scale: 2, default: 0.0, null: false + t.decimal "amount_used", precision: 8, scale: 2, default: 0.0, null: false + t.text "memo" + t.datetime "deleted_at" + t.string "currency" + t.decimal "amount_authorized", precision: 8, scale: 2, default: 0.0, null: false + t.integer "originator_id" + t.string "originator_type" + t.integer "type_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + end + + add_index "spree_store_credits", ["deleted_at"], name: "index_spree_store_credits_on_deleted_at" + add_index "spree_store_credits", ["originator_id", "originator_type"], name: "spree_store_credits_originator" + add_index "spree_store_credits", ["type_id"], name: "index_spree_store_credits_on_type_id" + add_index "spree_store_credits", ["user_id"], name: "index_spree_store_credits_on_user_id" + + create_table "spree_stores", force: :cascade do |t| + t.string "name" + t.string "url" + t.text "meta_description" + t.text "meta_keywords" + t.string "seo_title" + t.string "mail_from_address" + t.string "default_currency" + t.string "code" + t.boolean "default", default: false, null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + end + + add_index "spree_stores", ["code"], name: "index_spree_stores_on_code" + add_index "spree_stores", ["default"], name: "index_spree_stores_on_default" + add_index "spree_stores", ["url"], name: "index_spree_stores_on_url" + + create_table "spree_tax_categories", force: :cascade do |t| + t.string "name" + t.string "description" + t.boolean "is_default", default: false + t.datetime "deleted_at" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.string "tax_code" + end + + add_index "spree_tax_categories", ["deleted_at"], name: "index_spree_tax_categories_on_deleted_at" + add_index "spree_tax_categories", ["is_default"], name: "index_spree_tax_categories_on_is_default" + + create_table "spree_tax_rates", force: :cascade do |t| + t.decimal "amount", precision: 8, scale: 5 + t.integer "zone_id" + t.integer "tax_category_id" + t.boolean "included_in_price", default: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.string "name" + t.boolean "show_rate_in_label", default: true + t.datetime "deleted_at" + end + + add_index "spree_tax_rates", ["deleted_at"], name: "index_spree_tax_rates_on_deleted_at" + add_index "spree_tax_rates", ["included_in_price"], name: "index_spree_tax_rates_on_included_in_price" + add_index "spree_tax_rates", ["show_rate_in_label"], name: "index_spree_tax_rates_on_show_rate_in_label" + add_index "spree_tax_rates", ["tax_category_id"], name: "index_spree_tax_rates_on_tax_category_id" + add_index "spree_tax_rates", ["zone_id"], name: "index_spree_tax_rates_on_zone_id" + + create_table "spree_taxonomies", force: :cascade do |t| + t.string "name", null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.integer "position", default: 0 + end + + add_index "spree_taxonomies", ["position"], name: "index_spree_taxonomies_on_position" + + create_table "spree_taxons", force: :cascade do |t| + t.integer "parent_id" + t.integer "position", default: 0 + t.string "name", null: false + t.string "permalink" + t.integer "taxonomy_id" + 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.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.string "meta_title" + t.string "meta_description" + t.string "meta_keywords" + t.integer "depth" + end + + add_index "spree_taxons", ["lft"], name: "index_spree_taxons_on_lft" + add_index "spree_taxons", ["name"], name: "index_spree_taxons_on_name" + 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", ["position"], name: "index_spree_taxons_on_position" + add_index "spree_taxons", ["rgt"], name: "index_spree_taxons_on_rgt" + add_index "spree_taxons", ["taxonomy_id"], name: "index_taxons_on_taxonomy_id" + + create_table "spree_trackers", force: :cascade do |t| + t.string "analytics_id" + t.boolean "active", default: true + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + end + + add_index "spree_trackers", ["active"], name: "index_spree_trackers_on_active" + + create_table "spree_users", force: :cascade 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.integer "ship_address_id" + t.integer "bill_address_id" + t.string "authentication_token" + t.string "unlock_token" + t.datetime "locked_at" + t.datetime "reset_password_sent_at" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.string "spree_api_key", limit: 48 + t.datetime "remember_created_at" + t.datetime "deleted_at" + t.string "confirmation_token" + t.datetime "confirmed_at" + t.datetime "confirmation_sent_at" + end + + add_index "spree_users", ["bill_address_id"], name: "index_spree_users_on_bill_address_id" + add_index "spree_users", ["deleted_at"], name: "index_spree_users_on_deleted_at" + add_index "spree_users", ["email"], name: "email_idx_unique", unique: true + add_index "spree_users", ["ship_address_id"], name: "index_spree_users_on_ship_address_id" + add_index "spree_users", ["spree_api_key"], name: "index_spree_users_on_spree_api_key" + + create_table "spree_variants", force: :cascade do |t| + t.string "sku", default: "", null: false + t.decimal "weight", precision: 8, scale: 2, default: 0.0 + 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.integer "product_id" + t.decimal "cost_price", precision: 10, scale: 2 + t.integer "position" + t.string "cost_currency" + t.boolean "track_inventory", default: true + t.integer "tax_category_id" + t.datetime "updated_at" + t.integer "stock_items_count", default: 0, null: false + t.datetime "discontinue_on" + end + + add_index "spree_variants", ["deleted_at"], name: "index_spree_variants_on_deleted_at" + add_index "spree_variants", ["discontinue_on"], name: "index_spree_variants_on_discontinue_on" + add_index "spree_variants", ["is_master"], name: "index_spree_variants_on_is_master" + add_index "spree_variants", ["position"], name: "index_spree_variants_on_position" + add_index "spree_variants", ["product_id"], name: "index_spree_variants_on_product_id" + add_index "spree_variants", ["sku"], name: "index_spree_variants_on_sku" + add_index "spree_variants", ["tax_category_id"], name: "index_spree_variants_on_tax_category_id" + add_index "spree_variants", ["track_inventory"], name: "index_spree_variants_on_track_inventory" + + create_table "spree_zone_members", force: :cascade do |t| + t.integer "zoneable_id" + t.string "zoneable_type" + t.integer "zone_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + end + + add_index "spree_zone_members", ["zone_id"], name: "index_spree_zone_members_on_zone_id" + add_index "spree_zone_members", ["zoneable_id", "zoneable_type"], name: "index_spree_zone_members_on_zoneable_id_and_zoneable_type" + + create_table "spree_zones", force: :cascade do |t| + t.string "name" + t.string "description" + t.boolean "default_tax", default: false + t.integer "zone_members_count", default: 0 + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.string "kind" + end + + add_index "spree_zones", ["default_tax"], name: "index_spree_zones_on_default_tax" + add_index "spree_zones", ["kind"], name: "index_spree_zones_on_kind" + +end diff --git a/db/seeds.rb b/db/seeds.rb new file mode 100644 index 0000000..8fef18a --- /dev/null +++ b/db/seeds.rb @@ -0,0 +1,11 @@ +# This file should contain all the record creation needed to seed the database with its default values. +# The data can then be loaded with the rake db:seed (or created alongside the db with db:setup). +# +# Examples: +# +# cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }]) +# Mayor.create(name: 'Emanuel', city: cities.first) + + +Spree::Core::Engine.load_seed if defined?(Spree::Core) +Spree::Auth::Engine.load_seed if defined?(Spree::Auth) diff --git a/lib/assets/.keep b/lib/assets/.keep new file mode 100644 index 0000000..e69de29 diff --git a/lib/tasks/.keep b/lib/tasks/.keep new file mode 100644 index 0000000..e69de29 diff --git a/log/.keep b/log/.keep new file mode 100644 index 0000000..e69de29 diff --git a/public/404.html b/public/404.html new file mode 100644 index 0000000..b612547 --- /dev/null +++ b/public/404.html @@ -0,0 +1,67 @@ + + + + The page you were looking for doesn't exist (404) + + + + + + +
+
+

The page you were looking for doesn't exist.

+

You may have mistyped the address or the page may have moved.

+
+

If you are the application owner check the logs for more information.

+
+ + diff --git a/public/422.html b/public/422.html new file mode 100644 index 0000000..a21f82b --- /dev/null +++ b/public/422.html @@ -0,0 +1,67 @@ + + + + The change you wanted was rejected (422) + + + + + + +
+
+

The change you wanted was rejected.

+

Maybe you tried to change something you didn't have access to.

+
+

If you are the application owner check the logs for more information.

+
+ + diff --git a/public/500.html b/public/500.html new file mode 100644 index 0000000..061abc5 --- /dev/null +++ b/public/500.html @@ -0,0 +1,66 @@ + + + + We're sorry, but something went wrong (500) + + + + + + +
+
+

We're sorry, but something went wrong.

+
+

If you are the application owner check the logs for more information.

+
+ + diff --git a/public/favicon.ico b/public/favicon.ico new file mode 100644 index 0000000..e69de29 diff --git a/public/robots.txt b/public/robots.txt new file mode 100644 index 0000000..f087b0d --- /dev/null +++ b/public/robots.txt @@ -0,0 +1,13 @@ +# See http://www.robotstxt.org/robotstxt.html for documentation on how to use the robots.txt file +# +# To ban all spiders from the entire site uncomment the next two lines: +# User-agent: * +# Disallow: / +User-agent: * +Disallow: /checkout +Disallow: /cart +Disallow: /orders +Disallow: /user +Disallow: /account +Disallow: /api +Disallow: /password diff --git a/vendor/assets/javascripts/.keep b/vendor/assets/javascripts/.keep new file mode 100644 index 0000000..e69de29 diff --git a/vendor/assets/javascripts/spree/backend/all.js b/vendor/assets/javascripts/spree/backend/all.js new file mode 100644 index 0000000..63e301e --- /dev/null +++ b/vendor/assets/javascripts/spree/backend/all.js @@ -0,0 +1,11 @@ +// This is a manifest file that'll be compiled into including all the files listed below. +// Add new JavaScript/Coffee code in separate files in this directory and they'll automatically +// be included in the compiled file accessible from http://example.com/assets/application.js +// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the +// the compiled file. +// +//= require jquery +//= require jquery_ujs +//= require spree/backend + +//= require_tree . diff --git a/vendor/assets/javascripts/spree/frontend/all.js b/vendor/assets/javascripts/spree/frontend/all.js new file mode 100644 index 0000000..0bb9f3b --- /dev/null +++ b/vendor/assets/javascripts/spree/frontend/all.js @@ -0,0 +1,12 @@ +// This is a manifest file that'll be compiled into including all the files listed below. +// Add new JavaScript/Coffee code in separate files in this directory and they'll automatically +// be included in the compiled file accessible from http://example.com/assets/application.js +// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the +// the compiled file. +// +//= require jquery +//= require jquery_ujs +//= require spree/frontend + +//= require_tree . +//= require spree/frontend/spree_auth diff --git a/vendor/assets/stylesheets/.keep b/vendor/assets/stylesheets/.keep new file mode 100644 index 0000000..e69de29 diff --git a/vendor/assets/stylesheets/spree/backend/all.css b/vendor/assets/stylesheets/spree/backend/all.css new file mode 100644 index 0000000..3319270 --- /dev/null +++ b/vendor/assets/stylesheets/spree/backend/all.css @@ -0,0 +1,10 @@ +/* + * This is a manifest file that'll automatically include all the stylesheets available in this directory + * and any sub-directories. You're free to add application-wide styles to this file and they'll appear at + * the top of the compiled file, but it's generally better to create a new file per style scope. + * + *= require spree/backend + + *= require_self + *= require_tree . +*/ diff --git a/vendor/assets/stylesheets/spree/frontend/all.css b/vendor/assets/stylesheets/spree/frontend/all.css new file mode 100644 index 0000000..1fc8378 --- /dev/null +++ b/vendor/assets/stylesheets/spree/frontend/all.css @@ -0,0 +1,10 @@ +/* + * This is a manifest file that'll automatically include all the stylesheets available in this directory + * and any sub-directories. You're free to add application-wide styles to this file and they'll appear at + * the top of the compiled file, but it's generally better to create a new file per style scope. + * + *= require spree/frontend + + *= require_self + *= require_tree . +*/