├── .github └── workflows │ ├── advertisements-errors.yml │ ├── advertisements-fixed.yml │ ├── advertisements-versions.yml │ ├── advertisements.yml │ ├── attackbox.yml │ ├── discounts-fixed.yml │ ├── discounts-react-app.yml │ ├── discounts.yml │ ├── nginx.yml │ ├── release.yml │ ├── storefront-fixed.yml │ ├── storefront-no-instrumentation.yml │ ├── storefront.yml │ └── traffic-replay.yml ├── .gitignore ├── CHANGELOG.md ├── CODE_OF_CONDUCT.md ├── LICENSE-3rdparty.csv ├── Makefile ├── README.md ├── RELEASING.md ├── UPDATING.md ├── ads-service-errors ├── Dockerfile ├── README.md └── advertisements.patch ├── ads-service-fixed ├── .dockerignore ├── Dockerfile ├── ads.py ├── ads │ ├── 1.jpg │ ├── 2.jpg │ └── 3.jpg ├── bootstrap.py ├── build.sh ├── models.py └── requirements.txt ├── ads-service-versions ├── ads_v1 │ ├── Dockerfile │ └── ads.py ├── ads_v2 │ ├── Dockerfile │ └── ads.py ├── ads_v2_1 │ ├── Dockerfile │ └── ads.py └── common │ ├── ads │ ├── 1.png │ ├── 10.png │ ├── 11.png │ ├── 2.png │ ├── 3.png │ ├── 4.png │ ├── 5.png │ ├── 6.png │ ├── 7.png │ ├── 8.png │ └── 9.png │ ├── bootstrap.py │ ├── models.py │ └── requirements.txt ├── ads-service ├── .dockerignore ├── Dockerfile ├── ads.py ├── ads │ ├── 1.jpg │ ├── 2.jpg │ └── 3.jpg ├── bootstrap.py ├── build.sh ├── models.py └── requirements.txt ├── attackbox ├── .dockerignore ├── Dockerfile ├── README.md ├── attack.sh └── keys │ ├── README.md │ ├── attacker-key │ ├── attacker-key.pub │ └── storedog-leaked-key ├── deploy ├── README.md ├── aws │ └── ecs │ │ ├── README.md │ │ ├── agent-task.json │ │ └── shop-task.json ├── azure │ └── aks │ │ ├── README.md │ │ ├── screenshots │ │ ├── aks_datadog.png │ │ ├── aks_in_event_stream.png │ │ ├── azure_datadog.png │ │ ├── install_k8s_integration.png │ │ ├── storedog.png │ │ └── storedog_ip.png │ │ ├── storedog │ │ ├── advertisements.yaml │ │ ├── db.yaml │ │ ├── discounts.yaml │ │ └── frontend.yaml │ │ ├── values.yaml │ │ └── values_full.yaml ├── datadog │ └── helm-values.yaml.example ├── docker-compose │ ├── .env │ ├── README.md │ ├── docker-compose-broken-instrumented.yml │ ├── docker-compose-broken-no-apm-instrumentation.yml │ ├── docker-compose-broken-no-instrumentation.yml │ ├── docker-compose-discounts-react-baseline.yml │ ├── docker-compose-fixed-instrumented-attack.yml │ ├── docker-compose-fixed-instrumented-livecode.yml │ ├── docker-compose-fixed-instrumented.yml │ ├── docker-compose-latest.yml │ ├── docker-compose-local.yml │ └── docker-compose-traffic-replay.yml ├── gcp │ ├── gke │ │ ├── advertisements.yaml │ │ ├── datadog-agent.yaml │ │ ├── db.yaml │ │ ├── discounts.yaml │ │ └── frontend.yaml │ └── vms │ │ ├── README.md │ │ ├── instance.tf │ │ ├── main.tf │ │ ├── network.tf │ │ ├── outputs.tf │ │ └── variables.tf ├── generic-k8s │ ├── cluster-agent │ │ ├── cluster-agent.yaml │ │ ├── datadog-cluster-agent_service.yaml │ │ ├── datadog-custom-metric-server.yaml │ │ ├── rbac-hpa.yaml │ │ └── secret-app-key.yaml │ ├── datadog-agent │ │ ├── clusterrole.yaml │ │ ├── clusterrolebinding.yaml │ │ ├── datadog-agent.yaml │ │ ├── dca-secret.yaml │ │ └── serviceaccount.yaml │ ├── ecommerce-ads-versions │ │ ├── advertisements_v1.yaml │ │ ├── advertisements_v2.yaml │ │ └── advertisements_v2_1.yaml │ └── ecommerce-app │ │ ├── advertisements.yaml │ │ ├── db.yaml │ │ ├── discounts.yaml │ │ └── frontend.yaml ├── openshift │ ├── cluster-agent │ │ ├── cluster-agent.yaml │ │ ├── datadog-cluster-agent_service.yaml │ │ ├── datadog-custom-metric-server.yaml │ │ ├── rbac-hpa.yaml │ │ └── secret-app-key.yaml │ ├── datadog-agent │ │ ├── clusterrole.yaml │ │ ├── clusterrolebinding.yaml │ │ ├── datadog-agent.yaml │ │ ├── dca-secret.yaml │ │ └── serviceaccount.yaml │ ├── ecommerce-app │ │ ├── advertisements.yaml │ │ ├── db.yaml │ │ ├── discounts.yaml │ │ └── frontend.yaml │ └── openshift_scc │ │ └── scc.yaml └── terraform │ ├── README.md │ ├── aws-ec2 │ ├── .gitignore │ ├── README.md │ ├── install_advertisements_host.sh.tpl │ ├── install_db_host.sh.tpl │ ├── install_discounts_host.sh.tpl │ ├── install_frontend_host.sh.tpl │ ├── main.tf │ ├── network.tf │ ├── outputs.tf │ ├── resources.tf │ ├── runshtemplate │ ├── setuphosts.sh │ └── variables.tf │ └── digitalocean │ ├── README.md │ ├── main.tf │ ├── output.tf │ ├── variables.tf │ └── versions.tf ├── development.md ├── discounts-react-app ├── .dockerignore ├── Dockerfile ├── assets │ ├── docker-compose-EXAMPLE.yml │ └── nginx.conf └── src │ ├── broken-files │ └── src │ │ ├── components │ │ ├── Advertisement.tsx │ │ └── DiscountList.tsx │ │ └── index.tsx │ └── main │ ├── .env.EXAMPLE │ ├── .gitignore │ ├── README.md │ ├── index.html │ ├── package-lock.json │ ├── package.json │ ├── postcss.config.js │ ├── public │ └── assets │ │ └── images │ │ ├── logo.png │ │ └── logo_nobg.png │ ├── src │ ├── App.tsx │ ├── components │ │ ├── Advertisement.tsx │ │ ├── DiscountItem.tsx │ │ ├── DiscountList.tsx │ │ └── Nav.tsx │ ├── index.css │ ├── index.tsx │ └── vite-env.d.ts │ ├── tailwind.config.js │ ├── tsconfig.json │ └── vite.config.ts ├── discounts-service-fixed ├── .dockerignore ├── Dockerfile ├── README.md ├── bootstrap.py ├── build.sh ├── discounts.py ├── models.py ├── requirements.txt ├── test.py ├── words.json └── words.py ├── discounts-service ├── .dockerignore ├── Dockerfile ├── README.md ├── bootstrap.py ├── build.sh ├── discounts.py ├── keys │ ├── README.md │ └── storedog-leaked-key.pub ├── models.py ├── my-wrapper-script.sh ├── requirements.txt ├── test.py ├── words.json └── words.py ├── images ├── 2-ads-versions.gif ├── 500-trace-errors.png ├── bottleneck.gif ├── error-traces.gif ├── extra-latency-ads.jpg ├── extra-latency-solved.jpg ├── logged-errors.png ├── logo.png ├── nplus-query.png ├── problematic-service.gif ├── service-map.png ├── services-list.png ├── solved-nplus.png └── storedog.png ├── license.md ├── nginx ├── Dockerfile └── default.conf ├── service-definitions ├── README.md ├── ads.yaml ├── discounts.yaml ├── frontend.yaml └── screenshot.png ├── store-frontend ├── docker-entrypoint.sh ├── src │ ├── broken-instrumented.patch │ ├── instrumented-fixed.patch │ └── store-frontend-initial-state │ │ ├── .gitignore │ │ ├── .ruby-version │ │ ├── Gemfile │ │ ├── Gemfile.lock │ │ ├── README.md │ │ ├── Rakefile │ │ ├── app │ │ ├── assets │ │ │ ├── config │ │ │ │ └── manifest.js │ │ │ ├── javascripts │ │ │ │ └── discounts.js │ │ │ └── stylesheets │ │ │ │ ├── application.css │ │ │ │ └── discounts.scss │ │ ├── channels │ │ │ └── application_cable │ │ │ │ ├── channel.rb │ │ │ │ └── connection.rb │ │ ├── controllers │ │ │ ├── application_controller.rb │ │ │ ├── discounts_controller.rb │ │ │ └── spree │ │ │ │ ├── checkout_controller.rb │ │ │ │ ├── home_controller.rb │ │ │ │ └── products_controller.rb │ │ ├── helpers │ │ │ ├── application_helper.rb │ │ │ ├── discounts_helper.rb │ │ │ └── spree │ │ │ │ ├── frontend_helper.rb │ │ │ │ └── product_helper.rb │ │ ├── jobs │ │ │ └── application_job.rb │ │ ├── mailers │ │ │ └── application_mailer.rb │ │ ├── models │ │ │ └── application_record.rb │ │ └── views │ │ │ ├── discounts │ │ │ ├── add.html.erb │ │ │ └── get.html.erb │ │ │ ├── kaminari │ │ │ └── twitter-bootstrap-4 │ │ │ │ ├── _first_page.html.erb │ │ │ │ ├── _gap.html.erb │ │ │ │ ├── _last_page.html.erb │ │ │ │ ├── _next_page.html.erb │ │ │ │ ├── _page.html.erb │ │ │ │ ├── _paginator.html.erb │ │ │ │ └── _prev_page.html.erb │ │ │ ├── layouts │ │ │ ├── application.html.erb │ │ │ ├── mailer.html.erb │ │ │ └── mailer.text.erb │ │ │ └── spree │ │ │ ├── address │ │ │ └── _form.html.erb │ │ │ ├── addresses │ │ │ ├── _form.html.erb │ │ │ ├── destroy.js.erb │ │ │ ├── edit.html.erb │ │ │ └── new.html.erb │ │ │ ├── checkout │ │ │ ├── _address.html.erb │ │ │ ├── _confirm.html.erb │ │ │ ├── _delivery.html.erb │ │ │ ├── _payment.html.erb │ │ │ ├── _summary.html.erb │ │ │ ├── edit.html.erb │ │ │ └── payment │ │ │ │ ├── _check.html.erb │ │ │ │ ├── _gateway.html.erb │ │ │ │ └── _storecredit.html.erb │ │ │ ├── content │ │ │ ├── cvv.html.erb │ │ │ └── test.html.erb │ │ │ ├── home │ │ │ └── index.html.erb │ │ │ ├── layouts │ │ │ └── spree_application.html.erb │ │ │ ├── orders │ │ │ ├── _adjustment_row.html.erb │ │ │ ├── _adjustments.html.erb │ │ │ ├── _form.html.erb │ │ │ ├── _line_item.html.erb │ │ │ ├── edit.html.erb │ │ │ └── show.html.erb │ │ │ ├── products │ │ │ ├── _cart_form.html.erb │ │ │ ├── _product.html.erb │ │ │ ├── _promotions.html.erb │ │ │ ├── _properties.html.erb │ │ │ ├── _taxons.html.erb │ │ │ ├── _thumbnails.html.erb │ │ │ ├── index.html.erb │ │ │ └── show.html.erb │ │ │ ├── shared │ │ │ ├── _address.html.erb │ │ │ ├── _error_messages.html.erb │ │ │ ├── _filters.html.erb │ │ │ ├── _head.html.erb │ │ │ ├── _header.html.erb │ │ │ ├── _link_to_cart.html.erb │ │ │ ├── _login.html.erb │ │ │ ├── _login_bar.html.erb │ │ │ ├── _main_nav_bar.html.erb │ │ │ ├── _nav_bar.html.erb │ │ │ ├── _order_details.html.erb │ │ │ ├── _payment.html.erb │ │ │ ├── _products.html.erb │ │ │ ├── _search.html.erb │ │ │ ├── _shipment_tracking.html.erb │ │ │ ├── _sidebar.html.erb │ │ │ ├── _taxonomies.html.erb │ │ │ ├── _translations.html.erb │ │ │ ├── forbidden.html.erb │ │ │ └── unauthorized.html.erb │ │ │ └── taxons │ │ │ ├── _taxon.html.erb │ │ │ └── show.html.erb │ │ ├── bin │ │ ├── bundle │ │ ├── rails │ │ ├── rake │ │ ├── setup │ │ ├── update │ │ └── yarn │ │ ├── config.ru │ │ ├── config │ │ ├── application.rb │ │ ├── boot.rb │ │ ├── cable.yml │ │ ├── credentials.yml.enc │ │ ├── database.yml │ │ ├── environment.rb │ │ ├── environments │ │ │ ├── development.rb │ │ │ ├── production.rb │ │ │ └── test.rb │ │ ├── initializers │ │ │ ├── application_controller_renderer.rb │ │ │ ├── assets.rb │ │ │ ├── backtrace_silencers.rb │ │ │ ├── content_security_policy.rb │ │ │ ├── cookies_serializer.rb │ │ │ ├── devise.rb │ │ │ ├── filter_parameter_logging.rb │ │ │ ├── inflections.rb │ │ │ ├── mime_types.rb │ │ │ ├── spree.rb │ │ │ └── wrap_parameters.rb │ │ ├── locales │ │ │ └── en.yml │ │ ├── master.key │ │ ├── puma.rb │ │ ├── routes.rb │ │ └── storage.yml │ │ ├── db │ │ ├── development.sqlite3 │ │ ├── migrate │ │ │ ├── 20190904144904_create_active_storage_tables.active_storage.rb │ │ │ ├── 20190904144905_spree_one_two.spree.rb │ │ │ ├── 20190904144906_spree_promo_one_two.spree.rb │ │ │ ├── 20190904144907_add_tax_rate_label.spree.rb │ │ │ ├── 20190904144908_add_toggle_tax_rate_display.spree.rb │ │ │ ├── 20190904144909_remove_unused_preference_columns.spree.rb │ │ │ ├── 20190904144910_add_lock_version_to_variant.spree.rb │ │ │ ├── 20190904144911_add_states_required_to_countries.spree.rb │ │ │ ├── 20190904144912_add_on_demand_to_product_and_variant.spree.rb │ │ │ ├── 20190904144913_remove_not_null_constraint_from_products_on_hand.spree.rb │ │ │ ├── 20190904144914_split_prices_from_variants.spree.rb │ │ │ ├── 20190904144915_remove_not_null_from_spree_prices_amount.spree.rb │ │ │ ├── 20190904144916_add_currency_to_line_items.spree.rb │ │ │ ├── 20190904144917_add_currency_to_orders.spree.rb │ │ │ ├── 20190904144918_add_cost_currency_to_variants.spree.rb │ │ │ ├── 20190904144919_remove_display_on_from_payment_methods.spree.rb │ │ │ ├── 20190904144920_add_position_to_taxonomies.spree.rb │ │ │ ├── 20190904144921_add_last_ip_to_spree_orders.spree.rb │ │ │ ├── 20190904144922_add_state_to_spree_adjustments.spree.rb │ │ │ ├── 20190904144923_add_display_on_to_spree_payment_methods.spree.rb │ │ │ ├── 20190904144924_add_position_to_product_properties.spree.rb │ │ │ ├── 20190904144925_add_identifier_to_spree_payments.spree.rb │ │ │ ├── 20190904144926_add_order_id_index_to_payments.spree.rb │ │ │ ├── 20190904144927_add_primary_to_spree_products_taxons.spree.rb │ │ │ ├── 20190904144928_create_spree_stock_items.spree.rb │ │ │ ├── 20190904144929_create_spree_stock_locations.spree.rb │ │ │ ├── 20190904144930_create_default_stock.spree.rb │ │ │ ├── 20190904144931_add_order_id_index_to_shipments.spree.rb │ │ │ ├── 20190904144932_change_meta_description_on_spree_products_to_text.spree.rb │ │ │ ├── 20190904144933_add_stock_location_id_to_spree_shipments.spree.rb │ │ │ ├── 20190904144934_add_pending_to_inventory_unit.spree.rb │ │ │ ├── 20190904144935_remove_on_demand_from_product_and_variant.spree.rb │ │ │ ├── 20190904144936_create_shipping_method_zone.spree.rb │ │ │ ├── 20190904144937_remove_shipping_category_id_from_shipping_method.spree.rb │ │ │ ├── 20190904144938_create_shipping_method_categories.spree.rb │ │ │ ├── 20190904144939_add_tracking_url_to_spree_shipping_methods.spree.rb │ │ │ ├── 20190904144940_create_spree_shipping_rates.spree.rb │ │ │ ├── 20190904144941_remove_category_match_attributes_from_shipping_method.spree.rb │ │ │ ├── 20190904144942_create_stock_movements.spree.rb │ │ │ ├── 20190904144943_add_address_fields_to_stock_location.spree.rb │ │ │ ├── 20190904144944_add_active_field_to_stock_locations.spree.rb │ │ │ ├── 20190904144945_add_backorderable_to_stock_item.spree.rb │ │ │ ├── 20190904144946_add_default_quantity_to_stock_movement.spree.rb │ │ │ ├── 20190904144947_add_source_and_destination_to_stock_movements.spree.rb │ │ │ ├── 20190904144948_change_orders_total_precision.spree.rb │ │ │ ├── 20190904144949_change_spree_payments_amount_precision.spree.rb │ │ │ ├── 20190904144950_change_spree_return_authorization_amount_precision.spree.rb │ │ │ ├── 20190904144951_change_adjustments_amount_precision.spree.rb │ │ │ ├── 20190904144952_add_originator_to_stock_movement.spree.rb │ │ │ ├── 20190904144953_drop_source_and_destination_from_stock_movement.spree.rb │ │ │ ├── 20190904144954_migrate_inventory_unit_sold_to_on_hand.spree.rb │ │ │ ├── 20190904144955_add_stock_location_to_rma.spree.rb │ │ │ ├── 20190904144956_update_shipment_state_for_canceled_orders.spree.rb │ │ │ ├── 20190904144957_add_seo_metas_to_taxons.spree.rb │ │ │ ├── 20190904144958_remove_stock_item_and_variant_lock.spree.rb │ │ │ ├── 20190904144959_add_name_to_spree_credit_cards.spree.rb │ │ │ ├── 20190904144960_update_name_fields_on_spree_credit_cards.spree.rb │ │ │ ├── 20190904144961_add_index_to_source_columns_on_adjustments.spree.rb │ │ │ ├── 20190904144962_update_adjustment_states.spree.rb │ │ │ ├── 20190904144963_add_shipping_rates_to_shipments.spree.rb │ │ │ ├── 20190904144964_create_spree_stock_transfers.spree.rb │ │ │ ├── 20190904144965_drop_products_count_on_hand.spree.rb │ │ │ ├── 20190904144966_set_default_shipping_rate_cost.spree.rb │ │ │ ├── 20190904144967_add_number_to_stock_transfer.spree.rb │ │ │ ├── 20190904144968_add_sku_index_to_spree_variants.spree.rb │ │ │ ├── 20190904144969_add_backorderable_default_to_spree_stock_location.spree.rb │ │ │ ├── 20190904144970_add_propage_all_variants_to_spree_stock_location.spree.rb │ │ │ ├── 20190904144971_rename_shipping_methods_zones_to_spree_shipping_methods_zones.spree.rb │ │ │ ├── 20190904144972_add_user_id_index_to_spree_orders.spree.rb │ │ │ ├── 20190904144973_add_updated_at_to_spree_countries.spree.rb │ │ │ ├── 20190904144974_add_updated_at_to_spree_states.spree.rb │ │ │ ├── 20190904144975_add_cvv_result_code_and_cvv_result_message_to_spree_payments.spree.rb │ │ │ ├── 20190904144976_add_unique_index_to_permalink_on_spree_products.spree.rb │ │ │ ├── 20190904144977_add_unique_index_to_orders_shipments_and_stock_transfers.spree.rb │ │ │ ├── 20190904144978_add_deleted_at_to_spree_tax_rates.spree.rb │ │ │ ├── 20190904144979_remove_lock_version_from_inventory_units.spree.rb │ │ │ ├── 20190904144980_add_cost_price_to_line_item.spree.rb │ │ │ ├── 20190904144981_set_backorderable_to_default_to_false.spree.rb │ │ │ ├── 20190904144982_add_created_by_id_to_spree_orders.spree.rb │ │ │ ├── 20190904144983_index_completed_at_on_spree_orders.spree.rb │ │ │ ├── 20190904144984_add_tax_category_id_to_spree_line_items.spree.rb │ │ │ ├── 20190904144985_migrate_tax_categories_to_line_items.spree.rb │ │ │ ├── 20190904144986_drop_spree_mail_methods.spree.rb │ │ │ ├── 20190904144987_set_default_stock_location_on_shipments.spree.rb │ │ │ ├── 20190904144988_upgrade_adjustments.spree.rb │ │ │ ├── 20190904144989_rename_adjustment_fields.spree.rb │ │ │ ├── 20190904144990_add_admin_name_column_to_spree_shipping_methods.spree.rb │ │ │ ├── 20190904144991_add_admin_name_column_to_spree_stock_locations.spree.rb │ │ │ ├── 20190904144992_add_shipment_total_to_spree_orders.spree.rb │ │ │ ├── 20190904144993_expand_order_number_size.spree.rb │ │ │ ├── 20190904144994_rename_activators_to_promotions.spree.rb │ │ │ ├── 20190904144995_add_adjustment_total_to_line_items.spree.rb │ │ │ ├── 20190904144996_add_adjustment_total_to_shipments.spree.rb │ │ │ ├── 20190904144997_add_depth_to_spree_taxons.spree.rb │ │ │ ├── 20190904144998_add_tax_total_to_line_items_shipments_and_orders.spree.rb │ │ │ ├── 20190904144999_add_shipping_category_to_shipping_methods_and_products.spree.rb │ │ │ ├── 20190904145000_migrate_old_shipping_calculators.spree.rb │ │ │ ├── 20190904145001_add_code_to_spree_promotion_rules.spree.rb │ │ │ ├── 20190904145002_change_states_required_for_countries.spree.rb │ │ │ ├── 20190904145003_add_deleted_at_to_spree_stock_items.spree.rb │ │ │ ├── 20190904145004_remove_promotions_event_name_field.spree.rb │ │ │ ├── 20190904145005_add_promo_total_to_line_items_and_shipments_and_orders.spree.rb │ │ │ ├── 20190904145006_remove_unused_credit_card_fields.spree.rb │ │ │ ├── 20190904145007_add_track_inventory_to_variant.spree.rb │ │ │ ├── 20190904145008_add_tax_category_to_variants.spree.rb │ │ │ ├── 20190904145009_add_channel_to_spree_orders.spree.rb │ │ │ ├── 20190904145010_add_included_to_adjustments.spree.rb │ │ │ ├── 20190904145011_rename_tax_total_fields.spree.rb │ │ │ ├── 20190904145012_add_line_item_id_to_spree_inventory_units.spree.rb │ │ │ ├── 20190904145013_add_updated_at_to_variants.spree.rb │ │ │ ├── 20190904145014_add_position_to_classifications.spree.rb │ │ │ ├── 20190904145015_create_spree_orders_promotions.spree.rb │ │ │ ├── 20190904145016_unique_shipping_method_categories.spree.rb │ │ │ ├── 20190904145017_add_item_count_to_spree_orders.spree.rb │ │ │ ├── 20190904145018_remove_value_type_from_spree_preferences.spree.rb │ │ │ ├── 20190904145019_rename_permalink_to_slug_for_products.spree.rb │ │ │ ├── 20190904145020_add_index_to_variant_id_and_currency_on_prices.spree.rb │ │ │ ├── 20190904145021_rename_activator_id_in_rules_and_actions_to_promotion_id.spree.rb │ │ │ ├── 20190904145022_add_deleted_at_to_spree_prices.spree.rb │ │ │ ├── 20190904145023_add_approver_id_and_approved_at_to_orders.spree.rb │ │ │ ├── 20190904145024_add_confirmation_delivered_to_spree_orders.spree.rb │ │ │ ├── 20190904145025_add_auto_capture_to_payment_methods.spree.rb │ │ │ ├── 20190904145026_create_spree_payment_capture_events.spree.rb │ │ │ ├── 20190904145027_add_uncaptured_amount_to_payments.spree.rb │ │ │ ├── 20190904145028_default_variant_weight_to_zero.spree.rb │ │ │ ├── 20190904145029_add_tax_category_id_to_shipping_methods.spree.rb │ │ │ ├── 20190904145030_add_tax_rate_id_to_shipping_rates.spree.rb │ │ │ ├── 20190904145031_add_pre_tax_amount_to_line_items_and_shipments.spree.rb │ │ │ ├── 20190904145032_add_more_indexes.spree.rb │ │ │ ├── 20190904145033_add_considered_risky_to_orders.spree.rb │ │ │ ├── 20190904145034_add_preference_store_to_everything.spree.rb │ │ │ ├── 20190904145035_add_user_id_to_spree_credit_cards.spree.rb │ │ │ ├── 20190904145036_migrate_old_preferences.spree.rb │ │ │ ├── 20190904145037_create_spree_stores.spree.rb │ │ │ ├── 20190904145038_create_store_from_preferences.spree.rb │ │ │ ├── 20190904145039_add_timestamps_to_spree_assets.spree.rb │ │ │ ├── 20190904145040_create_spree_taxons_promotion_rules.spree.rb │ │ │ ├── 20190904145041_add_additional_store_fields.spree.rb │ │ │ ├── 20190904145042_add_many_missing_indexes.spree.rb │ │ │ ├── 20190904145043_correct_some_polymorphic_index_and_add_more_missing.spree.rb │ │ │ ├── 20190904145044_add_user_id_created_by_id_index_to_order.spree.rb │ │ │ ├── 20190904145045_change_spree_price_amount_precision.spree.rb │ │ │ ├── 20190904145046_add_token_to_spree_orders.spree.rb │ │ │ ├── 20190904145047_move_order_token_from_tokenized_permission.spree.rb │ │ │ ├── 20190904145048_set_shipment_total_for_users_upgrading.spree.rb │ │ │ ├── 20190904145049_drop_credit_card_first_name_and_last_name.spree.rb │ │ │ ├── 20190904145050_add_deleted_at_to_spree_promotion_actions.spree.rb │ │ │ ├── 20190904145051_remove_uncaptured_amount_from_spree_payments.spree.rb │ │ │ ├── 20190904145052_create_spree_refunds.spree.rb │ │ │ ├── 20190904145053_create_spree_return_authorization_inventory_unit.spree.rb │ │ │ ├── 20190904145054_rename_return_authorization_inventory_unit_to_return_items.spree.rb │ │ │ ├── 20190904145055_backfill_line_item_pre_tax_amount.spree.rb │ │ │ ├── 20190904145056_recreate_spree_return_authorizations.spree.rb │ │ │ ├── 20190904145057_add_amount_fields_to_return_items.spree.rb │ │ │ ├── 20190904145058_drop_return_authorization_amount.spree.rb │ │ │ ├── 20190904145059_create_spree_return_authorization_reasons.spree.rb │ │ │ ├── 20190904145060_create_spree_refund_reasons.spree.rb │ │ │ ├── 20190904145061_rename_return_authorization_reason.spree.rb │ │ │ ├── 20190904145062_create_spree_promotion_categories.spree.rb │ │ │ ├── 20190904145063_drop_received_at_on_return_items.spree.rb │ │ │ ├── 20190904145064_add_reception_and_acceptance_status_to_return_items.spree.rb │ │ │ ├── 20190904145065_create_default_refund_reason.spree.rb │ │ │ ├── 20190904145066_add_default_to_spree_stock_locations.spree.rb │ │ │ ├── 20190904145067_create_spree_customer_returns.spree.rb │ │ │ ├── 20190904145068_add_customer_return_id_to_return_item.spree.rb │ │ │ ├── 20190904145069_create_friendly_id_slugs.spree.rb │ │ │ ├── 20190904145070_rename_spree_refund_return_authorization_id.spree.rb │ │ │ ├── 20190904145071_increase_return_item_pre_tax_amount_precision.spree.rb │ │ │ ├── 20190904145072_copy_product_slugs_to_slug_history.spree.rb │ │ │ ├── 20190904145073_create_spree_reimbursements.spree.rb │ │ │ ├── 20190904145074_add_promotionable_to_spree_products.spree.rb │ │ │ ├── 20190904145075_add_exchange_inventory_unit_foreign_keys.spree.rb │ │ │ ├── 20190904145076_add_acceptance_status_errors_to_return_item.spree.rb │ │ │ ├── 20190904145077_create_spree_reimbursement_types.spree.rb │ │ │ ├── 20190904145078_add_default_to_shipment_cost.spree.rb │ │ │ ├── 20190904145079_add_default_to_spree_credit_cards.spree.rb │ │ │ ├── 20190904145080_make_existing_credit_cards_default.spree.rb │ │ │ ├── 20190904145081_add_type_to_reimbursement_type.spree.rb │ │ │ ├── 20190904145082_create_spree_reimbursement_credits.spree.rb │ │ │ ├── 20190904145083_add_meta_title_to_spree_products.spree.rb │ │ │ ├── 20190904145084_add_kind_to_zone.spree.rb │ │ │ ├── 20190904145085_add_code_to_spree_tax_categories.spree.rb │ │ │ ├── 20190904145086_default_pre_tax_amount_should_be_zero.spree.rb │ │ │ ├── 20190904145087_add_code_to_spree_shipping_methods.spree.rb │ │ │ ├── 20190904145088_add_cancel_audit_fields_to_spree_orders.spree.rb │ │ │ ├── 20190904145089_add_store_id_to_orders.spree.rb │ │ │ ├── 20190904145090_create_spree_taxons_prototypes.spree.rb │ │ │ ├── 20190904145091_add_state_lock_version_to_order.spree.rb │ │ │ ├── 20190904145092_add_counter_cache_from_spree_variants_to_spree_stock_items.spree.rb │ │ │ ├── 20190904145093_fix_adjustment_order_presence.spree.rb │ │ │ ├── 20190904145094_update_classifications_positions.spree.rb │ │ │ ├── 20190904145095_add_guest_token_index_to_spree_orders.spree.rb │ │ │ ├── 20190904145096_remove_token_permissions_table.spree.rb │ │ │ ├── 20190904145097_remove_extra_products_slug_index.spree.rb │ │ │ ├── 20190904145098_update_product_slug_index.spree.rb │ │ │ ├── 20190904145099_rename_identifier_to_number_for_payment.spree.rb │ │ │ ├── 20190904145100_create_spree_store_credits.spree.rb │ │ │ ├── 20190904145101_create_spree_store_credit_categories.spree.rb │ │ │ ├── 20190904145102_create_spree_store_credit_events.spree.rb │ │ │ ├── 20190904145103_create_spree_store_credit_types.spree.rb │ │ │ ├── 20190904145104_remove_environment_from_payment_method.spree.rb │ │ │ ├── 20190904145105_add_resellable_to_return_items.spree.rb │ │ │ ├── 20190904145106_add_code_to_spree_promotion_categories.spree.rb │ │ │ ├── 20190904145107_remove_environment_from_tracker.spree.rb │ │ │ ├── 20190904145108_remove_spree_configurations.spree.rb │ │ │ ├── 20190904145109_add_index_to_spree_stock_items_variant_id.spree.rb │ │ │ ├── 20190904145110_ensure_payments_have_numbers.spree.rb │ │ │ ├── 20190904145111_add_missing_indexes_on_spree_tables.spree.rb │ │ │ ├── 20190904145112_remove_duplicated_indexes_from_multi_columns.spree.rb │ │ │ ├── 20190904145113_remove_user_index_from_spree_state_changes.spree.rb │ │ │ ├── 20190904145114_fix_adjustment_order_id.spree.rb │ │ │ ├── 20190904145115_add_position_to_spree_payment_methods.spree.rb │ │ │ ├── 20190904145116_add_deleted_at_to_friendly_id_slugs.spree.rb │ │ │ ├── 20190904145117_increase_scale_on_pre_tax_amounts.spree.rb │ │ │ ├── 20190904145118_add_taxable_adjustment_total_to_line_item.spree.rb │ │ │ ├── 20190904145119_migrate_payment_methods_display.spree.rb │ │ │ ├── 20190904145120_enable_acts_as_paranoid_on_calculators.spree.rb │ │ │ ├── 20190904145121_spree_payment_method_store_credits.spree.rb │ │ │ ├── 20190904145122_rename_has_and_belongs_to_associations_to_model_names.spree.rb │ │ │ ├── 20190904145123_spree_store_credit_types.spree.rb │ │ │ ├── 20190904145124_add_discontinued_to_products_and_variants.spree.rb │ │ │ ├── 20190904145125_remove_shipping_method_id_from_spree_orders.spree.rb │ │ │ ├── 20190904145126_add_id_column_to_earlier_habtm_tables.spree.rb │ │ │ ├── 20190904145127_add_indexes.spree.rb │ │ │ ├── 20190904145128_remove_counter_cache_from_spree_variants_to_spree_stock_items.spree.rb │ │ │ ├── 20190904145129_acts_as_taggable_on_spree_migration.spree.rb │ │ │ ├── 20190904145130_change_collation_for_spree_tag_names.spree.rb │ │ │ ├── 20190904145131_add_missing_indexes_to_spree_taggings.spree.rb │ │ │ ├── 20190904145132_add_zipcode_required_to_spree_countries.spree.rb │ │ │ ├── 20190904145133_add_created_at_to_variant.spree.rb │ │ │ ├── 20190904145134_add_null_false_to_spree_variants_timestamps.spree.rb │ │ │ ├── 20190904145135_add_quantity_to_inventory_units.spree.rb │ │ │ ├── 20190904145136_add_original_return_item_id_to_spree_inventory_units.spree.rb │ │ │ ├── 20190904145137_add_unique_index_on_number_to_spree_orders.spree.rb │ │ │ ├── 20190904145138_add_unique_index_on_number_to_spree_stock_transfer.spree.rb │ │ │ ├── 20190904145139_add_unique_index_on_number_to_spree_shipment.spree.rb │ │ │ ├── 20190904145140_add_unique_index_on_number_to_spree_payments.spree.rb │ │ │ ├── 20190904145141_add_unique_index_on_number_to_spree_return_authorizations.spree.rb │ │ │ ├── 20190904145142_add_unique_index_on_number_to_spree_customer_returns.spree.rb │ │ │ ├── 20190904145143_add_unique_index_on_number_to_spree_reimbursements.spree.rb │ │ │ ├── 20190904145144_add_missing_unique_indexes_for_unique_attributes.spree.rb │ │ │ ├── 20190904145145_add_index_on_stock_location_to_spree_customer_returns.spree.rb │ │ │ ├── 20190904145146_add_index_on_prototype_to_spree_option_type_prototype.spree.rb │ │ │ ├── 20190904145147_add_indexes_to_spree_option_value_variant.spree.rb │ │ │ ├── 20190904145148_add_index_on_promotion_id_to_order_promotions.spree.rb │ │ │ ├── 20190904145149_add_indexes_for_property_prototype.spree.rb │ │ │ ├── 20190904145150_add_index_for_prototype_id_to_prototype_taxons.spree.rb │ │ │ ├── 20190904145151_add_indexes_to_refunds.spree.rb │ │ │ ├── 20190904145152_add_indexes_to_reimbursement_credits.spree.rb │ │ │ ├── 20190904145153_add_indexes_to_return_authorizations.spree.rb │ │ │ ├── 20190904145154_add_indexes_to_return_items.spree.rb │ │ │ ├── 20190904145155_add_index_to_role_users.spree.rb │ │ │ ├── 20190904145156_add_index_to_shipping_method_categories.spree.rb │ │ │ ├── 20190904145157_add_index_to_shipping_method_zones.spree.rb │ │ │ ├── 20190904145158_add_index_to_spree_shipping_rates.spree.rb │ │ │ ├── 20190904145159_add_index_to_spree_stock_items.spree.rb │ │ │ ├── 20190904145160_add_index_to_spree_stock_movement.spree.rb │ │ │ ├── 20190904145161_change_indexes_on_friendly_id_slugs.spree.rb │ │ │ ├── 20190904145162_add_analytics_kind_to_spree_trackers.spree.rb │ │ │ ├── 20190904145163_rename_tracker_kind_field.spree.rb │ │ │ ├── 20190904145164_remove_icon_from_taxons.spree.rb │ │ │ ├── 20190904145165_add_unique_index_on_spree_promotions_code.spree.rb │ │ │ ├── 20190904145166_rename_guest_token_to_token_in_orders.spree.rb │ │ │ ├── 20190904145167_add_timestamps_to_spree_prices.spree.rb │ │ │ ├── 20190904145168_add_deleted_at_to_spree_credit_cards.spree.rb │ │ │ ├── 20190904145169_add_iso_and_iso3_validation_on_presence_and_uniqueness.spree.rb │ │ │ ├── 20190904145170_add_user_id_and_deleted_at_to_spree_addresses.spree.rb │ │ │ ├── 20190904145171_add_api_key_to_spree_users.spree_api.rb │ │ │ ├── 20190904145172_resize_api_key_field.spree_api.rb │ │ │ ├── 20190904145173_rename_api_key_to_spree_api_key.spree_api.rb │ │ │ ├── 20190904145174_add_index_to_user_spree_api_key.spree_api.rb │ │ │ ├── 20190904145175_create_doorkeeper_tables.spree_api.rb │ │ │ ├── 20190904145176_create_users.spree_auth.rb │ │ │ ├── 20190904145177_rename_columns_for_devise.spree_auth.rb │ │ │ ├── 20190904145178_convert_user_remember_field.spree_auth.rb │ │ │ ├── 20190904145179_add_reset_password_sent_at_to_spree_users.spree_auth.rb │ │ │ ├── 20190904145180_make_users_email_index_unique.spree_auth.rb │ │ │ ├── 20190904145181_add_deleted_at_to_users.spree_auth.rb │ │ │ ├── 20190904145182_add_confirmable_to_users.spree_auth.rb │ │ │ ├── 20190904145183_add_missing_indices_on_user.spree_auth.rb │ │ │ ├── 20190904145184_update_braintree_payment_method_type.spree_gateway.rb │ │ │ ├── 20190904145185_update_stripe_payment_method_type.spree_gateway.rb │ │ │ ├── 20190904145186_update_balanced_payment_method_type.spree_gateway.rb │ │ │ ├── 20190904145187_update_paypal_payment_method_type.spree_gateway.rb │ │ │ └── 20190904145188_migrate_stripe_preferences.spree_gateway.rb │ │ ├── schema.rb │ │ ├── seeds.rb │ │ └── test.sqlite3 │ │ ├── docker-entrypoint.sh │ │ ├── license.md │ │ ├── package.json │ │ ├── public │ │ ├── 404.html │ │ ├── 422.html │ │ ├── 500.html │ │ ├── apple-touch-icon-precomposed.png │ │ ├── apple-touch-icon.png │ │ ├── favicon.ico │ │ └── robots.txt │ │ ├── test │ │ └── controllers │ │ │ └── discounts_controller_test.rb │ │ └── vendor │ │ └── assets │ │ ├── javascripts │ │ └── spree │ │ │ ├── backend │ │ │ └── all.js │ │ │ └── frontend │ │ │ └── all.js │ │ └── stylesheets │ │ └── spree │ │ ├── backend │ │ └── all.css │ │ └── frontend │ │ └── all.css └── storefront-versions │ ├── store-frontend-broken-instrumented │ ├── .dockerignore │ ├── .gitignore │ ├── Dockerfile │ └── build.sh │ ├── store-frontend-broken-no-instrumentation │ ├── .dockerignore │ ├── .gitignore │ ├── Dockerfile │ └── build.sh │ └── store-frontend-instrumented-fixed │ ├── .dockerignore │ ├── .gitignore │ ├── Dockerfile │ └── build.sh ├── storedog.synthetics.json └── traffic-replay ├── Dockerfile ├── build.sh └── requests_0.gor /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | .bundle 3 | .dotest 4 | .idea 5 | .loadpath 6 | .project 7 | .vscode 8 | sandbox/tmp/ 9 | __pycache__ 10 | 11 | # Terraform 12 | *.tfstate 13 | *.tfstate.backup 14 | *.tfstate.lock.info 15 | .terraform/ 16 | kube_config_server.yaml 17 | 18 | # HELM 19 | helm-values.yaml 20 | 21 | # Frontend version 22 | store-frontend/src/store-frontend-instrumented-fixed 23 | store-frontend/src/store-frontend-broken-instrumented 24 | 25 | # Vim swp files 26 | *.swp 27 | 28 | -------------------------------------------------------------------------------- /LICENSE-3rdparty.csv: -------------------------------------------------------------------------------- 1 | Component,Origin,License,Copyright 2 | Spree,https://github.com/spree/spree,Spree License,Copyright © 2007-2019 Spree Commerce Inc. and other contributors. 3 | Flask,https://github.com/pallets/flask/,BSD-3-Clause,Copyright 2010 Pallets 4 | Jinja,https://github.com/pallets/jinja,BSD-3-Clause,Copyright 2010 Pallets 5 | Requests,https://github.com/psf/requests,Apache-2.0,2004 6 | SQLAlchemy,https://github.com/sqlalchemy/sqlalchemy/,MIT,Copyright 2005-2020 SQLAlchemy authors and contributors -------------------------------------------------------------------------------- /ads-service-errors/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ddtraining/advertisements-fixed:1.0.0 2 | 3 | WORKDIR /app 4 | COPY advertisements.patch . 5 | RUN patch ads.py advertisements.patch 6 | -------------------------------------------------------------------------------- /ads-service-errors/README.md: -------------------------------------------------------------------------------- 1 | This service will introduce 500 errors when the app attempts to hit the `/ads` endpoint. -------------------------------------------------------------------------------- /ads-service-errors/advertisements.patch: -------------------------------------------------------------------------------- 1 | diff -r ads-service-fixed/ads.py ads-service-errors/ads.py 2 | 31d30 3 | < advertisements = Advertisement.query.all() 4 | 41d39 5 | < advertisements = Advertisement.query.all() 6 | 55d52 7 | < advertisements_count = len(Advertisement.query.all()) 8 | 62c59 9 | < advertisements = Advertisement.query.all() 10 | --- 11 | > 12 | -------------------------------------------------------------------------------- /ads-service-fixed/.dockerignore: -------------------------------------------------------------------------------- 1 | # Version control 2 | .git 3 | 4 | # Compiled Python bytecode 5 | **/__pycache__ 6 | **/*.pyc 7 | **/*.pyo 8 | 9 | # Compiled extensions 10 | **/*.pyd 11 | **/*.so 12 | 13 | # coverage.py 14 | .coverage 15 | .coverage.* 16 | htmlcov 17 | 18 | # Cached files 19 | .cache 20 | .mypy_cache 21 | .hypothesis 22 | .pytest_cache 23 | 24 | # Virtualenvs and builds 25 | build/ 26 | dist/ 27 | .env 28 | .venv 29 | env/ 30 | venv/ 31 | ENV/ 32 | env.bak/ 33 | venv.bak/ 34 | 35 | # Docker 36 | Dockerfile* 37 | .dockerignore 38 | -------------------------------------------------------------------------------- /ads-service-fixed/ads/1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DataDog/ecommerce-workshop/aaa8069566b6c86ed5407ec830bf64713067fcd5/ads-service-fixed/ads/1.jpg -------------------------------------------------------------------------------- /ads-service-fixed/ads/2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DataDog/ecommerce-workshop/aaa8069566b6c86ed5407ec830bf64713067fcd5/ads-service-fixed/ads/2.jpg -------------------------------------------------------------------------------- /ads-service-fixed/ads/3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DataDog/ecommerce-workshop/aaa8069566b6c86ed5407ec830bf64713067fcd5/ads-service-fixed/ads/3.jpg -------------------------------------------------------------------------------- /ads-service-fixed/build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Set bash strict mode so we insta-fail on any errors 3 | # -e: Exit immediately if a command has non-zero exit code, i.e. fails somehow. 4 | # Otherwise bash is like a Python program that just swallows exceptions. 5 | # -u: Exit with error message if code uses an undefined environment variable, 6 | # instead of silently continuing with an empty string. 7 | # -o pipefail: Like -e, except for piped commands. 8 | set -euo pipefail 9 | 10 | # Enable Docker Buildkit 11 | export DOCKER_BUILDKIT=1 12 | 13 | # Build and tag image 14 | docker image build --progress=plain --tag ddtraining/advertisements-fixed:latest . 15 | -------------------------------------------------------------------------------- /ads-service-fixed/requirements.txt: -------------------------------------------------------------------------------- 1 | certifi==2020.11.8 2 | chardet==3.0.4 3 | click==7.1.2 4 | ddtrace==0.57.3 5 | Flask==1.1.2 6 | Flask-Cors==3.0.10 7 | Flask-SQLAlchemy==2.4.4 8 | idna==2.10 9 | intervaltree==3.1.0 10 | itsdangerous==1.1.0 11 | Jinja2==2.11.3 12 | MarkupSafe==1.1.1 13 | nose==1.3.7 14 | protobuf==3.14.0 15 | psycopg2==2.8.6 16 | requests==2.25.1 17 | six==1.15.0 18 | sortedcontainers==2.3.0 19 | SQLAlchemy==1.3.23 20 | tenacity==6.2.0 21 | urllib3==1.26.5 22 | Werkzeug==1.0.1 -------------------------------------------------------------------------------- /ads-service-versions/common/ads/1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DataDog/ecommerce-workshop/aaa8069566b6c86ed5407ec830bf64713067fcd5/ads-service-versions/common/ads/1.png -------------------------------------------------------------------------------- /ads-service-versions/common/ads/10.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DataDog/ecommerce-workshop/aaa8069566b6c86ed5407ec830bf64713067fcd5/ads-service-versions/common/ads/10.png -------------------------------------------------------------------------------- /ads-service-versions/common/ads/11.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DataDog/ecommerce-workshop/aaa8069566b6c86ed5407ec830bf64713067fcd5/ads-service-versions/common/ads/11.png -------------------------------------------------------------------------------- /ads-service-versions/common/ads/2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DataDog/ecommerce-workshop/aaa8069566b6c86ed5407ec830bf64713067fcd5/ads-service-versions/common/ads/2.png -------------------------------------------------------------------------------- /ads-service-versions/common/ads/3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DataDog/ecommerce-workshop/aaa8069566b6c86ed5407ec830bf64713067fcd5/ads-service-versions/common/ads/3.png -------------------------------------------------------------------------------- /ads-service-versions/common/ads/4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DataDog/ecommerce-workshop/aaa8069566b6c86ed5407ec830bf64713067fcd5/ads-service-versions/common/ads/4.png -------------------------------------------------------------------------------- /ads-service-versions/common/ads/5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DataDog/ecommerce-workshop/aaa8069566b6c86ed5407ec830bf64713067fcd5/ads-service-versions/common/ads/5.png -------------------------------------------------------------------------------- /ads-service-versions/common/ads/6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DataDog/ecommerce-workshop/aaa8069566b6c86ed5407ec830bf64713067fcd5/ads-service-versions/common/ads/6.png -------------------------------------------------------------------------------- /ads-service-versions/common/ads/7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DataDog/ecommerce-workshop/aaa8069566b6c86ed5407ec830bf64713067fcd5/ads-service-versions/common/ads/7.png -------------------------------------------------------------------------------- /ads-service-versions/common/ads/8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DataDog/ecommerce-workshop/aaa8069566b6c86ed5407ec830bf64713067fcd5/ads-service-versions/common/ads/8.png -------------------------------------------------------------------------------- /ads-service-versions/common/ads/9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DataDog/ecommerce-workshop/aaa8069566b6c86ed5407ec830bf64713067fcd5/ads-service-versions/common/ads/9.png -------------------------------------------------------------------------------- /ads-service-versions/common/requirements.txt: -------------------------------------------------------------------------------- 1 | certifi==2020.11.8 2 | chardet==3.0.4 3 | click==7.1.2 4 | ddtrace==0.57.3 5 | Flask==1.1.2 6 | Flask-Cors==3.0.10 7 | Flask-SQLAlchemy==2.4.4 8 | idna==2.10 9 | intervaltree==3.1.0 10 | itsdangerous==1.1.0 11 | Jinja2==2.11.3 12 | MarkupSafe==1.1.1 13 | nose==1.3.7 14 | protobuf==3.14.0 15 | psycopg2==2.8.6 16 | requests==2.25.1 17 | six==1.15.0 18 | sortedcontainers==2.3.0 19 | SQLAlchemy==1.3.23 20 | tenacity==6.2.0 21 | urllib3==1.26.5 22 | Werkzeug==1.0.1 -------------------------------------------------------------------------------- /ads-service/.dockerignore: -------------------------------------------------------------------------------- 1 | # Version control 2 | .git 3 | 4 | # Compiled Python bytecode 5 | **/__pycache__ 6 | **/*.pyc 7 | **/*.pyo 8 | 9 | # Compiled extensions 10 | **/*.pyd 11 | **/*.so 12 | 13 | # coverage.py 14 | .coverage 15 | .coverage.* 16 | htmlcov 17 | 18 | # Cached files 19 | .cache 20 | .mypy_cache 21 | .hypothesis 22 | .pytest_cache 23 | 24 | # Virtualenvs and builds 25 | build/ 26 | dist/ 27 | .env 28 | .venv 29 | env/ 30 | venv/ 31 | ENV/ 32 | env.bak/ 33 | venv.bak/ 34 | 35 | # Docker 36 | Dockerfile* 37 | .dockerignore 38 | -------------------------------------------------------------------------------- /ads-service/ads/1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DataDog/ecommerce-workshop/aaa8069566b6c86ed5407ec830bf64713067fcd5/ads-service/ads/1.jpg -------------------------------------------------------------------------------- /ads-service/ads/2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DataDog/ecommerce-workshop/aaa8069566b6c86ed5407ec830bf64713067fcd5/ads-service/ads/2.jpg -------------------------------------------------------------------------------- /ads-service/ads/3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DataDog/ecommerce-workshop/aaa8069566b6c86ed5407ec830bf64713067fcd5/ads-service/ads/3.jpg -------------------------------------------------------------------------------- /ads-service/build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Set bash strict mode so we insta-fail on any errors 3 | # -e: Exit immediately if a command has non-zero exit code, i.e. fails somehow. 4 | # Otherwise bash is like a Python program that just swallows exceptions. 5 | # -u: Exit with error message if code uses an undefined environment variable, 6 | # instead of silently continuing with an empty string. 7 | # -o pipefail: Like -e, except for piped commands. 8 | set -euo pipefail 9 | 10 | # Enable Docker Buildkit 11 | export DOCKER_BUILDKIT=1 12 | 13 | # Build and tag image 14 | docker image build --progress=plain --tag ddtraining/advertisements:latest . 15 | -------------------------------------------------------------------------------- /ads-service/requirements.txt: -------------------------------------------------------------------------------- 1 | certifi==2020.11.8 2 | chardet==3.0.4 3 | click==7.1.2 4 | ddtrace==0.57.3 5 | Flask==1.1.2 6 | Flask-Cors==3.0.10 7 | Flask-SQLAlchemy==2.4.4 8 | idna==2.10 9 | intervaltree==3.1.0 10 | itsdangerous==1.1.0 11 | Jinja2==2.11.3 12 | MarkupSafe==1.1.1 13 | nose==1.3.7 14 | protobuf==3.14.0 15 | psycopg2==2.8.6 16 | requests==2.25.1 17 | six==1.15.0 18 | sortedcontainers==2.3.0 19 | SQLAlchemy==1.3.23 20 | tenacity==6.2.0 21 | urllib3==1.26.5 22 | Werkzeug==1.0.1 -------------------------------------------------------------------------------- /attackbox/.dockerignore: -------------------------------------------------------------------------------- 1 | Dockerfile* 2 | .dockerignore -------------------------------------------------------------------------------- /attackbox/keys/README.md: -------------------------------------------------------------------------------- 1 | ### Attention 2 | 3 | These keys are used for training purposes and were **intentionally** added to this repository. These keys are self-contained within the docker images used by `deploy/docker-compose-fixed-instrumented-attack.yml`. They do not reside in any other external server. Please do not flag for security purposes and/or a bug bounty program. -------------------------------------------------------------------------------- /attackbox/keys/attacker-key.pub: -------------------------------------------------------------------------------- 1 | ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDT/u93T4U6ALDVKIF5t5n8FZ8FgaJ/rww3Yf+HBkfHI7LcA9McomQOzv2T0665EWosmmluT+JpwEnXNoZpJg4sdJSF2PFqlgrZl9mbyhsoxl3wVTUvFZb5yyw2nZdSbRx3OtmzBnOkPr25+btpx1wN6Tlvw3Yoc3Ewx4GVX1dkg3xRtVj42d6oeYWY9D3Y6+KmUBPcns2stU4cUzJy4RLtsW6Kvbwg0A9iPO06fhFZxHtmvl58m/rUzomeyUYSvHeGJyBO1fX/IFDNH27mky2Vsoc8Y6HA3m3fqPcvIrRYXc8q4T63ho4wVlTlENyZhz8c4x631fPqvR1iPvRGuDiTf8rzYQh0eayeitepS8RFAts7Q8o+6EswA7u33l5mJoCp2bw1Pr5/TIPszB0tg1tFzmDuejD4EXYTINFwlkiUP9PEtPAtHJtQe1dI9mTK3wW8t6XO1nBODTSeK292a6chMNwn7Hi9N3KWooYyxZZYRZZKat7ISfH02rfeiT6pchE= colin.cole@COMP-C02CD0UULVDN 2 | -------------------------------------------------------------------------------- /deploy/aws/ecs/README.md: -------------------------------------------------------------------------------- 1 | # AWS Deployment for ECS on EC2 2 | 3 | These are tasks meant to be run in ECS on EC2. You'll need to customize with your appropriate environment variables. 4 | 5 | Check in the JSON files for more info. -------------------------------------------------------------------------------- /deploy/azure/aks/screenshots/aks_datadog.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DataDog/ecommerce-workshop/aaa8069566b6c86ed5407ec830bf64713067fcd5/deploy/azure/aks/screenshots/aks_datadog.png -------------------------------------------------------------------------------- /deploy/azure/aks/screenshots/aks_in_event_stream.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DataDog/ecommerce-workshop/aaa8069566b6c86ed5407ec830bf64713067fcd5/deploy/azure/aks/screenshots/aks_in_event_stream.png -------------------------------------------------------------------------------- /deploy/azure/aks/screenshots/azure_datadog.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DataDog/ecommerce-workshop/aaa8069566b6c86ed5407ec830bf64713067fcd5/deploy/azure/aks/screenshots/azure_datadog.png -------------------------------------------------------------------------------- /deploy/azure/aks/screenshots/install_k8s_integration.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DataDog/ecommerce-workshop/aaa8069566b6c86ed5407ec830bf64713067fcd5/deploy/azure/aks/screenshots/install_k8s_integration.png -------------------------------------------------------------------------------- /deploy/azure/aks/screenshots/storedog.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DataDog/ecommerce-workshop/aaa8069566b6c86ed5407ec830bf64713067fcd5/deploy/azure/aks/screenshots/storedog.png -------------------------------------------------------------------------------- /deploy/azure/aks/screenshots/storedog_ip.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DataDog/ecommerce-workshop/aaa8069566b6c86ed5407ec830bf64713067fcd5/deploy/azure/aks/screenshots/storedog_ip.png -------------------------------------------------------------------------------- /deploy/docker-compose/.env: -------------------------------------------------------------------------------- 1 | ADS_PORT=7676 2 | DISCOUNTS_PORT=2814 3 | ADS_ROUTE="http://advertisements" 4 | DISCOUNTS_ROUTE="http://discounts" -------------------------------------------------------------------------------- /deploy/docker-compose/docker-compose-traffic-replay.yml: -------------------------------------------------------------------------------- 1 | version: '3' 2 | services: 3 | traffic-replay: 4 | image: "ddtraining/traffic-replay:latest" 5 | environment: 6 | - FRONTEND_HOST 7 | - FRONTEND_PORT 8 | 9 | -------------------------------------------------------------------------------- /deploy/gcp/vms/main.tf: -------------------------------------------------------------------------------- 1 | terraform { 2 | required_version = "~>0.12" 3 | } 4 | 5 | provider "google" { 6 | version = "~> 3.18" 7 | zone = var.zone 8 | } -------------------------------------------------------------------------------- /deploy/gcp/vms/network.tf: -------------------------------------------------------------------------------- 1 | resource "google_compute_firewall" "ecommerce" { 2 | count = var.enable_firewall_rule ? 1 : 0 3 | name = "allow-ecommerce" 4 | network = var.network_name 5 | 6 | allow { 7 | protocol = "tcp" 8 | ports = ["3000"] 9 | } 10 | } 11 | 12 | resource "google_compute_address" "ecommerce" { 13 | name = var.name 14 | } -------------------------------------------------------------------------------- /deploy/gcp/vms/outputs.tf: -------------------------------------------------------------------------------- 1 | output "public_ip" { 2 | value = google_compute_instance.ecommerce.network_interface.0.access_config.0.nat_ip 3 | } -------------------------------------------------------------------------------- /deploy/generic-k8s/cluster-agent/datadog-cluster-agent_service.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Service 3 | metadata: 4 | name: datadog-cluster-agent 5 | labels: 6 | app: datadog-cluster-agent 7 | spec: 8 | ports: 9 | - port: 5005 # Has to be the same as the one exposed in the DCA. Default is 5005. 10 | protocol: TCP 11 | selector: 12 | app: datadog-cluster-agent 13 | -------------------------------------------------------------------------------- /deploy/generic-k8s/cluster-agent/datadog-custom-metric-server.yaml: -------------------------------------------------------------------------------- 1 | kind: Service 2 | apiVersion: v1 3 | metadata: 4 | name: datadog-custom-metrics-server 5 | spec: 6 | selector: 7 | app: datadog-cluster-agent 8 | ports: 9 | - protocol: TCP 10 | port: 443 11 | targetPort: 443 12 | -------------------------------------------------------------------------------- /deploy/generic-k8s/cluster-agent/secret-app-key.yaml: -------------------------------------------------------------------------------- 1 | # Secret to use Datadog Cluster Agent as External Metrics Server (optional) 2 | apiVersion: v1 3 | kind: Secret 4 | metadata: 5 | name: datadog-app-key 6 | namespace: datadog 7 | labels: 8 | app: "datadog" 9 | type: Opaque 10 | data: 11 | app-key: 12 | -------------------------------------------------------------------------------- /deploy/generic-k8s/datadog-agent/clusterrolebinding.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: rbac.authorization.k8s.io/v1 2 | kind: ClusterRoleBinding 3 | metadata: 4 | name: datadog-agent 5 | roleRef: 6 | apiGroup: rbac.authorization.k8s.io 7 | kind: ClusterRole 8 | name: datadog-agent 9 | subjects: 10 | - kind: ServiceAccount 11 | name: datadog-agent 12 | namespace: datadog 13 | -------------------------------------------------------------------------------- /deploy/generic-k8s/datadog-agent/dca-secret.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Secret 3 | metadata: 4 | name: datadog-auth-token 5 | type: Opaque 6 | data: 7 | # use a base64 string: `echo -n '' | base64` 8 | token: PFRoaXJ0eVgyWGNoYXJhY3RlcnNYbG9uZ1h0b2tlbj4= 9 | -------------------------------------------------------------------------------- /deploy/generic-k8s/datadog-agent/serviceaccount.yaml: -------------------------------------------------------------------------------- 1 | kind: ServiceAccount 2 | apiVersion: v1 3 | metadata: 4 | name: datadog-agent 5 | namespace: datadog 6 | -------------------------------------------------------------------------------- /deploy/openshift/cluster-agent/datadog-cluster-agent_service.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Service 3 | metadata: 4 | name: datadog-cluster-agent 5 | labels: 6 | app: datadog-cluster-agent 7 | spec: 8 | ports: 9 | - port: 5005 # Has to be the same as the one exposed in the DCA. Default is 5005. 10 | protocol: TCP 11 | selector: 12 | app: datadog-cluster-agent 13 | -------------------------------------------------------------------------------- /deploy/openshift/cluster-agent/datadog-custom-metric-server.yaml: -------------------------------------------------------------------------------- 1 | kind: Service 2 | apiVersion: v1 3 | metadata: 4 | name: datadog-custom-metrics-server 5 | spec: 6 | selector: 7 | app: datadog-cluster-agent 8 | ports: 9 | - protocol: TCP 10 | port: 443 11 | targetPort: 443 12 | -------------------------------------------------------------------------------- /deploy/openshift/cluster-agent/secret-app-key.yaml: -------------------------------------------------------------------------------- 1 | # Secret to use Datadog Cluster Agent as External Metrics Server (optional) 2 | apiVersion: v1 3 | kind: Secret 4 | metadata: 5 | name: datadog-app-key 6 | namespace: datadog 7 | labels: 8 | app: "datadog" 9 | type: Opaque 10 | data: 11 | app-key: 12 | -------------------------------------------------------------------------------- /deploy/openshift/datadog-agent/clusterrolebinding.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: rbac.authorization.k8s.io/v1 2 | kind: ClusterRoleBinding 3 | metadata: 4 | name: datadog-agent 5 | roleRef: 6 | apiGroup: rbac.authorization.k8s.io 7 | kind: ClusterRole 8 | name: datadog-agent 9 | subjects: 10 | - kind: ServiceAccount 11 | name: datadog-agent 12 | namespace: datadog 13 | -------------------------------------------------------------------------------- /deploy/openshift/datadog-agent/dca-secret.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Secret 3 | metadata: 4 | name: datadog-auth-token 5 | type: Opaque 6 | data: 7 | # use a base64 string: `echo -n '' | base64` 8 | token: PFRoaXJ0eVgyWGNoYXJhY3RlcnNYbG9uZ1h0b2tlbj4= 9 | -------------------------------------------------------------------------------- /deploy/openshift/datadog-agent/serviceaccount.yaml: -------------------------------------------------------------------------------- 1 | kind: ServiceAccount 2 | apiVersion: v1 3 | metadata: 4 | name: datadog-agent 5 | namespace: datadog 6 | -------------------------------------------------------------------------------- /deploy/terraform/aws-ec2/.gitignore: -------------------------------------------------------------------------------- 1 | ecommerceapp 2 | ecommerceapp.pub 3 | run.sh 4 | internalhostsfile 5 | .terraform.lock.hcl -------------------------------------------------------------------------------- /deploy/terraform/aws-ec2/resources.tf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DataDog/ecommerce-workshop/aaa8069566b6c86ed5407ec830bf64713067fcd5/deploy/terraform/aws-ec2/resources.tf -------------------------------------------------------------------------------- /deploy/terraform/aws-ec2/runshtemplate: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | function checkssh () { 4 | while ! ssh -oStrictHostKeyChecking=no $1@$2 echo '' 5 | do sleep 3 6 | done 7 | } 8 | 9 | -------------------------------------------------------------------------------- /deploy/terraform/aws-ec2/setuphosts.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | privateip=$1 3 | publicip=$2 4 | loginname=$3 5 | hostname=$4 6 | hosts='internalhostsfile' 7 | sshstring="$loginname@$publicip" 8 | 9 | echo $privateip $hostname >> $hosts 10 | echo checkssh $loginname $publicip >> run.sh 11 | echo scp -oStrictHostKeyChecking=no -i ecommerceapp $hosts $sshstring:/home/$loginname/hosts >> run.sh 12 | echo ssh -oStrictHostKeyChecking=no -i ecommerceapp $sshstring sudo mv /home/$loginname/hosts /etc/hosts >> run.sh 13 | echo ssh -oStrictHostKeyChecking=no -i ecommerceapp $sshstring sudo hostname $hostname >> run.sh -------------------------------------------------------------------------------- /deploy/terraform/digitalocean/output.tf: -------------------------------------------------------------------------------- 1 | resource "local_file" "kube_config_server_yaml" { 2 | filename = format("%s/../../%s", path.root, "kube_config_server.yaml") 3 | sensitive_content = digitalocean_kubernetes_cluster.k8s_cluster.kube_config[0].raw_config 4 | file_permission = "0600" 5 | } 6 | -------------------------------------------------------------------------------- /deploy/terraform/digitalocean/versions.tf: -------------------------------------------------------------------------------- 1 | terraform { 2 | required_providers { 3 | digitalocean = { 4 | source = "digitalocean/digitalocean" 5 | version = "~> 1.23.0" 6 | } 7 | kubernetes = { 8 | source = "hashicorp/kubernetes" 9 | version = "~> 1.13.2" 10 | } 11 | local = { 12 | source = "hashicorp/local" 13 | version = "~> 2.0.0" 14 | } 15 | } 16 | required_version = ">= 0.13" 17 | } 18 | -------------------------------------------------------------------------------- /discounts-react-app/.dockerignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | .dockerignore 3 | -------------------------------------------------------------------------------- /discounts-react-app/Dockerfile: -------------------------------------------------------------------------------- 1 | # build environment 2 | FROM node:13.12.0-alpine as build 3 | WORKDIR /app 4 | COPY ./src/main ./ 5 | ENV PATH /app/node_modules/.bin:$PATH 6 | RUN npm ci 7 | RUN npm run-script build 8 | 9 | # production environment 10 | FROM nginx:1.19.7 11 | COPY --from=build /app/dist /usr/share/nginx/html 12 | COPY ./assets/nginx.conf /etc/nginx/nginx.conf 13 | EXPOSE 80 14 | CMD ["nginx", "-g", "daemon off;"] -------------------------------------------------------------------------------- /discounts-react-app/src/main/.env.EXAMPLE: -------------------------------------------------------------------------------- 1 | REACT_APP_DD_APPLICATION_ID= 2 | REACT_APP_DD_CLIENT_TOKEN= 3 | REACT_APP_DD_SITE= 4 | REACT_APP_DD_SERVICE= 5 | REACT_APP_DD_ENV= 6 | REACT_APP_STOREDOG_URL= 7 | REACT_APP_DD_DISCOUNTS_URL= 8 | REACT_APP_DD_ADS_URL= 9 | -------------------------------------------------------------------------------- /discounts-react-app/src/main/.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. 2 | 3 | # dependencies 4 | /node_modules 5 | /.pnp 6 | .pnp.js 7 | 8 | # testing 9 | /coverage 10 | 11 | # production 12 | /build 13 | /dist 14 | 15 | # misc 16 | .DS_Store 17 | .env 18 | .env.local 19 | .env.development.local 20 | .env.test.local 21 | .env.production.local 22 | 23 | npm-debug.log* 24 | yarn-debug.log* 25 | yarn-error.log* 26 | -------------------------------------------------------------------------------- /discounts-react-app/src/main/README.md: -------------------------------------------------------------------------------- 1 | # storedog-microsite -------------------------------------------------------------------------------- /discounts-react-app/src/main/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Storedog Discount Saver 8 | 9 | 10 |
11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /discounts-react-app/src/main/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "react-ts", 3 | "version": "0.0.0", 4 | "scripts": { 5 | "dev": "vite", 6 | "build": "tsc && vite build", 7 | "serve": "vite preview" 8 | }, 9 | "dependencies": { 10 | "@datadog/browser-rum": "^3.6.10", 11 | "react": "^17.0.0", 12 | "react-dom": "^17.0.0" 13 | }, 14 | "devDependencies": { 15 | "@datadog/datadog-ci": "^0.17.6", 16 | "@types/node": "^16.10.3", 17 | "@types/react": "^17.0.0", 18 | "@types/react-dom": "^17.0.0", 19 | "@vitejs/plugin-react": "^1.0.0", 20 | "autoprefixer": "^10.3.7", 21 | "postcss": "^8.3.9", 22 | "tailwindcss": "^2.2.16", 23 | "typescript": "^4.3.2", 24 | "vite": "^2.5.10" 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /discounts-react-app/src/main/postcss.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | plugins: { 3 | tailwindcss: {}, 4 | autoprefixer: {}, 5 | }, 6 | }; 7 | -------------------------------------------------------------------------------- /discounts-react-app/src/main/public/assets/images/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DataDog/ecommerce-workshop/aaa8069566b6c86ed5407ec830bf64713067fcd5/discounts-react-app/src/main/public/assets/images/logo.png -------------------------------------------------------------------------------- /discounts-react-app/src/main/public/assets/images/logo_nobg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DataDog/ecommerce-workshop/aaa8069566b6c86ed5407ec830bf64713067fcd5/discounts-react-app/src/main/public/assets/images/logo_nobg.png -------------------------------------------------------------------------------- /discounts-react-app/src/main/src/components/Nav.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | 3 | const Nav = () => { 4 | return ( 5 |
6 | 21 |
22 | ); 23 | }; 24 | 25 | export default Nav; 26 | -------------------------------------------------------------------------------- /discounts-react-app/src/main/src/index.css: -------------------------------------------------------------------------------- 1 | @tailwind base; 2 | @tailwind components; 3 | @tailwind utilities; 4 | 5 | body { 6 | margin: 0; 7 | font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 8 | 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', 9 | sans-serif; 10 | -webkit-font-smoothing: antialiased; 11 | -moz-osx-font-smoothing: grayscale; 12 | } 13 | 14 | code { 15 | font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New', 16 | monospace; 17 | } 18 | -------------------------------------------------------------------------------- /discounts-react-app/src/main/src/vite-env.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | -------------------------------------------------------------------------------- /discounts-react-app/src/main/tailwind.config.js: -------------------------------------------------------------------------------- 1 | const colors = require('tailwindcss/colors'); 2 | 3 | module.exports = { 4 | purge: ['./src/**/*.{js,jsx,ts,tsx}', './public/index.html'], 5 | darkMode: false, // or 'media' or 'class' 6 | theme: { 7 | colors: { 8 | storedog: '#1c5c92', 9 | 'storedog-dark': '#1E4668', 10 | ...colors, 11 | }, 12 | height: { 13 | logo: '75px', 14 | }, 15 | extend: {}, 16 | }, 17 | variants: { 18 | extend: {}, 19 | }, 20 | plugins: [], 21 | }; 22 | -------------------------------------------------------------------------------- /discounts-react-app/src/main/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "ESNext", 4 | "useDefineForClassFields": true, 5 | "lib": ["DOM", "DOM.Iterable", "ESNext"], 6 | "allowJs": false, 7 | "skipLibCheck": false, 8 | "esModuleInterop": false, 9 | "allowSyntheticDefaultImports": true, 10 | "strict": true, 11 | "forceConsistentCasingInFileNames": true, 12 | "module": "ESNext", 13 | "moduleResolution": "Node", 14 | "resolveJsonModule": true, 15 | "isolatedModules": true, 16 | "noEmit": true, 17 | "jsx": "react" 18 | }, 19 | "include": ["./src"] 20 | } 21 | -------------------------------------------------------------------------------- /discounts-react-app/src/main/vite.config.ts: -------------------------------------------------------------------------------- 1 | import { defineConfig } from 'vite'; 2 | import react from '@vitejs/plugin-react'; 3 | 4 | // https://vitejs.dev/config/ 5 | export default defineConfig({ 6 | plugins: [react()], 7 | build: { 8 | sourcemap: true, 9 | }, 10 | envPrefix: 'REACT_APP_', 11 | }); 12 | -------------------------------------------------------------------------------- /discounts-service-fixed/.dockerignore: -------------------------------------------------------------------------------- 1 | # Version control 2 | .git 3 | 4 | # Compiled Python bytecode 5 | **/__pycache__ 6 | **/*.pyc 7 | **/*.pyo 8 | 9 | # Compiled extensions 10 | **/*.pyd 11 | **/*.so 12 | 13 | # coverage.py 14 | .coverage 15 | .coverage.* 16 | htmlcov 17 | 18 | # Cached files 19 | .cache 20 | .mypy_cache 21 | .hypothesis 22 | .pytest_cache 23 | 24 | # Virtualenvs and builds 25 | build/ 26 | dist/ 27 | .env 28 | .venv 29 | env/ 30 | venv/ 31 | ENV/ 32 | env.bak/ 33 | venv.bak/ 34 | 35 | # Docker 36 | Dockerfile* 37 | .dockerignore 38 | -------------------------------------------------------------------------------- /discounts-service-fixed/README.md: -------------------------------------------------------------------------------- 1 | To test the words module: 2 | 3 | `python3 -m unittest test.py` 4 | -------------------------------------------------------------------------------- /discounts-service-fixed/build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Set bash strict mode so we insta-fail on any errors 3 | # -e: Exit immediately if a command has non-zero exit code, i.e. fails somehow. 4 | # Otherwise bash is like a Python program that just swallows exceptions. 5 | # -u: Exit with error message if code uses an undefined environment variable, 6 | # instead of silently continuing with an empty string. 7 | # -o pipefail: Like -e, except for piped commands. 8 | set -euo pipefail 9 | 10 | # Enable Docker Buildkit 11 | export DOCKER_BUILDKIT=1 12 | 13 | # Build and tag image 14 | docker image build --progress=plain --tag ddtraining/discounts-fixed:latest . 15 | -------------------------------------------------------------------------------- /discounts-service-fixed/requirements.txt: -------------------------------------------------------------------------------- 1 | certifi==2020.12.5 2 | chardet==4.0.0 3 | click==7.1.2 4 | ddtrace==0.57.3 5 | Flask==1.1.2 6 | Flask-Cors==3.0.10 7 | Flask-SQLAlchemy==2.4.4 8 | idna==2.10 9 | intervaltree==3.1.0 10 | itsdangerous==1.1.0 11 | Jinja2==2.11.3 12 | MarkupSafe==1.1.1 13 | msgpack-python==0.5.6 14 | names==0.3.0 15 | nose==1.3.7 16 | protobuf==3.14.0 17 | psutil==5.8.0 18 | psycopg2==2.8.6 19 | PyDispatcher==2.0.5 20 | PyYAML==5.4.1 21 | requests==2.25.1 22 | six==1.15.0 23 | sortedcontainers==2.3.0 24 | SQLAlchemy==1.3.23 25 | tenacity==6.3.1 26 | urllib3==1.26.5 27 | Werkzeug==1.0.1 28 | wrapt==1.12.1 -------------------------------------------------------------------------------- /discounts-service/.dockerignore: -------------------------------------------------------------------------------- 1 | # Version control 2 | .git 3 | 4 | # Compiled Python bytecode 5 | **/__pycache__ 6 | **/*.pyc 7 | **/*.pyo 8 | 9 | # Compiled extensions 10 | **/*.pyd 11 | **/*.so 12 | 13 | # coverage.py 14 | .coverage 15 | .coverage.* 16 | htmlcov 17 | 18 | # Cached files 19 | .cache 20 | .mypy_cache 21 | .hypothesis 22 | .pytest_cache 23 | 24 | # Virtualenvs and builds 25 | build/ 26 | dist/ 27 | .env 28 | .venv 29 | env/ 30 | venv/ 31 | ENV/ 32 | env.bak/ 33 | venv.bak/ 34 | 35 | # Docker 36 | Dockerfile* 37 | .dockerignore 38 | -------------------------------------------------------------------------------- /discounts-service/README.md: -------------------------------------------------------------------------------- 1 | To test the words module: 2 | 3 | `python3 -m unittest test.py` 4 | -------------------------------------------------------------------------------- /discounts-service/build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Set bash strict mode so we insta-fail on any errors 3 | # -e: Exit immediately if a command has non-zero exit code, i.e. fails somehow. 4 | # Otherwise bash is like a Python program that just swallows exceptions. 5 | # -u: Exit with error message if code uses an undefined environment variable, 6 | # instead of silently continuing with an empty string. 7 | # -o pipefail: Like -e, except for piped commands. 8 | set -euo pipefail 9 | 10 | # Enable Docker Buildkit 11 | export DOCKER_BUILDKIT=1 12 | 13 | # Build and tag image 14 | docker image build --progress=plain --tag ddtraining/discounts:latest . 15 | -------------------------------------------------------------------------------- /discounts-service/keys/README.md: -------------------------------------------------------------------------------- 1 | ### Attention 2 | 3 | These keys are used for training purposes and were **intentionally** added to this repository. These keys are self-contained within the docker images used by `deploy/docker-compose-fixed-instrumented-attack.yml`. They do not reside in any other external server. Please do not flag for security purposes and/or a bug bounty program. -------------------------------------------------------------------------------- /discounts-service/keys/storedog-leaked-key.pub: -------------------------------------------------------------------------------- 1 | ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDUXq470vMlwLcCrG7BvwpE7eJQSY6dFpRMS7wHhIBECkD2w/ej2oXLA7lj5Go+A4oWEjXytNwBE7NwdMKGM5yHfaWp8zg7sqeDmx8ODrlW4shDPFBzqxP3XLZ7svYjcFqKDNpsKH74a+uk0wRGuVMWzjmednSAokGsPz84lmnHhuwKRaeVL99MteBeBD23youq9nrI7XmCZZ1wGsuN8yEUBOp3vl8dlD3PBXYCYguFIdnVufvQ0WuzKeayK/dbbi9moxVAHG7pRF7V8MMKyP2ySVV9/FcFNLTETCJLl7RKQCFhyMcUZ03Ehx3j4is7VCceMzJz49Mey2vgIR7YsQSLEiTSdCvGvnYyWZqYkTSSA4ObRV0ifSzyVcfouzP8QvD4YWHDSRjac4lI++Jo+/HdGnHQ6YA0cMlu7Px6Mje65TMcFq8EiwIk552fEem4sLG65h6OKAqQIt+qnBnN2tmKMxe/bqHOECzasyVREkiWCxqzUNt14dUmhqve/K4dXLk= colin.cole@COMP-C02CD0UULVDN 2 | -------------------------------------------------------------------------------- /discounts-service/requirements.txt: -------------------------------------------------------------------------------- 1 | certifi==2020.12.5 2 | chardet==4.0.0 3 | click==7.1.2 4 | ddtrace==0.57.3 5 | Flask==1.1.2 6 | Flask-Cors==3.0.10 7 | Flask-SQLAlchemy==2.4.4 8 | idna==2.10 9 | intervaltree==3.1.0 10 | itsdangerous==1.1.0 11 | Jinja2==2.11.3 12 | MarkupSafe==1.1.1 13 | msgpack-python==0.5.6 14 | names==0.3.0 15 | nose==1.3.7 16 | protobuf==3.14.0 17 | psutil==5.8.0 18 | psycopg2==2.8.6 19 | PyDispatcher==2.0.5 20 | PyYAML==5.4.1 21 | requests==2.25.1 22 | six==1.15.0 23 | sortedcontainers==2.3.0 24 | SQLAlchemy==1.3.23 25 | tenacity==6.3.1 26 | urllib3==1.26.3 27 | Werkzeug==1.0.1 28 | wrapt==1.12.1 -------------------------------------------------------------------------------- /images/2-ads-versions.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DataDog/ecommerce-workshop/aaa8069566b6c86ed5407ec830bf64713067fcd5/images/2-ads-versions.gif -------------------------------------------------------------------------------- /images/500-trace-errors.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DataDog/ecommerce-workshop/aaa8069566b6c86ed5407ec830bf64713067fcd5/images/500-trace-errors.png -------------------------------------------------------------------------------- /images/bottleneck.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DataDog/ecommerce-workshop/aaa8069566b6c86ed5407ec830bf64713067fcd5/images/bottleneck.gif -------------------------------------------------------------------------------- /images/error-traces.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DataDog/ecommerce-workshop/aaa8069566b6c86ed5407ec830bf64713067fcd5/images/error-traces.gif -------------------------------------------------------------------------------- /images/extra-latency-ads.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DataDog/ecommerce-workshop/aaa8069566b6c86ed5407ec830bf64713067fcd5/images/extra-latency-ads.jpg -------------------------------------------------------------------------------- /images/extra-latency-solved.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DataDog/ecommerce-workshop/aaa8069566b6c86ed5407ec830bf64713067fcd5/images/extra-latency-solved.jpg -------------------------------------------------------------------------------- /images/logged-errors.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DataDog/ecommerce-workshop/aaa8069566b6c86ed5407ec830bf64713067fcd5/images/logged-errors.png -------------------------------------------------------------------------------- /images/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DataDog/ecommerce-workshop/aaa8069566b6c86ed5407ec830bf64713067fcd5/images/logo.png -------------------------------------------------------------------------------- /images/nplus-query.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DataDog/ecommerce-workshop/aaa8069566b6c86ed5407ec830bf64713067fcd5/images/nplus-query.png -------------------------------------------------------------------------------- /images/problematic-service.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DataDog/ecommerce-workshop/aaa8069566b6c86ed5407ec830bf64713067fcd5/images/problematic-service.gif -------------------------------------------------------------------------------- /images/service-map.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DataDog/ecommerce-workshop/aaa8069566b6c86ed5407ec830bf64713067fcd5/images/service-map.png -------------------------------------------------------------------------------- /images/services-list.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DataDog/ecommerce-workshop/aaa8069566b6c86ed5407ec830bf64713067fcd5/images/services-list.png -------------------------------------------------------------------------------- /images/solved-nplus.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DataDog/ecommerce-workshop/aaa8069566b6c86ed5407ec830bf64713067fcd5/images/solved-nplus.png -------------------------------------------------------------------------------- /images/storedog.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DataDog/ecommerce-workshop/aaa8069566b6c86ed5407ec830bf64713067fcd5/images/storedog.png -------------------------------------------------------------------------------- /license.md: -------------------------------------------------------------------------------- 1 | Copyright © 2019-2020, Datadog and other contributors. 2 | 3 | Spree modules are separately licenses under respective Spree licenses. 4 | 5 | Licensed under the Apache License, Version 2.0 (the "License"); 6 | you may not use this file except in compliance with the License. 7 | You may obtain a copy of the License at 8 | 9 | http://www.apache.org/licenses/LICENSE-2.0 10 | 11 | Unless required by applicable law or agreed to in writing, software 12 | distributed under the License is distributed on an "AS IS" BASIS, 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | See the License for the specific language governing permissions and 15 | limitations under the License. -------------------------------------------------------------------------------- /nginx/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM nginx:1.21.4 2 | COPY default.conf /etc/nginx/conf.d/default.conf -------------------------------------------------------------------------------- /nginx/default.conf: -------------------------------------------------------------------------------- 1 | server { 2 | location / { 3 | proxy_set_header Host $host; 4 | proxy_set_header X-Real-IP $remote_addr; 5 | proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; 6 | proxy_set_header X-Forwarded-Proto $scheme; 7 | 8 | proxy_pass http://frontend:3000; 9 | } 10 | } -------------------------------------------------------------------------------- /service-definitions/ads.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | schema-version: v2 3 | dd-service: advertisements 4 | team: ads-team 5 | contacts: 6 | - type: slack 7 | contact: http://slack/e-commerce 8 | - type: email 9 | name: Ads Engineering Team 10 | contact: ads@example.com 11 | links: 12 | - name: Runbook 13 | type: runbook 14 | url: http://runbook/advertisements 15 | repos: 16 | - name: Source 17 | provider: github 18 | url: https://github.com/DataDog/ecommerce-workshop/tree/main/ads-service 19 | docs: 20 | - name: Ads Team 21 | provider: wiki 22 | url: http://wiki/ads-team 23 | tags: 24 | - app:storedog 25 | - cost-center:engineering 26 | 27 | -------------------------------------------------------------------------------- /service-definitions/discounts.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | schema-version: v2 3 | dd-service: discounts 4 | team: discounts-team 5 | contacts: 6 | - type: slack 7 | contact: http://slack/e-commerce 8 | - type: email 9 | name: Discounts Engineering Team 10 | contact: discounts@example.com 11 | links: 12 | - name: Runbook 13 | type: runbook 14 | url: http://runbook/discounts 15 | repos: 16 | - name: Source 17 | provider: github 18 | url: https://github.com/DataDog/ecommerce-workshop/tree/main/discounts-service 19 | docs: 20 | - name: Discounts Team 21 | provider: wiki 22 | url: http://wiki/discounts-team 23 | tags: 24 | - app:storedog 25 | - cost-center:engineering 26 | -------------------------------------------------------------------------------- /service-definitions/screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DataDog/ecommerce-workshop/aaa8069566b6c86ed5407ec830bf64713067fcd5/service-definitions/screenshot.png -------------------------------------------------------------------------------- /store-frontend/docker-entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # This is entrypoint for docker image of spree sandbox on docker cloud 3 | 4 | # Set our environment to development for now 5 | # TODO: Make this more configurable with a default 6 | export RAILS_ENV=development 7 | # Silence all Ruby 3.0 deprecation warnings for now until we upgrade 8 | # TODO: Remove this once we upgrade to Ruby 3.0 and Rails 6.1 9 | export RUBYOPT='-W0' 10 | # Force semantic-logger to report itself as the storefront app 11 | export SEMANTIC_LOGGER_APP='store-frontend' 12 | 13 | puma --config config/puma.rb 14 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/.ruby-version: -------------------------------------------------------------------------------- 1 | ruby-2.7.2 2 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/README.md: -------------------------------------------------------------------------------- 1 | # README 2 | 3 | This README would normally document whatever steps are necessary to get the 4 | application up and running. 5 | 6 | Things you may want to cover: 7 | 8 | * Ruby version 9 | 10 | * System dependencies 11 | 12 | * Configuration 13 | 14 | * Database creation 15 | 16 | * Database initialization 17 | 18 | * How to run the test suite 19 | 20 | * Services (job queues, cache servers, search engines, etc.) 21 | 22 | * Deployment instructions 23 | 24 | * ... 25 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/Rakefile: -------------------------------------------------------------------------------- 1 | # Add your own tasks in files placed in lib/tasks ending in .rake, 2 | # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake. 3 | 4 | require_relative 'config/application' 5 | 6 | Rails.application.load_tasks 7 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/app/assets/config/manifest.js: -------------------------------------------------------------------------------- 1 | //= link_tree ../images 2 | //= link_directory ../stylesheets .css 3 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/app/assets/javascripts/discounts.js: -------------------------------------------------------------------------------- 1 | // Place all the behaviors and hooks related to the matching controller here. 2 | // All this logic will automatically be available in application.js. 3 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/app/assets/stylesheets/discounts.scss: -------------------------------------------------------------------------------- 1 | // Place all the styles related to the Discounts controller here. 2 | // They will automatically be included in application.css. 3 | // You can use Sass (SCSS) here: http://sass-lang.com/ 4 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/app/channels/application_cable/channel.rb: -------------------------------------------------------------------------------- 1 | module ApplicationCable 2 | class Channel < ActionCable::Channel::Base 3 | end 4 | end 5 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/app/channels/application_cable/connection.rb: -------------------------------------------------------------------------------- 1 | module ApplicationCable 2 | class Connection < ActionCable::Connection::Base 3 | end 4 | end 5 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/app/controllers/application_controller.rb: -------------------------------------------------------------------------------- 1 | class ApplicationController < ActionController::Base 2 | def append_info_to_payload(payload) 3 | super 4 | 5 | case 6 | when payload[:status] == 200 7 | payload[:level] = "INFO" 8 | when payload[:status] == 302 9 | payload[:level] = "WARN" 10 | else 11 | payload[:level] = "ERROR" 12 | end 13 | end 14 | end 15 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/app/controllers/discounts_controller.rb: -------------------------------------------------------------------------------- 1 | class DiscountsController < ApplicationController 2 | def get 3 | @discounts = Net::HTTP.get_response(URI("#{ENV['DISCOUNTS_ROUTE']}:#{ENV['DISCOUNTS_PORT']}/discount")).body 4 | logger.info @discounts 5 | render json: @discounts 6 | end 7 | 8 | def add 9 | end 10 | end 11 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/app/controllers/spree/home_controller.rb: -------------------------------------------------------------------------------- 1 | module Spree 2 | class HomeController < Spree::StoreController 3 | helper 'spree/products' 4 | respond_to :html 5 | 6 | def index 7 | @searcher = build_searcher(params.merge(include_images: true)) 8 | @products = @searcher.retrieve_products 9 | @products = @products.includes(:possible_promotions) if @products.respond_to?(:includes) 10 | @taxonomies = Spree::Taxonomy.includes(root: :children) 11 | @discounts = helpers.get_discounts.sample 12 | @ads = helpers.get_ads.sample 13 | @ads['base64'] = Base64.encode64(open("#{ENV['ADS_ROUTE']}:#{ENV['ADS_PORT']}/banners/#{@ads['path']}").read).gsub("\n", '') 14 | end 15 | end 16 | end 17 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/app/helpers/application_helper.rb: -------------------------------------------------------------------------------- 1 | module ApplicationHelper 2 | def get_ads 3 | @ads = JSON.parse(Net::HTTP.get_response(URI("#{ENV['ADS_ROUTE']}:#{ENV['ADS_PORT']}/ads")).body) 4 | end 5 | 6 | end 7 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/app/helpers/discounts_helper.rb: -------------------------------------------------------------------------------- 1 | module DiscountsHelper 2 | end 3 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/app/helpers/spree/product_helper.rb: -------------------------------------------------------------------------------- 1 | module Spree 2 | module ProductHelper 3 | def get_ads 4 | @ads = JSON.parse(Net::HTTP.get_response(URI("#{ENV['ADS_ROUTE']}:#{ENV['ADS_PORT']}/ads")).body) 5 | end 6 | end 7 | 8 | end -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/app/jobs/application_job.rb: -------------------------------------------------------------------------------- 1 | class ApplicationJob < ActiveJob::Base 2 | end 3 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/app/mailers/application_mailer.rb: -------------------------------------------------------------------------------- 1 | class ApplicationMailer < ActionMailer::Base 2 | default from: 'from@example.com' 3 | layout 'mailer' 4 | end 5 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/app/models/application_record.rb: -------------------------------------------------------------------------------- 1 | class ApplicationRecord < ActiveRecord::Base 2 | self.abstract_class = true 3 | end 4 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/app/views/discounts/add.html.erb: -------------------------------------------------------------------------------- 1 |

Discounts#add

2 |

Find me in app/views/discounts/add.html.erb

3 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/app/views/discounts/get.html.erb: -------------------------------------------------------------------------------- 1 |

Discounts#get

2 |

Find me in app/views/discounts/get.html.erb

3 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/app/views/kaminari/twitter-bootstrap-4/_first_page.html.erb: -------------------------------------------------------------------------------- 1 | <%# Link to the "First" page 2 | - available local variables 3 | url: url to the first page 4 | current_page: a page object for the currently displayed page 5 | total_pages: total number of pages 6 | per_page: number of items to fetch per page 7 | remote: data-remote 8 | -%> 9 | <% unless current_page.first? %> 10 |
  • 11 | <%= link_to_unless current_page.first?, raw(t 'views.pagination.first'), url, remote: remote, class: 'page-link' %> 12 |
  • 13 | <% end %> 14 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/app/views/kaminari/twitter-bootstrap-4/_gap.html.erb: -------------------------------------------------------------------------------- 1 | <%# Non-link tag that stands for skipped pages... 2 | - available local variables 3 | current_page: a page object for the currently displayed page 4 | total_pages: total number of pages 5 | per_page: number of items to fetch per page 6 | remote: data-remote 7 | -%> 8 |
  • 9 | 10 | <%= raw(t 'views.pagination.truncate') %> 11 | 12 |
  • 13 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/app/views/kaminari/twitter-bootstrap-4/_last_page.html.erb: -------------------------------------------------------------------------------- 1 | <%# Link to the "Last" page 2 | - available local variables 3 | url: url to the last page 4 | current_page: a page object for the currently displayed page 5 | total_pages: total number of pages 6 | per_page: number of items to fetch per page 7 | remote: data-remote 8 | -%> 9 | <% unless current_page.last? %> 10 | 13 | <% end %> 14 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/app/views/kaminari/twitter-bootstrap-4/_next_page.html.erb: -------------------------------------------------------------------------------- 1 | <%# Link to the "Next" page 2 | - available local variables 3 | url: url to the next page 4 | current_page: a page object for the currently displayed page 5 | total_pages: total number of pages 6 | per_page: number of items to fetch per page 7 | remote: data-remote 8 | -%> 9 | <% unless current_page.last? %> 10 |
  • 11 | <%= link_to_unless current_page.last?, raw(t 'views.pagination.next'), url, rel: 'next', remote: remote, class: 'page-link' %> 12 |
  • 13 | <% end %> 14 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/app/views/kaminari/twitter-bootstrap-4/_page.html.erb: -------------------------------------------------------------------------------- 1 | <%# Link showing page number 2 | - available local variables 3 | page: a page object for "this" page 4 | url: url to this page 5 | current_page: a page object for the currently displayed page 6 | total_pages: total number of pages 7 | per_page: number of items to fetch per page 8 | remote: data-remote 9 | -%> 10 |
  • 11 | <%= link_to page, 12 | url, 13 | opts = { 14 | remote: remote, 15 | rel: page.next? ? 'next' : page.prev? ? 'prev' : nil, 16 | class: 'page-link' 17 | } %> 18 |
  • 19 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/app/views/kaminari/twitter-bootstrap-4/_prev_page.html.erb: -------------------------------------------------------------------------------- 1 | <%# Link to the "Previous" page 2 | - available local variables 3 | url: url to the previous page 4 | current_page: a page object for the currently displayed page 5 | total_pages: total number of pages 6 | per_page: number of items to fetch per page 7 | remote: data-remote 8 | -%> 9 | <% unless current_page.first? %> 10 | 13 | <% end %> 14 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/app/views/layouts/application.html.erb: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Sandbox 5 | <%= csrf_meta_tags %> 6 | <%= csp_meta_tag %> 7 | 8 | <%= stylesheet_link_tag 'application', media: 'all' %> 9 | 10 | 11 | 12 | <%= yield %> 13 | 14 | 15 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/app/views/layouts/mailer.html.erb: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 8 | 9 | 10 | 11 | <%= yield %> 12 | 13 | 14 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/app/views/layouts/mailer.text.erb: -------------------------------------------------------------------------------- 1 | <%= yield %> 2 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/app/views/spree/addresses/destroy.js.erb: -------------------------------------------------------------------------------- 1 | $("#billing_address_<%= @address.id %>").fadeOut(); 2 | $("#shipping_address_<%= @address.id %>").fadeOut(); 3 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/app/views/spree/checkout/payment/_check.html.erb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DataDog/ecommerce-workshop/aaa8069566b6c86ed5407ec830bf64713067fcd5/store-frontend/src/store-frontend-initial-state/app/views/spree/checkout/payment/_check.html.erb -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/app/views/spree/content/test.html.erb: -------------------------------------------------------------------------------- 1 | Nothing to see here. Move along now. -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/app/views/spree/home/index.html.erb: -------------------------------------------------------------------------------- 1 | <% @body_id = 'home-page' %> 2 | <% content_for :sidebar do %> 3 |

    4 |

    <%= @discounts['name'] %>!


    Enter coupon code '<%= @discounts['code']%>' 5 | at checkout for a $<%= '%.2f' % @discounts['value'] %> discount

    6 |
    7 | <%= render partial: 'spree/shared/taxonomies' %> 8 |
    9 | <% end %> 10 | 11 |
    12 | <% cache(cache_key_for_products) do %> 13 | <%= render partial: 'spree/shared/products', locals: { products: @products } %> 14 | <% end %> 15 |
    16 | 17 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/app/views/spree/orders/_adjustment_row.html.erb: -------------------------------------------------------------------------------- 1 | <% if adjustments.sum(&:amount) != 0 %> 2 | 3 |
    <%= type %>: <%= label %>
    4 | 5 |
    <%= Spree::Money.new(adjustments.sum(&:amount), currency: @order.currency) %>
    6 | 7 | 8 | <% end %> 9 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/app/views/spree/products/_taxons.html.erb: -------------------------------------------------------------------------------- 1 | <% if @product.taxons.present? %> 2 |

    <%= Spree.t(:look_for_similar_items) %>

    3 |
      4 | <% @product.taxons.each do |taxon| %> 5 |
    • <%= link_to taxon.name, seo_url(taxon) %>
    • 6 | <% end %> 7 |
    8 | <% end %> 9 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/app/views/spree/shared/_error_messages.html.erb: -------------------------------------------------------------------------------- 1 | <% if target && target.errors.any? %> 2 |
    3 |

    <%= Spree.t(:errors_prohibited_this_record_from_being_saved, count: target.errors.count) %>:

    4 |

    <%= Spree.t(:there_were_problems_with_the_following_fields) %>:

    5 |
      6 | <% target.errors.full_messages.each do |msg| %> 7 |
    • <%= msg %>
    • 8 | <% end %> 9 |
    10 |
    11 |
    12 | <% end %> 13 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/app/views/spree/shared/_header.html.erb: -------------------------------------------------------------------------------- 1 |
    2 | 12 |
    13 | <%= render partial: 'spree/shared/main_nav_bar' %> 14 |
    15 |
    16 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/app/views/spree/shared/_link_to_cart.html.erb: -------------------------------------------------------------------------------- 1 | <%= link_to_cart %> -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/app/views/spree/shared/_login_bar.html.erb: -------------------------------------------------------------------------------- 1 | <% if spree_current_user %> 2 |
  • 3 | <%= link_to Spree.t(:my_account), spree.account_path %> 4 |
  • 5 |
  • 6 | <%= link_to Spree.t(:logout), spree.logout_path %> 7 |
  • 8 | <% else %> 9 | 12 | <% end %> 13 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/app/views/spree/shared/_main_nav_bar.html.erb: -------------------------------------------------------------------------------- 1 | 17 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/app/views/spree/shared/_nav_bar.html.erb: -------------------------------------------------------------------------------- 1 | 8 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/app/views/spree/shared/_payment.html.erb: -------------------------------------------------------------------------------- 1 | <% source = payment.source %> 2 | 3 | <% if source.is_a?(Spree::CreditCard) %> 4 | 5 | <% unless (cc_type = source.cc_type).blank? %> 6 | <%= image_tag "credit_cards/icons/#{cc_type}.png" %> 7 | <% end %> 8 | <% if source.last_digits %> 9 | <%= Spree.t(:ending_in) %> <%= source.last_digits %> 10 | <% end %> 11 | 12 |
    13 | <%= source.name %> 14 | <% else %> 15 | <%= content_tag(:span, payment.payment_method.name) %> 16 | <% end %> 17 | 18 | (<%= payment.display_amount %>) 19 | 20 |
    21 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/app/views/spree/shared/_shipment_tracking.html.erb: -------------------------------------------------------------------------------- 1 | <% shipments = order.shipments.trackable %> 2 | 3 | <% if shipments.any? %> 4 |
    <%= Spree.t(:tracking) %>
    5 |
    6 | <% shipments.each do |shipment| %> 7 | <%= link_to_tracking(shipment) %> 8 | <% end %> 9 |
    10 | <% end %> 11 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/app/views/spree/shared/_sidebar.html.erb: -------------------------------------------------------------------------------- 1 | 4 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/app/views/spree/shared/_taxonomies.html.erb: -------------------------------------------------------------------------------- 1 | <% max_level = Spree::Config[:max_level_in_taxons_menu] || 1 %> 2 | 3 | 17 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/app/views/spree/shared/_translations.html.erb: -------------------------------------------------------------------------------- 1 | 8 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/app/views/spree/shared/forbidden.html.erb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DataDog/ecommerce-workshop/aaa8069566b6c86ed5407ec830bf64713067fcd5/store-frontend/src/store-frontend-initial-state/app/views/spree/shared/forbidden.html.erb -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/app/views/spree/shared/unauthorized.html.erb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DataDog/ecommerce-workshop/aaa8069566b6c86ed5407ec830bf64713067fcd5/store-frontend/src/store-frontend-initial-state/app/views/spree/shared/unauthorized.html.erb -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/app/views/spree/taxons/_taxon.html.erb: -------------------------------------------------------------------------------- 1 |
    2 |
    <%= link_to taxon.name, seo_url(taxon), class: 'breadcrumbs' %>
    3 | <%= render partial: 'spree/shared/products', locals: { products: taxon_preview(taxon), taxon: taxon } %> 4 |
    5 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/app/views/spree/taxons/show.html.erb: -------------------------------------------------------------------------------- 1 |

    <%= @taxon.name %>

    2 | 3 | <% content_for :sidebar do %> 4 |
    5 | <%= render partial: 'spree/shared/taxonomies' %> 6 | <%= render partial: 'spree/shared/filters' if @taxon.leaf? %> 7 |
    8 | <% end %> 9 | 10 |
    11 | <%= render partial: 'spree/shared/products', locals: { products: @products, taxon: @taxon } %> 12 |
    13 | 14 | <% unless params[:keywords].present? %> 15 |
    16 | <% cache [I18n.locale, @taxon] do %> 17 | <%= render partial: 'taxon', collection: @taxon.children %> 18 | <% end %> 19 |
    20 | <% end %> 21 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/bin/bundle: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__) 3 | load Gem.bin_path('bundler', 'bundle') 4 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/bin/rails: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | APP_PATH = File.expand_path('../config/application', __dir__) 3 | require_relative '../config/boot' 4 | require 'rails/commands' 5 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/bin/rake: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | require_relative '../config/boot' 3 | require 'rake' 4 | Rake.application.run 5 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/bin/yarn: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | APP_ROOT = File.expand_path('..', __dir__) 3 | Dir.chdir(APP_ROOT) do 4 | begin 5 | exec "yarnpkg", *ARGV 6 | rescue Errno::ENOENT 7 | $stderr.puts "Yarn executable was not detected in the system." 8 | $stderr.puts "Download Yarn at https://yarnpkg.com/en/docs/install" 9 | exit 1 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/config.ru: -------------------------------------------------------------------------------- 1 | # This file is used by Rack-based servers to start the application. 2 | 3 | require_relative 'config/environment' 4 | 5 | run Rails.application 6 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/config/boot.rb: -------------------------------------------------------------------------------- 1 | ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__) 2 | 3 | require 'bundler/setup' # Set up gems listed in the Gemfile. 4 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/config/cable.yml: -------------------------------------------------------------------------------- 1 | development: 2 | adapter: async 3 | 4 | test: 5 | adapter: async 6 | 7 | production: 8 | adapter: redis 9 | url: <%= ENV.fetch("REDIS_URL") { "redis://localhost:6379/1" } %> 10 | channel_prefix: sandbox_production 11 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/config/credentials.yml.enc: -------------------------------------------------------------------------------- 1 | CFnZeIPhehFy9M2VaZc6mV74hnp53ZOlilAmIRfomfH5zvxDsmqbCQzuIc+h+i4Wr3CH8Wx0zg2tTyYrVVt9IvEgjaoGqkSElb3NV6/9YWTHIlDBLxE9R1wGjbRCv1Thrkg7OZ0/friuLmqHpaAJ3dZDW8VFVC7dC/Td7Fb5sIu/OpDUwEAe0R5msypGXwTpmhWcRV2dQtTlRbAuXU4eDa8RDiuB7j9LzJlY1Pp6mKpuxCaoVtW3Bb/ZnvhU41Bfqbbn/Minj28FNr05tm+I+ra0fl4Z1W7SMwhC8RnJclEl+5CcipYvioMjb5ogIkqDQXsxmBuBE7jWhgSrvbiKdqajROVK7uxRUqyx3rsPe72Q7Ngf0ylFYbXw54PAGkz+n+2yZKLEV//qH2sJk8jNlUJia06RY9oK4Trp--AAxeDscN/c+l7i6/--RGcRh0BVodF9fPRCnj/xZQ== -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/config/database.yml: -------------------------------------------------------------------------------- 1 | # SQLite version 3.x 2 | # gem install sqlite3 3 | # 4 | # Ensure the SQLite 3 gem is defined in your Gemfile 5 | # gem 'sqlite3' 6 | # 7 | default: &default 8 | adapter: sqlite3 9 | pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %> 10 | timeout: 5000 11 | 12 | development: 13 | <<: *default 14 | database: db/development.sqlite3 15 | 16 | # Warning: The database defined as "test" will be erased and 17 | # re-generated from your development database when you run "rake". 18 | # Do not set this db to the same as development or production. 19 | test: 20 | <<: *default 21 | database: db/test.sqlite3 22 | 23 | production: 24 | <<: *default 25 | database: db/production.sqlite3 26 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/config/environment.rb: -------------------------------------------------------------------------------- 1 | # Load the Rails application. 2 | require_relative 'application' 3 | 4 | # Initialize the Rails application. 5 | Rails.application.initialize! 6 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/config/initializers/application_controller_renderer.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # ActiveSupport::Reloader.to_prepare do 4 | # ApplicationController.renderer.defaults.merge!( 5 | # http_host: 'example.org', 6 | # https: false 7 | # ) 8 | # end 9 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/config/initializers/assets.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Version of your assets, change this if you want to expire all your assets. 4 | Rails.application.config.assets.version = '1.0' 5 | 6 | # Add additional assets to the asset load path. 7 | # Rails.application.config.assets.paths << Emoji.images_path 8 | # Add Yarn node_modules folder to the asset load path. 9 | Rails.application.config.assets.paths << Rails.root.join('node_modules') 10 | 11 | # Precompile additional assets. 12 | # application.js, application.css, and all non-JS/CSS in the app/assets 13 | # folder are already added. 14 | Rails.application.config.assets.precompile += %w( discounts.js discounts.css ) 15 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/config/initializers/backtrace_silencers.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces. 4 | # Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ } 5 | 6 | # You can also remove all the silencers if you're trying to debug a problem that might stem from framework code. 7 | # Rails.backtrace_cleaner.remove_silencers! 8 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/config/initializers/cookies_serializer.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Specify a serializer for the signed and encrypted cookie jars. 4 | # Valid options are :json, :marshal, and :hybrid. 5 | Rails.application.config.action_dispatch.cookies_serializer = :json 6 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/config/initializers/devise.rb: -------------------------------------------------------------------------------- 1 | Devise.secret_key = "572596381874598715b21b228d9e925f67b42d474d0c14a8162bd1dc94f90d14e8ed32df3f27b6763df28978b02e687a31e1" -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/config/initializers/filter_parameter_logging.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Configure sensitive parameters which will be filtered from the log file. 4 | Rails.application.config.filter_parameters += [:password] 5 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/config/initializers/mime_types.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Add new mime types for use in respond_to blocks: 4 | # Mime::Type.register "text/richtext", :rtf 5 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/config/initializers/wrap_parameters.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # This file contains settings for ActionController::ParamsWrapper which 4 | # is enabled by default. 5 | 6 | # Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array. 7 | ActiveSupport.on_load(:action_controller) do 8 | wrap_parameters format: [:json] 9 | end 10 | 11 | # To enable root element in JSON for ActiveRecord objects. 12 | # ActiveSupport.on_load(:active_record) do 13 | # self.include_root_in_json = true 14 | # end 15 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/config/master.key: -------------------------------------------------------------------------------- 1 | 287d00e3089bbb394b50aacdcbfcdde1 -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/config/routes.rb: -------------------------------------------------------------------------------- 1 | Rails.application.routes.draw do 2 | get 'discounts/get' 3 | get 'discounts/add' 4 | # This line mounts Spree's routes at the root of your application. 5 | # This means, any requests to URLs such as /products, will go to 6 | # Spree::ProductsController. 7 | # If you would like to change where this engine is mounted, simply change the 8 | # :at option to something different. 9 | # 10 | # We ask that you don't use the :as option here, as Spree relies on it being 11 | # the default of "spree". 12 | mount Spree::Core::Engine, at: '/' 13 | # For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html 14 | end 15 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/development.sqlite3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DataDog/ecommerce-workshop/aaa8069566b6c86ed5407ec830bf64713067fcd5/store-frontend/src/store-frontend-initial-state/db/development.sqlite3 -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904144907_add_tax_rate_label.spree.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree (originally 20120905145253) 2 | class AddTaxRateLabel < ActiveRecord::Migration[4.2] 3 | def change 4 | add_column :spree_tax_rates, :name, :string 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904144908_add_toggle_tax_rate_display.spree.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree (originally 20120905151823) 2 | class AddToggleTaxRateDisplay < ActiveRecord::Migration[4.2] 3 | def change 4 | add_column :spree_tax_rates, :show_rate_in_label, :boolean, default: true 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904144910_add_lock_version_to_variant.spree.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree (originally 20121009142519) 2 | class AddLockVersionToVariant < ActiveRecord::Migration[4.2] 3 | def change 4 | add_column :spree_variants, :lock_version, :integer, default: 0 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904144911_add_states_required_to_countries.spree.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree (originally 20121010142909) 2 | class AddStatesRequiredToCountries < ActiveRecord::Migration[4.2] 3 | def change 4 | add_column :spree_countries, :states_required, :boolean, default: true 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904144912_add_on_demand_to_product_and_variant.spree.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree (originally 20121012071449) 2 | class AddOnDemandToProductAndVariant < ActiveRecord::Migration[4.2] 3 | def change 4 | add_column :spree_products, :on_demand, :boolean, default: false 5 | add_column :spree_variants, :on_demand, :boolean, default: false 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904144913_remove_not_null_constraint_from_products_on_hand.spree.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree (originally 20121017010007) 2 | class RemoveNotNullConstraintFromProductsOnHand < ActiveRecord::Migration[4.2] 3 | def up 4 | change_column :spree_products, :count_on_hand, :integer, null: true 5 | change_column :spree_variants, :count_on_hand, :integer, null: true 6 | end 7 | 8 | def down 9 | change_column :spree_products, :count_on_hand, :integer, null: false 10 | change_column :spree_variants, :count_on_hand, :integer, null: false 11 | end 12 | end 13 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904144915_remove_not_null_from_spree_prices_amount.spree.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree (originally 20121107003422) 2 | class RemoveNotNullFromSpreePricesAmount < ActiveRecord::Migration[4.2] 3 | def up 4 | change_column :spree_prices, :amount, :decimal, precision: 8, scale: 2, null: true 5 | end 6 | 7 | def down 8 | change_column :spree_prices, :amount, :decimal, precision: 8, scale: 2, null: false 9 | end 10 | end 11 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904144916_add_currency_to_line_items.spree.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree (originally 20121107184631) 2 | class AddCurrencyToLineItems < ActiveRecord::Migration[4.2] 3 | def change 4 | add_column :spree_line_items, :currency, :string 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904144917_add_currency_to_orders.spree.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree (originally 20121107194006) 2 | class AddCurrencyToOrders < ActiveRecord::Migration[4.2] 3 | def change 4 | add_column :spree_orders, :currency, :string 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904144918_add_cost_currency_to_variants.spree.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree (originally 20121109173623) 2 | class AddCostCurrencyToVariants < ActiveRecord::Migration[4.2] 3 | def change 4 | add_column :spree_variants, :cost_currency, :string, after: :cost_price 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904144919_remove_display_on_from_payment_methods.spree.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree (originally 20121111231553) 2 | class RemoveDisplayOnFromPaymentMethods < ActiveRecord::Migration[4.2] 3 | def up 4 | remove_column :spree_payment_methods, :display_on 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904144920_add_position_to_taxonomies.spree.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree (originally 20121124203911) 2 | class AddPositionToTaxonomies < ActiveRecord::Migration[4.2] 3 | def change 4 | add_column :spree_taxonomies, :position, :integer, default: 0 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904144921_add_last_ip_to_spree_orders.spree.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree (originally 20121126040517) 2 | class AddLastIpToSpreeOrders < ActiveRecord::Migration[4.2] 3 | def change 4 | add_column :spree_orders, :last_ip_address, :string 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904144922_add_state_to_spree_adjustments.spree.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree (originally 20121213162028) 2 | class AddStateToSpreeAdjustments < ActiveRecord::Migration[4.2] 3 | def change 4 | add_column :spree_adjustments, :state, :string 5 | remove_column :spree_adjustments, :locked 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904144923_add_display_on_to_spree_payment_methods.spree.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree (originally 20130114053446) 2 | class AddDisplayOnToSpreePaymentMethods < ActiveRecord::Migration[4.2] 3 | def self.up 4 | add_column :spree_payment_methods, :display_on, :string 5 | end 6 | 7 | def self.down 8 | remove_column :spree_payment_methods, :display_on 9 | end 10 | end 11 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904144924_add_position_to_product_properties.spree.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree (originally 20130120201805) 2 | class AddPositionToProductProperties < ActiveRecord::Migration[4.2] 3 | def change 4 | add_column :spree_product_properties, :position, :integer, default: 0 5 | end 6 | end 7 | 8 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904144925_add_identifier_to_spree_payments.spree.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree (originally 20130203232234) 2 | class AddIdentifierToSpreePayments < ActiveRecord::Migration[4.2] 3 | def change 4 | add_column :spree_payments, :identifier, :string 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904144926_add_order_id_index_to_payments.spree.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree (originally 20130207155350) 2 | class AddOrderIdIndexToPayments < ActiveRecord::Migration[4.2] 3 | def self.up 4 | add_index :spree_payments, :order_id 5 | end 6 | 7 | def self.down 8 | remove_index :spree_payments, :order_id 9 | end 10 | end 11 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904144927_add_primary_to_spree_products_taxons.spree.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree (originally 20130208032954) 2 | class AddPrimaryToSpreeProductsTaxons < ActiveRecord::Migration[4.2] 3 | def change 4 | add_column :spree_products_taxons, :id, :primary_key 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904144928_create_spree_stock_items.spree.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree (originally 20130211190146) 2 | class CreateSpreeStockItems < ActiveRecord::Migration[4.2] 3 | def change 4 | create_table :spree_stock_items do |t| 5 | t.belongs_to :stock_location 6 | t.belongs_to :variant 7 | t.integer :count_on_hand, null: false, default: 0 8 | t.integer :lock_version 9 | 10 | t.timestamps null: false, precision: 6 11 | end 12 | add_index :spree_stock_items, :stock_location_id 13 | add_index :spree_stock_items, [:stock_location_id, :variant_id], name: 'stock_item_by_loc_and_var_id' 14 | end 15 | end 16 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904144929_create_spree_stock_locations.spree.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree (originally 20130211191120) 2 | class CreateSpreeStockLocations < ActiveRecord::Migration[4.2] 3 | def change 4 | create_table :spree_stock_locations do |t| 5 | t.string :name 6 | t.belongs_to :address 7 | 8 | t.timestamps null: false, precision: 6 9 | end 10 | add_index :spree_stock_locations, :address_id 11 | end 12 | end 13 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904144931_add_order_id_index_to_shipments.spree.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree (originally 20130222032153) 2 | class AddOrderIdIndexToShipments < ActiveRecord::Migration[4.2] 3 | def change 4 | add_index :spree_shipments, :order_id 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904144932_change_meta_description_on_spree_products_to_text.spree.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree (originally 20130226032817) 2 | class ChangeMetaDescriptionOnSpreeProductsToText < ActiveRecord::Migration[4.2] 3 | def change 4 | change_column :spree_products, :meta_description, :text, limit: nil 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904144933_add_stock_location_id_to_spree_shipments.spree.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree (originally 20130226191231) 2 | class AddStockLocationIdToSpreeShipments < ActiveRecord::Migration[4.2] 3 | def change 4 | add_column :spree_shipments, :stock_location_id, :integer 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904144934_add_pending_to_inventory_unit.spree.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree (originally 20130227143905) 2 | class AddPendingToInventoryUnit < ActiveRecord::Migration[4.2] 3 | def change 4 | add_column :spree_inventory_units, :pending, :boolean, default: true 5 | Spree::InventoryUnit.update_all(pending: false) 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904144935_remove_on_demand_from_product_and_variant.spree.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree (originally 20130228164411) 2 | class RemoveOnDemandFromProductAndVariant < ActiveRecord::Migration[4.2] 3 | def change 4 | remove_column :spree_products, :on_demand 5 | remove_column :spree_variants, :on_demand 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904144937_remove_shipping_category_id_from_shipping_method.spree.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree (originally 20130301162745) 2 | class RemoveShippingCategoryIdFromShippingMethod < ActiveRecord::Migration[4.2] 3 | def change 4 | remove_column :spree_shipping_methods, :shipping_category_id 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904144938_create_shipping_method_categories.spree.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree (originally 20130301162924) 2 | class CreateShippingMethodCategories < ActiveRecord::Migration[4.2] 3 | def change 4 | create_table :spree_shipping_method_categories do |t| 5 | t.integer :shipping_method_id, null: false 6 | t.integer :shipping_category_id, null: false 7 | 8 | t.timestamps null: false, precision: 6 9 | end 10 | 11 | add_index :spree_shipping_method_categories, :shipping_method_id 12 | add_index :spree_shipping_method_categories, :shipping_category_id 13 | end 14 | end 15 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904144939_add_tracking_url_to_spree_shipping_methods.spree.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree (originally 20130301205200) 2 | class AddTrackingUrlToSpreeShippingMethods < ActiveRecord::Migration[4.2] 3 | def change 4 | add_column :spree_shipping_methods, :tracking_url, :string 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904144941_remove_category_match_attributes_from_shipping_method.spree.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree (originally 20130304192936) 2 | class RemoveCategoryMatchAttributesFromShippingMethod < ActiveRecord::Migration[4.2] 3 | def change 4 | remove_column :spree_shipping_methods, :match_none 5 | remove_column :spree_shipping_methods, :match_one 6 | remove_column :spree_shipping_methods, :match_all 7 | end 8 | end 9 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904144942_create_stock_movements.spree.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree (originally 20130305143310) 2 | class CreateStockMovements < ActiveRecord::Migration[4.2] 3 | def change 4 | create_table :spree_stock_movements do |t| 5 | t.belongs_to :stock_item 6 | t.integer :quantity 7 | t.string :action 8 | 9 | t.timestamps null: false, precision: 6 10 | end 11 | add_index :spree_stock_movements, :stock_item_id 12 | end 13 | end 14 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904144944_add_active_field_to_stock_locations.spree.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree (originally 20130306191917) 2 | class AddActiveFieldToStockLocations < ActiveRecord::Migration[4.2] 3 | def change 4 | add_column :spree_stock_locations, :active, :boolean, default: true 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904144945_add_backorderable_to_stock_item.spree.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree (originally 20130306195650) 2 | class AddBackorderableToStockItem < ActiveRecord::Migration[4.2] 3 | def change 4 | add_column :spree_stock_items, :backorderable, :boolean, default: true 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904144946_add_default_quantity_to_stock_movement.spree.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree (originally 20130307161754) 2 | class AddDefaultQuantityToStockMovement < ActiveRecord::Migration[4.2] 3 | def change 4 | change_column :spree_stock_movements, :quantity, :integer, default: 0 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904144947_add_source_and_destination_to_stock_movements.spree.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree (originally 20130318151756) 2 | class AddSourceAndDestinationToStockMovements < ActiveRecord::Migration[4.2] 3 | def change 4 | change_table :spree_stock_movements do |t| 5 | t.references :source, polymorphic: true 6 | t.references :destination, polymorphic: true 7 | end 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904144948_change_orders_total_precision.spree.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree (originally 20130319062004) 2 | class ChangeOrdersTotalPrecision < ActiveRecord::Migration[4.2] 3 | def change 4 | change_column :spree_orders, :item_total, :decimal, precision: 10, scale: 2, default: 0.0, null: false 5 | change_column :spree_orders, :total, :decimal, precision: 10, scale: 2, default: 0.0, null: false 6 | change_column :spree_orders, :adjustment_total, :decimal, precision: 10, scale: 2, default: 0.0, null: false 7 | change_column :spree_orders, :payment_total, :decimal, precision: 10, scale: 2, default: 0.0 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904144949_change_spree_payments_amount_precision.spree.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree (originally 20130319063911) 2 | class ChangeSpreePaymentsAmountPrecision < ActiveRecord::Migration[4.2] 3 | def change 4 | 5 | change_column :spree_payments, :amount, :decimal, precision: 10, scale: 2, default: 0.0, null: false 6 | 7 | end 8 | end 9 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904144950_change_spree_return_authorization_amount_precision.spree.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree (originally 20130319064308) 2 | class ChangeSpreeReturnAuthorizationAmountPrecision < ActiveRecord::Migration[4.2] 3 | def change 4 | 5 | change_column :spree_return_authorizations, :amount, :decimal, precision: 10, scale: 2, default: 0.0, null: false 6 | 7 | end 8 | end 9 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904144951_change_adjustments_amount_precision.spree.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree (originally 20130319082943) 2 | class ChangeAdjustmentsAmountPrecision < ActiveRecord::Migration[4.2] 3 | def change 4 | 5 | change_column :spree_adjustments, :amount, :decimal, precision: 10, scale: 2 6 | 7 | end 8 | end 9 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904144952_add_originator_to_stock_movement.spree.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree (originally 20130319183250) 2 | class AddOriginatorToStockMovement < ActiveRecord::Migration[4.2] 3 | def change 4 | change_table :spree_stock_movements do |t| 5 | t.references :originator, polymorphic: true 6 | end 7 | end 8 | end 9 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904144953_drop_source_and_destination_from_stock_movement.spree.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree (originally 20130319190507) 2 | class DropSourceAndDestinationFromStockMovement < ActiveRecord::Migration[4.2] 3 | def up 4 | change_table :spree_stock_movements do |t| 5 | t.remove_references :source, polymorphic: true 6 | t.remove_references :destination, polymorphic: true 7 | end 8 | end 9 | 10 | def down 11 | change_table :spree_stock_movements do |t| 12 | t.references :source, polymorphic: true 13 | t.references :destination, polymorphic: true 14 | end 15 | end 16 | end 17 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904144954_migrate_inventory_unit_sold_to_on_hand.spree.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree (originally 20130325163316) 2 | class MigrateInventoryUnitSoldToOnHand < ActiveRecord::Migration[4.2] 3 | def up 4 | Spree::InventoryUnit.where(state: 'sold').update_all(state: 'on_hand') 5 | end 6 | 7 | def down 8 | Spree::InventoryUnit.where(state: 'on_hand').update_all(state: 'sold') 9 | end 10 | end 11 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904144955_add_stock_location_to_rma.spree.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree (originally 20130326175857) 2 | class AddStockLocationToRma < ActiveRecord::Migration[4.2] 3 | def change 4 | add_column :spree_return_authorizations, :stock_location_id, :integer 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904144956_update_shipment_state_for_canceled_orders.spree.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree (originally 20130328130308) 2 | class UpdateShipmentStateForCanceledOrders < ActiveRecord::Migration[4.2] 3 | def up 4 | shipments = Spree::Shipment.joins(:order). 5 | where("spree_orders.state = 'canceled'") 6 | case Spree::Shipment.connection.adapter_name 7 | when "SQLite3" 8 | shipments.update_all("state = 'cancelled'") 9 | when "MySQL" || "PostgreSQL" 10 | shipments.update_all("spree_shipments.state = 'cancelled'") 11 | end 12 | end 13 | 14 | def down 15 | end 16 | end 17 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904144957_add_seo_metas_to_taxons.spree.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree (originally 20130328195253) 2 | class AddSeoMetasToTaxons < ActiveRecord::Migration[4.2] 3 | def change 4 | change_table :spree_taxons do |t| 5 | t.string :meta_title 6 | t.string :meta_description 7 | t.string :meta_keywords 8 | end 9 | end 10 | end 11 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904144958_remove_stock_item_and_variant_lock.spree.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree (originally 20130329134939) 2 | class RemoveStockItemAndVariantLock < ActiveRecord::Migration[4.2] 3 | def up 4 | # we are moving to pessimistic locking on stock_items 5 | remove_column :spree_stock_items, :lock_version 6 | 7 | # variants no longer manage their count_on_hand so we are removing their lock 8 | remove_column :spree_variants, :lock_version 9 | end 10 | 11 | def down 12 | add_column :spree_stock_items, :lock_version, :integer 13 | add_column :spree_variants, :lock_version, :integer 14 | end 15 | end 16 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904144959_add_name_to_spree_credit_cards.spree.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree (originally 20130413230529) 2 | class AddNameToSpreeCreditCards < ActiveRecord::Migration[4.2] 3 | def change 4 | add_column :spree_credit_cards, :name, :string 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904144960_update_name_fields_on_spree_credit_cards.spree.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree (originally 20130414000512) 2 | class UpdateNameFieldsOnSpreeCreditCards < ActiveRecord::Migration[4.2] 3 | def up 4 | if ApplicationRecord.connection.adapter_name.downcase.include? "mysql" 5 | execute "UPDATE spree_credit_cards SET name = CONCAT(first_name, ' ', last_name)" 6 | else 7 | execute "UPDATE spree_credit_cards SET name = first_name || ' ' || last_name" 8 | end 9 | end 10 | 11 | def down 12 | execute "UPDATE spree_credit_cards SET name = NULL" 13 | end 14 | end 15 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904144961_add_index_to_source_columns_on_adjustments.spree.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree (originally 20130417120034) 2 | class AddIndexToSourceColumnsOnAdjustments < ActiveRecord::Migration[4.2] 3 | def change 4 | add_index :spree_adjustments, [:source_type, :source_id] 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904144962_update_adjustment_states.spree.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree (originally 20130417120035) 2 | class UpdateAdjustmentStates < ActiveRecord::Migration[4.2] 3 | def up 4 | Spree::Order.complete.find_each do |order| 5 | order.adjustments.update_all(state: 'closed') 6 | end 7 | 8 | Spree::Shipment.shipped.includes(:adjustment).find_each do |shipment| 9 | shipment.adjustment.update_column(:state, 'finalized') if shipment.adjustment 10 | end 11 | 12 | Spree::Adjustment.where(state: nil).update_all(state: 'open') 13 | end 14 | 15 | def down 16 | end 17 | end 18 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904144963_add_shipping_rates_to_shipments.spree.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree (originally 20130417123427) 2 | class AddShippingRatesToShipments < ActiveRecord::Migration[4.2] 3 | def up 4 | Spree::Shipment.find_each do |shipment| 5 | shipment.shipping_rates.create(shipping_method_id: shipment.shipping_method_id, 6 | cost: shipment.cost, 7 | selected: true) 8 | end 9 | 10 | remove_column :spree_shipments, :shipping_method_id 11 | end 12 | 13 | def down 14 | add_column :spree_shipments, :shipping_method_id, :integer 15 | end 16 | end 17 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904144964_create_spree_stock_transfers.spree.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree (originally 20130418125341) 2 | class CreateSpreeStockTransfers < ActiveRecord::Migration[4.2] 3 | def change 4 | create_table :spree_stock_transfers do |t| 5 | t.string :type 6 | t.string :reference_number 7 | t.integer :source_location_id 8 | t.integer :destination_location_id 9 | t.timestamps null: false, precision: 6 10 | end 11 | 12 | add_index :spree_stock_transfers, :source_location_id 13 | add_index :spree_stock_transfers, :destination_location_id 14 | end 15 | end 16 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904144965_drop_products_count_on_hand.spree.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree (originally 20130423110707) 2 | class DropProductsCountOnHand < ActiveRecord::Migration[4.2] 3 | def up 4 | remove_column :spree_products, :count_on_hand 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904144966_set_default_shipping_rate_cost.spree.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree (originally 20130423223847) 2 | class SetDefaultShippingRateCost < ActiveRecord::Migration[4.2] 3 | def change 4 | change_column :spree_shipping_rates, :cost, :decimal, default: 0, precision: 8, scale: 2 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904144968_add_sku_index_to_spree_variants.spree.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree (originally 20130514151929) 2 | class AddSkuIndexToSpreeVariants < ActiveRecord::Migration[4.2] 3 | def change 4 | add_index :spree_variants, :sku 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904144969_add_backorderable_default_to_spree_stock_location.spree.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree (originally 20130515180736) 2 | class AddBackorderableDefaultToSpreeStockLocation < ActiveRecord::Migration[4.2] 3 | def change 4 | add_column :spree_stock_locations, :backorderable_default, :boolean, default: true 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904144970_add_propage_all_variants_to_spree_stock_location.spree.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree (originally 20130516151222) 2 | class AddPropageAllVariantsToSpreeStockLocation < ActiveRecord::Migration[4.2] 3 | def change 4 | add_column :spree_stock_locations, :propagate_all_variants, :boolean, default: true 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904144971_rename_shipping_methods_zones_to_spree_shipping_methods_zones.spree.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree (originally 20130611054351) 2 | class RenameShippingMethodsZonesToSpreeShippingMethodsZones < ActiveRecord::Migration[4.2] 3 | def change 4 | rename_table :shipping_methods_zones, :spree_shipping_methods_zones 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904144972_add_user_id_index_to_spree_orders.spree.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree (originally 20130611185927) 2 | class AddUserIdIndexToSpreeOrders < ActiveRecord::Migration[4.2] 3 | def change 4 | add_index :spree_orders, :user_id 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904144973_add_updated_at_to_spree_countries.spree.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree (originally 20130618041418) 2 | class AddUpdatedAtToSpreeCountries < ActiveRecord::Migration[4.2] 3 | def up 4 | add_column :spree_countries, :updated_at, :datetime 5 | end 6 | 7 | def down 8 | remove_column :spree_countries, :updated_at 9 | end 10 | end 11 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904144974_add_updated_at_to_spree_states.spree.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree (originally 20130619012236) 2 | class AddUpdatedAtToSpreeStates < ActiveRecord::Migration[4.2] 3 | def up 4 | add_column :spree_states, :updated_at, :datetime 5 | end 6 | 7 | def down 8 | remove_column :spree_states, :updated_at 9 | end 10 | end 11 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904144975_add_cvv_result_code_and_cvv_result_message_to_spree_payments.spree.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree (originally 20130626232741) 2 | class AddCvvResultCodeAndCvvResultMessageToSpreePayments < ActiveRecord::Migration[4.2] 3 | def change 4 | add_column :spree_payments, :cvv_response_code, :string 5 | add_column :spree_payments, :cvv_response_message, :string 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904144976_add_unique_index_to_permalink_on_spree_products.spree.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree (originally 20130628021056) 2 | class AddUniqueIndexToPermalinkOnSpreeProducts < ActiveRecord::Migration[4.2] 3 | def change 4 | add_index "spree_products", ["permalink"], name: "permalink_idx_unique", unique: true 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904144977_add_unique_index_to_orders_shipments_and_stock_transfers.spree.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree (originally 20130628022817) 2 | class AddUniqueIndexToOrdersShipmentsAndStockTransfers < ActiveRecord::Migration[4.2] 3 | def add 4 | add_index "spree_orders", ["number"], name: "number_idx_unique", unique: true 5 | add_index "spree_shipments", ["number"], name: "number_idx_unique", unique: true 6 | add_index "spree_stock_transfers", ["number"], name: "number_idx_unique", unique: true 7 | end 8 | end 9 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904144978_add_deleted_at_to_spree_tax_rates.spree.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree (originally 20130708052307) 2 | class AddDeletedAtToSpreeTaxRates < ActiveRecord::Migration[4.2] 3 | def change 4 | add_column :spree_tax_rates, :deleted_at, :datetime 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904144979_remove_lock_version_from_inventory_units.spree.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree (originally 20130711200933) 2 | class RemoveLockVersionFromInventoryUnits < ActiveRecord::Migration[4.2] 3 | def change 4 | # we are moving to pessimistic locking on stock_items 5 | remove_column :spree_inventory_units, :lock_version 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904144980_add_cost_price_to_line_item.spree.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree (originally 20130718042445) 2 | class AddCostPriceToLineItem < ActiveRecord::Migration[4.2] 3 | def change 4 | add_column :spree_line_items, :cost_price, :decimal, precision: 8, scale: 2 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904144981_set_backorderable_to_default_to_false.spree.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree (originally 20130718233855) 2 | class SetBackorderableToDefaultToFalse < ActiveRecord::Migration[4.2] 3 | def change 4 | change_column :spree_stock_items, :backorderable, :boolean, default: false 5 | change_column :spree_stock_locations, :backorderable_default, :boolean, default: false 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904144982_add_created_by_id_to_spree_orders.spree.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree (originally 20130725031716) 2 | class AddCreatedByIdToSpreeOrders < ActiveRecord::Migration[4.2] 3 | def change 4 | add_column :spree_orders, :created_by_id, :integer 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904144983_index_completed_at_on_spree_orders.spree.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree (originally 20130729214043) 2 | class IndexCompletedAtOnSpreeOrders < ActiveRecord::Migration[4.2] 3 | def change 4 | add_index :spree_orders, :completed_at 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904144984_add_tax_category_id_to_spree_line_items.spree.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree (originally 20130802014537) 2 | class AddTaxCategoryIdToSpreeLineItems < ActiveRecord::Migration[4.2] 3 | def change 4 | add_column :spree_line_items, :tax_category_id, :integer 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904144985_migrate_tax_categories_to_line_items.spree.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree (originally 20130802022321) 2 | class MigrateTaxCategoriesToLineItems < ActiveRecord::Migration[4.2] 3 | def change 4 | Spree::LineItem.find_each do |line_item| 5 | next if line_item.variant.nil? 6 | next if line_item.variant.product.nil? 7 | next if line_item.product.nil? 8 | line_item.update_column(:tax_category_id, line_item.product.tax_category_id) 9 | end 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904144986_drop_spree_mail_methods.spree.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree (originally 20130806022521) 2 | class DropSpreeMailMethods < ActiveRecord::Migration[4.2] 3 | def up 4 | drop_table :spree_mail_methods 5 | end 6 | 7 | def down 8 | create_table(:spree_mail_methods) do |t| 9 | t.string :environment 10 | t.boolean :active 11 | end 12 | end 13 | end 14 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904144987_set_default_stock_location_on_shipments.spree.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree (originally 20130806145853) 2 | class SetDefaultStockLocationOnShipments < ActiveRecord::Migration[4.2] 3 | def change 4 | if Spree::Shipment.where('stock_location_id IS NULL').count > 0 5 | location = Spree::StockLocation.find_by(name: 'default') || Spree::StockLocation.first 6 | Spree::Shipment.where('stock_location_id IS NULL').update_all(stock_location_id: location.id) 7 | end 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904144990_add_admin_name_column_to_spree_shipping_methods.spree.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree (originally 20130809164245) 2 | class AddAdminNameColumnToSpreeShippingMethods < ActiveRecord::Migration[4.2] 3 | def change 4 | add_column :spree_shipping_methods, :admin_name, :string 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904144991_add_admin_name_column_to_spree_stock_locations.spree.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree (originally 20130809164330) 2 | class AddAdminNameColumnToSpreeStockLocations < ActiveRecord::Migration[4.2] 3 | def change 4 | add_column :spree_stock_locations, :admin_name, :string 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904144992_add_shipment_total_to_spree_orders.spree.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree (originally 20130813004002) 2 | class AddShipmentTotalToSpreeOrders < ActiveRecord::Migration[4.2] 3 | def change 4 | add_column :spree_orders, :shipment_total, :decimal, precision: 10, scale: 2, default: 0.0, null: false 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904144993_expand_order_number_size.spree.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree (originally 20130813140619) 2 | class ExpandOrderNumberSize < ActiveRecord::Migration[4.2] 3 | def up 4 | change_column :spree_orders, :number, :string, limit: 32 5 | end 6 | 7 | def down 8 | change_column :spree_orders, :number, :string, limit: 15 9 | end 10 | end 11 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904144994_rename_activators_to_promotions.spree.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree (originally 20130813232134) 2 | class RenameActivatorsToPromotions < ActiveRecord::Migration[4.2] 3 | def change 4 | rename_table :spree_activators, :spree_promotions 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904144995_add_adjustment_total_to_line_items.spree.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree (originally 20130815000406) 2 | class AddAdjustmentTotalToLineItems < ActiveRecord::Migration[4.2] 3 | def change 4 | add_column :spree_line_items, :adjustment_total, :decimal, precision: 10, scale: 2, default: 0.0 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904144996_add_adjustment_total_to_shipments.spree.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree (originally 20130815024413) 2 | class AddAdjustmentTotalToShipments < ActiveRecord::Migration[4.2] 3 | def change 4 | add_column :spree_shipments, :adjustment_total, :decimal, precision: 10, scale: 2, default: 0.0 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904144997_add_depth_to_spree_taxons.spree.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree (originally 20130826062534) 2 | class AddDepthToSpreeTaxons < ActiveRecord::Migration[4.2] 3 | def up 4 | if !Spree::Taxon.column_names.include?('depth') 5 | add_column :spree_taxons, :depth, :integer 6 | 7 | say_with_time 'Update depth on all taxons' do 8 | Spree::Taxon.reset_column_information 9 | Spree::Taxon.all.each { |t| t.save } 10 | end 11 | end 12 | end 13 | 14 | def down 15 | remove_column :spree_taxons, :depth 16 | end 17 | end 18 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904144998_add_tax_total_to_line_items_shipments_and_orders.spree.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree (originally 20130828234942) 2 | class AddTaxTotalToLineItemsShipmentsAndOrders < ActiveRecord::Migration[4.2] 3 | def change 4 | add_column :spree_line_items, :tax_total, :decimal, precision: 10, scale: 2, default: 0.0 5 | add_column :spree_shipments, :tax_total, :decimal, precision: 10, scale: 2, default: 0.0 6 | # This column may already be here from a 2.1.x migration 7 | add_column :spree_orders, :tax_total, :decimal, precision: 10, scale: 2, default: 0.0 unless column_exists? :spree_orders, :tax_total, :decimal 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904144999_add_shipping_category_to_shipping_methods_and_products.spree.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree (originally 20130830001033) 2 | class AddShippingCategoryToShippingMethodsAndProducts < ActiveRecord::Migration[4.2] 3 | def up 4 | default_category = Spree::ShippingCategory.first 5 | default_category ||= Spree::ShippingCategory.create!(name: "Default") 6 | 7 | Spree::ShippingMethod.all.each do |method| 8 | method.shipping_categories << default_category if method.shipping_categories.blank? 9 | end 10 | 11 | Spree::Product.where(shipping_category_id: nil).update_all(shipping_category_id: default_category.id) 12 | end 13 | 14 | def down 15 | end 16 | end 17 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904145001_add_code_to_spree_promotion_rules.spree.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree (originally 20130903183026) 2 | class AddCodeToSpreePromotionRules < ActiveRecord::Migration[4.2] 3 | def change 4 | add_column :spree_promotion_rules, :code, :string 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904145002_change_states_required_for_countries.spree.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree (originally 20130909115621) 2 | class ChangeStatesRequiredForCountries < ActiveRecord::Migration[4.2] 3 | def up 4 | change_column_default :spree_countries, :states_required, false 5 | end 6 | 7 | def down 8 | change_column_default :spree_countries, :states_required, true 9 | end 10 | end 11 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904145003_add_deleted_at_to_spree_stock_items.spree.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree (originally 20130915032339) 2 | class AddDeletedAtToSpreeStockItems < ActiveRecord::Migration[4.2] 3 | def change 4 | add_column :spree_stock_items, :deleted_at, :datetime 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904145004_remove_promotions_event_name_field.spree.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree (originally 20130917024658) 2 | class RemovePromotionsEventNameField < ActiveRecord::Migration[4.2] 3 | def change 4 | remove_column :spree_promotions, :event_name, :string 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904145005_add_promo_total_to_line_items_and_shipments_and_orders.spree.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree (originally 20130924040529) 2 | class AddPromoTotalToLineItemsAndShipmentsAndOrders < ActiveRecord::Migration[4.2] 3 | def change 4 | add_column :spree_line_items, :promo_total, :decimal, precision: 10, scale: 2, default: 0.0 5 | add_column :spree_shipments, :promo_total, :decimal, precision: 10, scale: 2, default: 0.0 6 | add_column :spree_orders, :promo_total, :decimal, precision: 10, scale: 2, default: 0.0 7 | end 8 | end 9 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904145007_add_track_inventory_to_variant.spree.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree (originally 20131026154747) 2 | class AddTrackInventoryToVariant < ActiveRecord::Migration[4.2] 3 | def change 4 | add_column :spree_variants, :track_inventory, :boolean, default: true 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904145008_add_tax_category_to_variants.spree.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree (originally 20131107132123) 2 | class AddTaxCategoryToVariants < ActiveRecord::Migration[4.2] 3 | def change 4 | add_column :spree_variants, :tax_category_id, :integer 5 | add_index :spree_variants, :tax_category_id 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904145009_add_channel_to_spree_orders.spree.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree (originally 20131113035136) 2 | class AddChannelToSpreeOrders < ActiveRecord::Migration[4.2] 3 | def change 4 | add_column :spree_orders, :channel, :string, default: "spree" 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904145010_add_included_to_adjustments.spree.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree (originally 20131118043959) 2 | class AddIncludedToAdjustments < ActiveRecord::Migration[4.2] 3 | def change 4 | add_column :spree_adjustments, :included, :boolean, default: false unless Spree::Adjustment.column_names.include?("included") 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904145013_add_updated_at_to_variants.spree.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree (originally 20131120234456) 2 | class AddUpdatedAtToVariants < ActiveRecord::Migration[4.2] 3 | def change 4 | add_column :spree_variants, :updated_at, :datetime 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904145014_add_position_to_classifications.spree.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree (originally 20131127001002) 2 | class AddPositionToClassifications < ActiveRecord::Migration[4.2] 3 | def change 4 | add_column :spree_products_taxons, :position, :integer 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904145015_create_spree_orders_promotions.spree.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree (originally 20131211112807) 2 | class CreateSpreeOrdersPromotions < ActiveRecord::Migration[4.2] 3 | def change 4 | create_table :spree_orders_promotions, id: false do |t| 5 | t.references :order 6 | t.references :promotion 7 | end 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904145017_add_item_count_to_spree_orders.spree.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree (originally 20131218054603) 2 | class AddItemCountToSpreeOrders < ActiveRecord::Migration[4.2] 3 | def change 4 | add_column :spree_orders, :item_count, :integer, default: 0 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904145018_remove_value_type_from_spree_preferences.spree.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree (originally 20140106065820) 2 | class RemoveValueTypeFromSpreePreferences < ActiveRecord::Migration[4.2] 3 | def up 4 | remove_column :spree_preferences, :value_type 5 | end 6 | def down 7 | raise ActiveRecord::IrreversableMigration 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904145019_rename_permalink_to_slug_for_products.spree.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree (originally 20140106224208) 2 | class RenamePermalinkToSlugForProducts < ActiveRecord::Migration[4.2] 3 | def change 4 | rename_column :spree_products, :permalink, :slug 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904145020_add_index_to_variant_id_and_currency_on_prices.spree.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree (originally 20140120160805) 2 | class AddIndexToVariantIdAndCurrencyOnPrices < ActiveRecord::Migration[4.2] 3 | def change 4 | add_index :spree_prices, [:variant_id, :currency] 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904145021_rename_activator_id_in_rules_and_actions_to_promotion_id.spree.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree (originally 20140124023232) 2 | class RenameActivatorIdInRulesAndActionsToPromotionId < ActiveRecord::Migration[4.2] 3 | def change 4 | rename_column :spree_promotion_rules, :activator_id, :promotion_id 5 | rename_column :spree_promotion_actions, :activator_id, :promotion_id 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904145022_add_deleted_at_to_spree_prices.spree.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree (originally 20140129024326) 2 | class AddDeletedAtToSpreePrices < ActiveRecord::Migration[4.2] 3 | def change 4 | add_column :spree_prices, :deleted_at, :datetime 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904145023_add_approver_id_and_approved_at_to_orders.spree.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree (originally 20140203161722) 2 | class AddApproverIdAndApprovedAtToOrders < ActiveRecord::Migration[4.2] 3 | def change 4 | add_column :spree_orders, :approver_id, :integer 5 | add_column :spree_orders, :approved_at, :datetime 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904145024_add_confirmation_delivered_to_spree_orders.spree.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree (originally 20140204115338) 2 | class AddConfirmationDeliveredToSpreeOrders < ActiveRecord::Migration[4.2] 3 | def change 4 | add_column :spree_orders, :confirmation_delivered, :boolean, default: false 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904145025_add_auto_capture_to_payment_methods.spree.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree (originally 20140204192230) 2 | class AddAutoCaptureToPaymentMethods < ActiveRecord::Migration[4.2] 3 | def change 4 | add_column :spree_payment_methods, :auto_capture, :boolean 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904145026_create_spree_payment_capture_events.spree.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree (originally 20140205120320) 2 | class CreateSpreePaymentCaptureEvents < ActiveRecord::Migration[4.2] 3 | def change 4 | create_table :spree_payment_capture_events do |t| 5 | t.decimal :amount, precision: 10, scale: 2, default: 0.0 6 | t.integer :payment_id 7 | 8 | t.timestamps null: false, precision: 6 9 | end 10 | 11 | add_index :spree_payment_capture_events, :payment_id 12 | end 13 | end 14 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904145027_add_uncaptured_amount_to_payments.spree.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree (originally 20140205144710) 2 | class AddUncapturedAmountToPayments < ActiveRecord::Migration[4.2] 3 | def change 4 | add_column :spree_payments, :uncaptured_amount, :decimal, precision: 10, scale: 2, default: 0.0 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904145028_default_variant_weight_to_zero.spree.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree (originally 20140205181631) 2 | class DefaultVariantWeightToZero < ActiveRecord::Migration[4.2] 3 | def up 4 | Spree::Variant.unscoped.where(weight: nil).update_all("weight = 0.0") 5 | 6 | change_column :spree_variants, :weight, :decimal, precision: 8, scale: 2, default: 0.0 7 | end 8 | 9 | def down 10 | change_column :spree_variants, :weight, :decimal, precision: 8, scale: 2 11 | end 12 | end 13 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904145029_add_tax_category_id_to_shipping_methods.spree.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree (originally 20140207085910) 2 | class AddTaxCategoryIdToShippingMethods < ActiveRecord::Migration[4.2] 3 | def change 4 | add_column :spree_shipping_methods, :tax_category_id, :integer 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904145030_add_tax_rate_id_to_shipping_rates.spree.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree (originally 20140207093021) 2 | class AddTaxRateIdToShippingRates < ActiveRecord::Migration[4.2] 3 | def change 4 | add_column :spree_shipping_rates, :tax_rate_id, :integer 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904145031_add_pre_tax_amount_to_line_items_and_shipments.spree.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree (originally 20140211040159) 2 | class AddPreTaxAmountToLineItemsAndShipments < ActiveRecord::Migration[4.2] 3 | def change 4 | add_column :spree_line_items, :pre_tax_amount, :decimal, precision: 8, scale: 2 5 | add_column :spree_shipments, :pre_tax_amount, :decimal, precision: 8, scale: 2 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904145032_add_more_indexes.spree.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree (originally 20140213184916) 2 | class AddMoreIndexes < ActiveRecord::Migration[4.2] 3 | def change 4 | add_index :spree_payment_methods, [:id, :type] 5 | add_index :spree_calculators, [:id, :type] 6 | add_index :spree_calculators, [:calculable_id, :calculable_type] 7 | add_index :spree_payments, :payment_method_id 8 | add_index :spree_promotion_actions, [:id, :type] 9 | add_index :spree_promotion_actions, :promotion_id 10 | add_index :spree_promotions, [:id, :type] 11 | add_index :spree_option_values, :option_type_id 12 | add_index :spree_shipments, :stock_location_id 13 | end 14 | end 15 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904145033_add_considered_risky_to_orders.spree.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree (originally 20140219060952) 2 | class AddConsideredRiskyToOrders < ActiveRecord::Migration[4.2] 3 | def change 4 | add_column :spree_orders, :considered_risky, :boolean, default: false 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904145034_add_preference_store_to_everything.spree.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree (originally 20140227112348) 2 | class AddPreferenceStoreToEverything < ActiveRecord::Migration[4.2] 3 | def change 4 | add_column :spree_calculators, :preferences, :text 5 | add_column :spree_gateways, :preferences, :text 6 | add_column :spree_payment_methods, :preferences, :text 7 | add_column :spree_promotion_rules, :preferences, :text 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904145035_add_user_id_to_spree_credit_cards.spree.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree (originally 20140307235515) 2 | class AddUserIdToSpreeCreditCards < ActiveRecord::Migration[4.2] 3 | def change 4 | unless Spree::CreditCard.column_names.include? "user_id" 5 | add_column :spree_credit_cards, :user_id, :integer 6 | add_index :spree_credit_cards, :user_id 7 | end 8 | 9 | unless Spree::CreditCard.column_names.include? "payment_method_id" 10 | add_column :spree_credit_cards, :payment_method_id, :integer 11 | add_index :spree_credit_cards, :payment_method_id 12 | end 13 | end 14 | end 15 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904145039_add_timestamps_to_spree_assets.spree.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree (originally 20140315053743) 2 | class AddTimestampsToSpreeAssets < ActiveRecord::Migration[4.2] 3 | def change 4 | add_column :spree_assets, :created_at, :datetime 5 | add_column :spree_assets, :updated_at, :datetime 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904145040_create_spree_taxons_promotion_rules.spree.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree (originally 20140318191500) 2 | class CreateSpreeTaxonsPromotionRules < ActiveRecord::Migration[4.2] 3 | def change 4 | create_table :spree_taxons_promotion_rules do |t| 5 | t.references :taxon, index: true 6 | t.references :promotion_rule, index: true 7 | end 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904145041_add_additional_store_fields.spree.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree (originally 20140331100557) 2 | class AddAdditionalStoreFields < ActiveRecord::Migration[4.2] 3 | def change 4 | add_column :spree_stores, :code, :string unless column_exists?(:spree_stores, :code) 5 | add_column :spree_stores, :default, :boolean, default: false, null: false unless column_exists?(:spree_stores, :default) 6 | add_index :spree_stores, :code 7 | add_index :spree_stores, :default 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904145044_add_user_id_created_by_id_index_to_order.spree.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree (originally 20140415041315) 2 | class AddUserIdCreatedByIdIndexToOrder < ActiveRecord::Migration[4.2] 3 | def change 4 | add_index :spree_orders, [:user_id, :created_by_id] 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904145045_change_spree_price_amount_precision.spree.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree (originally 20140508151342) 2 | class ChangeSpreePriceAmountPrecision < ActiveRecord::Migration[4.2] 3 | def change 4 | change_column :spree_prices, :amount, :decimal, precision: 10, scale: 2 5 | change_column :spree_line_items, :price, :decimal, precision: 10, scale: 2 6 | change_column :spree_line_items, :cost_price, :decimal, precision: 10, scale: 2 7 | change_column :spree_variants, :cost_price, :decimal, precision: 10, scale: 2 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904145046_add_token_to_spree_orders.spree.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree (originally 20140518174634) 2 | class AddTokenToSpreeOrders < ActiveRecord::Migration[4.2] 3 | def change 4 | add_column :spree_orders, :guest_token, :string 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904145048_set_shipment_total_for_users_upgrading.spree.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree (originally 20140601011216) 2 | class SetShipmentTotalForUsersUpgrading < ActiveRecord::Migration[4.2] 3 | def up 4 | # NOTE You might not need this at all unless you're upgrading from Spree 2.1.x 5 | # or below. For those upgrading this should populate the Order#shipment_total 6 | # for legacy orders 7 | Spree::Order.complete.where('shipment_total = ?', 0).includes(:shipments).find_each do |order| 8 | order.update_column(:shipment_total, order.shipments.sum(:cost)) 9 | end 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904145049_drop_credit_card_first_name_and_last_name.spree.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree (originally 20140604135309) 2 | class DropCreditCardFirstNameAndLastName < ActiveRecord::Migration[4.2] 3 | def change 4 | remove_column :spree_credit_cards, :first_name, :string 5 | remove_column :spree_credit_cards, :last_name, :string 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904145050_add_deleted_at_to_spree_promotion_actions.spree.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree (originally 20140609201656) 2 | class AddDeletedAtToSpreePromotionActions < ActiveRecord::Migration[4.2] 3 | def change 4 | add_column :spree_promotion_actions, :deleted_at, :datetime 5 | add_index :spree_promotion_actions, :deleted_at 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904145051_remove_uncaptured_amount_from_spree_payments.spree.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree (originally 20140616202624) 2 | class RemoveUncapturedAmountFromSpreePayments < ActiveRecord::Migration[4.2] 3 | def change 4 | remove_column :spree_payments, :uncaptured_amount 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904145052_create_spree_refunds.spree.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree (originally 20140625214618) 2 | class CreateSpreeRefunds < ActiveRecord::Migration[4.2] 3 | def change 4 | create_table :spree_refunds do |t| 5 | t.integer :payment_id 6 | t.integer :return_authorization_id 7 | t.decimal :amount, precision: 10, scale: 2, default: 0.0, null: false 8 | t.string :transaction_id 9 | 10 | t.timestamps null: false, precision: 6 11 | end 12 | end 13 | end 14 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904145053_create_spree_return_authorization_inventory_unit.spree.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree (originally 20140702140656) 2 | class CreateSpreeReturnAuthorizationInventoryUnit < ActiveRecord::Migration[4.2] 3 | def change 4 | create_table :spree_return_authorization_inventory_units do |t| 5 | t.integer :return_authorization_id 6 | t.integer :inventory_unit_id 7 | t.integer :exchange_variant_id 8 | t.datetime :received_at 9 | 10 | t.timestamps null: false, precision: 6 11 | end 12 | end 13 | end 14 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904145054_rename_return_authorization_inventory_unit_to_return_items.spree.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree (originally 20140707125621) 2 | class RenameReturnAuthorizationInventoryUnitToReturnItems < ActiveRecord::Migration[4.2] 3 | def change 4 | rename_table :spree_return_authorization_inventory_units, :spree_return_items 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904145055_backfill_line_item_pre_tax_amount.spree.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree (originally 20140709160534) 2 | class BackfillLineItemPreTaxAmount < ActiveRecord::Migration[4.2] 3 | def change 4 | # set pre_tax_amount to discounted_amount - included_tax_total 5 | execute(<<-SQL) 6 | UPDATE spree_line_items 7 | SET pre_tax_amount = ((price * quantity) + promo_total) - included_tax_total 8 | WHERE pre_tax_amount IS NULL; 9 | SQL 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904145057_add_amount_fields_to_return_items.spree.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree (originally 20140710181204) 2 | class AddAmountFieldsToReturnItems < ActiveRecord::Migration[4.2] 3 | def change 4 | add_column :spree_return_items, :pre_tax_amount, :decimal, precision: 10, scale: 2, default: 0.0, null: false 5 | add_column :spree_return_items, :included_tax_total, :decimal, precision: 10, scale: 2, default: 0.0, null: false 6 | add_column :spree_return_items, :additional_tax_total, :decimal, precision: 10, scale: 2, default: 0.0, null: false 7 | end 8 | end 9 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904145058_drop_return_authorization_amount.spree.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree (originally 20140710190048) 2 | class DropReturnAuthorizationAmount < ActiveRecord::Migration[4.2] 3 | def change 4 | remove_column :spree_return_authorizations, :amount 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904145060_create_spree_refund_reasons.spree.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree (originally 20140713140527) 2 | class CreateSpreeRefundReasons < ActiveRecord::Migration[4.2] 3 | def change 4 | create_table :spree_refund_reasons do |t| 5 | t.string :name 6 | t.boolean :active, default: true 7 | t.boolean :mutable, default: true 8 | 9 | t.timestamps null: false, precision: 6 10 | end 11 | 12 | add_column :spree_refunds, :refund_reason_id, :integer 13 | add_index :spree_refunds, :refund_reason_id, name: 'index_refunds_on_refund_reason_id' 14 | end 15 | end 16 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904145061_rename_return_authorization_reason.spree.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree (originally 20140713142214) 2 | class RenameReturnAuthorizationReason < ActiveRecord::Migration[4.2] 3 | def change 4 | rename_column :spree_return_authorizations, :reason, :memo 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904145062_create_spree_promotion_categories.spree.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree (originally 20140715182625) 2 | class CreateSpreePromotionCategories < ActiveRecord::Migration[4.2] 3 | def change 4 | create_table :spree_promotion_categories do |t| 5 | t.string :name 6 | t.timestamps null: false, precision: 6 7 | end 8 | 9 | add_column :spree_promotions, :promotion_category_id, :integer 10 | add_index :spree_promotions, :promotion_category_id 11 | end 12 | end 13 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904145063_drop_received_at_on_return_items.spree.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree (originally 20140716204111) 2 | class DropReceivedAtOnReturnItems < ActiveRecord::Migration[4.2] 3 | def up 4 | remove_column :spree_return_items, :received_at 5 | end 6 | 7 | def down 8 | add_column :spree_return_items, :received_at, :datetime 9 | end 10 | end 11 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904145064_add_reception_and_acceptance_status_to_return_items.spree.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree (originally 20140716212330) 2 | class AddReceptionAndAcceptanceStatusToReturnItems < ActiveRecord::Migration[4.2] 3 | def change 4 | add_column :spree_return_items, :reception_status, :string 5 | add_column :spree_return_items, :acceptance_status, :string 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904145065_create_default_refund_reason.spree.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree (originally 20140717155155) 2 | class CreateDefaultRefundReason < ActiveRecord::Migration[4.2] 3 | def up 4 | Spree::RefundReason.create!(name: Spree::RefundReason::RETURN_PROCESSING_REASON, mutable: false) 5 | end 6 | 7 | def down 8 | Spree::RefundReason.find_by(name: Spree::RefundReason::RETURN_PROCESSING_REASON, mutable: false).destroy 9 | end 10 | end 11 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904145066_add_default_to_spree_stock_locations.spree.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree (originally 20140717185932) 2 | class AddDefaultToSpreeStockLocations < ActiveRecord::Migration[4.2] 3 | def change 4 | unless column_exists? :spree_stock_locations, :default 5 | add_column :spree_stock_locations, :default, :boolean, null: false, default: false 6 | end 7 | end 8 | end 9 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904145067_create_spree_customer_returns.spree.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree (originally 20140718133010) 2 | class CreateSpreeCustomerReturns < ActiveRecord::Migration[4.2] 3 | def change 4 | create_table :spree_customer_returns do |t| 5 | t.string :number 6 | t.integer :stock_location_id 7 | t.timestamps null: false, precision: 6 8 | end 9 | end 10 | end 11 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904145068_add_customer_return_id_to_return_item.spree.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree (originally 20140718133349) 2 | class AddCustomerReturnIdToReturnItem < ActiveRecord::Migration[4.2] 3 | def change 4 | add_column :spree_return_items, :customer_return_id, :integer 5 | add_index :spree_return_items, :customer_return_id, name: 'index_return_items_on_customer_return_id' 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904145070_rename_spree_refund_return_authorization_id.spree.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree (originally 20140723004419) 2 | class RenameSpreeRefundReturnAuthorizationId < ActiveRecord::Migration[4.2] 3 | def change 4 | rename_column :spree_refunds, :return_authorization_id, :customer_return_id 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904145074_add_promotionable_to_spree_products.spree.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree (originally 20140728225422) 2 | class AddPromotionableToSpreeProducts < ActiveRecord::Migration[4.2] 3 | def change 4 | add_column :spree_products, :promotionable, :boolean, default: true 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904145075_add_exchange_inventory_unit_foreign_keys.spree.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree (originally 20140729133613) 2 | class AddExchangeInventoryUnitForeignKeys < ActiveRecord::Migration[4.2] 3 | def change 4 | add_column :spree_return_items, :exchange_inventory_unit_id, :integer 5 | 6 | add_index :spree_return_items, :exchange_inventory_unit_id 7 | end 8 | end 9 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904145076_add_acceptance_status_errors_to_return_item.spree.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree (originally 20140730155938) 2 | class AddAcceptanceStatusErrorsToReturnItem < ActiveRecord::Migration[4.2] 3 | def change 4 | add_column :spree_return_items, :acceptance_status_errors, :text 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904145078_add_default_to_shipment_cost.spree.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree (originally 20140804185157) 2 | class AddDefaultToShipmentCost < ActiveRecord::Migration[4.2] 3 | def up 4 | change_column :spree_shipments, :cost, :decimal, precision: 10, scale: 2, default: 0.0 5 | Spree::Shipment.where(cost: nil).update_all(cost: 0) 6 | end 7 | 8 | def down 9 | change_column :spree_shipments, :cost, :decimal, precision: 10, scale: 2 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904145079_add_default_to_spree_credit_cards.spree.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree (originally 20140805171035) 2 | class AddDefaultToSpreeCreditCards < ActiveRecord::Migration[4.2] 3 | def change 4 | add_column :spree_credit_cards, :default, :boolean, null: false, default: false 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904145080_make_existing_credit_cards_default.spree.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree (originally 20140805171219) 2 | class MakeExistingCreditCardsDefault < ActiveRecord::Migration[4.2] 3 | def up 4 | # set the newest credit card for every user to be the default; SQL technique from 5 | # http://stackoverflow.com/questions/121387/fetch-the-row-which-has-the-max-value-for-a-column 6 | 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) 7 | end 8 | def down 9 | # do nothing 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904145081_add_type_to_reimbursement_type.spree.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree (originally 20140806144901) 2 | class AddTypeToReimbursementType < ActiveRecord::Migration[4.2] 3 | def change 4 | add_column :spree_reimbursement_types, :type, :string 5 | add_index :spree_reimbursement_types, :type 6 | 7 | Spree::ReimbursementType.reset_column_information 8 | Spree::ReimbursementType.find_by(name: Spree::ReimbursementType::ORIGINAL).update!(type: 'Spree::ReimbursementType::OriginalPayment') 9 | end 10 | end 11 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904145082_create_spree_reimbursement_credits.spree.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree (originally 20140808184039) 2 | class CreateSpreeReimbursementCredits < ActiveRecord::Migration[4.2] 3 | def change 4 | create_table :spree_reimbursement_credits do |t| 5 | t.decimal :amount, precision: 10, scale: 2, default: 0.0, null: false 6 | t.integer :reimbursement_id 7 | t.integer :creditable_id 8 | t.string :creditable_type 9 | end 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904145083_add_meta_title_to_spree_products.spree.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree (originally 20140827170513) 2 | class AddMetaTitleToSpreeProducts < ActiveRecord::Migration[4.2] 3 | def change 4 | change_table :spree_products do |t| 5 | t.string :meta_title 6 | end 7 | end 8 | end 9 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904145084_add_kind_to_zone.spree.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree (originally 20140911173301) 2 | class AddKindToZone < ActiveRecord::Migration[4.2] 3 | def change 4 | add_column :spree_zones, :kind, :string 5 | add_index :spree_zones, :kind 6 | 7 | Spree::Zone.find_each do |zone| 8 | last_type = zone.members.where.not(zoneable_type: nil).pluck(:zoneable_type).last 9 | zone.update_column :kind, last_type.demodulize.underscore if last_type 10 | end 11 | end 12 | end 13 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904145085_add_code_to_spree_tax_categories.spree.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree (originally 20140924164824) 2 | class AddCodeToSpreeTaxCategories < ActiveRecord::Migration[4.2] 3 | def change 4 | add_column :spree_tax_categories, :tax_code, :string 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904145086_default_pre_tax_amount_should_be_zero.spree.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree (originally 20140927193717) 2 | class DefaultPreTaxAmountShouldBeZero < ActiveRecord::Migration[4.2] 3 | def change 4 | change_column :spree_line_items, :pre_tax_amount, :decimal, precision: 8, scale: 2, default: 0 5 | change_column :spree_shipments, :pre_tax_amount, :decimal, precision: 8, scale: 2, default: 0 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904145087_add_code_to_spree_shipping_methods.spree.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree (originally 20141002191113) 2 | class AddCodeToSpreeShippingMethods < ActiveRecord::Migration[4.2] 3 | def change 4 | add_column :spree_shipping_methods, :code, :string 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904145088_add_cancel_audit_fields_to_spree_orders.spree.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree (originally 20141007230328) 2 | class AddCancelAuditFieldsToSpreeOrders < ActiveRecord::Migration[4.2] 3 | def change 4 | add_column :spree_orders, :canceled_at, :datetime 5 | add_column :spree_orders, :canceler_id, :integer 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904145089_add_store_id_to_orders.spree.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree (originally 20141009204607) 2 | class AddStoreIdToOrders < ActiveRecord::Migration[4.2] 3 | def change 4 | add_column :spree_orders, :store_id, :integer 5 | if Spree::Store.default.persisted? 6 | Spree::Order.where(store_id: nil).update_all(store_id: Spree::Store.default.id) 7 | end 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904145090_create_spree_taxons_prototypes.spree.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree (originally 20141012083513) 2 | class CreateSpreeTaxonsPrototypes < ActiveRecord::Migration[4.2] 3 | def change 4 | create_table :spree_taxons_prototypes do |t| 5 | t.belongs_to :taxon, index: true 6 | t.belongs_to :prototype, index: true 7 | end 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904145091_add_state_lock_version_to_order.spree.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree (originally 20141021194502) 2 | class AddStateLockVersionToOrder < ActiveRecord::Migration[4.2] 3 | def change 4 | add_column :spree_orders, :state_lock_version, :integer, default: 0, null: false 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904145092_add_counter_cache_from_spree_variants_to_spree_stock_items.spree.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree (originally 20141023005240) 2 | class AddCounterCacheFromSpreeVariantsToSpreeStockItems < ActiveRecord::Migration[4.2] 3 | # This was unnecessary and was removed 4 | def up 5 | end 6 | 7 | def down 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904145093_fix_adjustment_order_presence.spree.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree (originally 20141101231208) 2 | class FixAdjustmentOrderPresence < ActiveRecord::Migration[4.2] 3 | def change 4 | say 'Fixing adjustments without direct order reference' 5 | Spree::Adjustment.where(order: nil).find_each do |adjustment| 6 | adjustable = adjustment.adjustable 7 | if adjustable.is_a? Spree::Order 8 | adjustment.update!(order_id: adjustable.id) 9 | else 10 | adjustment.update!(adjustable: adjustable.order) 11 | end 12 | end 13 | end 14 | end 15 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904145094_update_classifications_positions.spree.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree (originally 20141105213646) 2 | class UpdateClassificationsPositions < ActiveRecord::Migration[4.2] 3 | def up 4 | Spree::Taxon.all.each do |taxon| 5 | taxon.classifications.each_with_index do |c12n, i| 6 | c12n.set_list_position(i + 1) 7 | end 8 | end 9 | end 10 | end 11 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904145095_add_guest_token_index_to_spree_orders.spree.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree (originally 20141120135441) 2 | class AddGuestTokenIndexToSpreeOrders < ActiveRecord::Migration[4.2] 3 | def change 4 | add_index :spree_orders, :guest_token 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904145096_remove_token_permissions_table.spree.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree (originally 20141215232040) 2 | class RemoveTokenPermissionsTable < ActiveRecord::Migration[4.2] 3 | def change 4 | # The MoveOrderTokenFromTokenizedPermission migration never dropped this. 5 | drop_table :spree_tokenized_permissions 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904145097_remove_extra_products_slug_index.spree.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree (originally 20141215235502) 2 | class RemoveExtraProductsSlugIndex < ActiveRecord::Migration[4.2] 3 | def change 4 | remove_index :spree_products, name: :permalink_idx_unique 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904145098_update_product_slug_index.spree.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree (originally 20141217215630) 2 | class UpdateProductSlugIndex < ActiveRecord::Migration[4.2] 3 | def change 4 | remove_index :spree_products, :slug if index_exists?(:spree_products, :slug) 5 | add_index :spree_products, :slug, unique: true 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904145099_rename_identifier_to_number_for_payment.spree.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree (originally 20141218025915) 2 | class RenameIdentifierToNumberForPayment < ActiveRecord::Migration[4.2] 3 | def change 4 | rename_column :spree_payments, :identifier, :number 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904145101_create_spree_store_credit_categories.spree.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree (originally 20150118211500) 2 | class CreateSpreeStoreCreditCategories < ActiveRecord::Migration[4.2] 3 | def change 4 | create_table :spree_store_credit_categories do |t| 5 | t.string :name 6 | t.timestamps null: false, precision: 6 7 | end 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904145103_create_spree_store_credit_types.spree.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree (originally 20150118212101) 2 | class CreateSpreeStoreCreditTypes < ActiveRecord::Migration[4.2] 3 | def change 4 | create_table :spree_store_credit_types do |t| 5 | t.string :name 6 | t.integer :priority 7 | t.timestamps null: false, precision: 6 8 | end 9 | add_index :spree_store_credit_types, :priority 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904145104_remove_environment_from_payment_method.spree.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree (originally 20150121022521) 2 | class RemoveEnvironmentFromPaymentMethod < ActiveRecord::Migration[4.2] 3 | def up 4 | Spree::PaymentMethod.where('environment != ?', Rails.env).update_all(active: false) 5 | remove_column :spree_payment_methods, :environment 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904145105_add_resellable_to_return_items.spree.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree (originally 20150122145607) 2 | class AddResellableToReturnItems < ActiveRecord::Migration[4.2] 3 | def change 4 | add_column :spree_return_items, :resellable, :boolean, default: true, null: false 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904145106_add_code_to_spree_promotion_categories.spree.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree (originally 20150122202432) 2 | class AddCodeToSpreePromotionCategories < ActiveRecord::Migration[4.2] 3 | def change 4 | add_column :spree_promotion_categories, :code, :string 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904145107_remove_environment_from_tracker.spree.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree (originally 20150128032538) 2 | class RemoveEnvironmentFromTracker < ActiveRecord::Migration[4.2] 3 | class Spree::Tracker < Spree::Base; end 4 | 5 | def up 6 | Spree::Tracker.where('environment != ?', Rails.env).update_all(active: false) 7 | remove_column :spree_trackers, :environment 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904145108_remove_spree_configurations.spree.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree (originally 20150128060325) 2 | class RemoveSpreeConfigurations < ActiveRecord::Migration[4.2] 3 | def up 4 | drop_table "spree_configurations" 5 | end 6 | 7 | def down 8 | create_table "spree_configurations", force: true do |t| 9 | t.string "name" 10 | t.string "type", limit: 50 11 | t.datetime "created_at" 12 | t.datetime "updated_at" 13 | end 14 | 15 | add_index "spree_configurations", ["name", "type"], name: "index_spree_configurations_on_name_and_type" 16 | end 17 | end 18 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904145109_add_index_to_spree_stock_items_variant_id.spree.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree (originally 20150216173445) 2 | class AddIndexToSpreeStockItemsVariantId < ActiveRecord::Migration[4.2] 3 | def up 4 | unless index_exists? :spree_stock_items, :variant_id 5 | add_index :spree_stock_items, :variant_id 6 | end 7 | end 8 | 9 | def down 10 | if index_exists? :spree_stock_items, :variant_id 11 | remove_index :spree_stock_items, :variant_id 12 | end 13 | end 14 | end 15 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904145110_ensure_payments_have_numbers.spree.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree (originally 20150309161154) 2 | class EnsurePaymentsHaveNumbers < ActiveRecord::Migration[4.2] 3 | def change 4 | add_index :spree_payments, :number unless index_exists?(:spree_payments, :number) 5 | Spree::Payment.where(number: nil).find_each do |payment| 6 | begin 7 | payment.save! # to generate a new number we need to save the record 8 | rescue ActiveRecord::RecordNotSaved 9 | Rails.logger.error("Payment with ID = #{payment.id} couldn't be saved") 10 | Rails.logger.error(payment.errors.full_messages.to_sentence) 11 | end 12 | end 13 | end 14 | end 15 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904145113_remove_user_index_from_spree_state_changes.spree.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree (originally 20150324104002) 2 | class RemoveUserIndexFromSpreeStateChanges < ActiveRecord::Migration[4.2] 3 | def up 4 | if index_exists? :spree_state_changes, :user_id 5 | remove_index :spree_state_changes, :user_id 6 | end 7 | 8 | end 9 | 10 | def down 11 | unless index_exists? :spree_state_changes, :user_id 12 | add_index :spree_state_changes, :user_id 13 | end 14 | end 15 | end 16 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904145115_add_position_to_spree_payment_methods.spree.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree (originally 20150522071831) 2 | class AddPositionToSpreePaymentMethods < ActiveRecord::Migration[4.2] 3 | def change 4 | add_column :spree_payment_methods, :position, :integer, default: 0 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904145116_add_deleted_at_to_friendly_id_slugs.spree.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree (originally 20150522181728) 2 | class AddDeletedAtToFriendlyIdSlugs < ActiveRecord::Migration[4.2] 3 | def change 4 | add_column :friendly_id_slugs, :deleted_at, :datetime 5 | add_index :friendly_id_slugs, :deleted_at 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904145119_migrate_payment_methods_display.spree.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree (originally 20150627090949) 2 | class MigratePaymentMethodsDisplay < ActiveRecord::Migration[4.2] 3 | def change 4 | Spree::PaymentMethod.all.each do |method| 5 | if method.display_on.blank? 6 | method.display_on = "both" 7 | method.save 8 | end 9 | end 10 | 11 | change_column :spree_payment_methods, :display_on, :string, default: "both" 12 | end 13 | end 14 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904145120_enable_acts_as_paranoid_on_calculators.spree.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree (originally 20150707204155) 2 | class EnableActsAsParanoidOnCalculators < ActiveRecord::Migration[4.2] 3 | def change 4 | add_column :spree_calculators, :deleted_at, :datetime 5 | add_index :spree_calculators, :deleted_at 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904145121_spree_payment_method_store_credits.spree.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree (originally 20150714154102) 2 | class SpreePaymentMethodStoreCredits < ActiveRecord::Migration[4.2] 3 | def up 4 | # Reload to pick up new position column for acts_as_list 5 | Spree::PaymentMethod.reset_column_information 6 | Spree::PaymentMethod::StoreCredit.find_or_create_by(name: 'Store Credit', description: 'Store Credit', 7 | active: true, display_on: 'back_end') 8 | end 9 | 10 | def down 11 | Spree::PaymentMethod.find_by(type: 'Spree::PaymentMethod::StoreCredit', name: 'Store Credit').try(&:destroy) 12 | end 13 | end 14 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904145123_spree_store_credit_types.spree.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree (originally 20150727191614) 2 | class SpreeStoreCreditTypes < ActiveRecord::Migration[4.2] 3 | def up 4 | Spree::StoreCreditType.find_or_create_by(name: 'Expiring', priority: 1) 5 | Spree::StoreCreditType.find_or_create_by(name: 'Non-expiring', priority: 2) 6 | end 7 | 8 | def down 9 | Spree::StoreCreditType.find_by(name: 'Expiring').try(&:destroy) 10 | Spree::StoreCreditType.find_by(name: 'Non-expiring').try(&:destroy) 11 | end 12 | end 13 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904145125_remove_shipping_method_id_from_spree_orders.spree.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree (originally 20151220072838) 2 | class RemoveShippingMethodIdFromSpreeOrders < ActiveRecord::Migration[4.2] 3 | def up 4 | if column_exists?(:spree_orders, :shipping_method_id, :integer) 5 | remove_column :spree_orders, :shipping_method_id, :integer 6 | end 7 | end 8 | 9 | def down 10 | unless column_exists?(:spree_orders, :shipping_method_id, :integer) 11 | add_column :spree_orders, :shipping_method_id, :integer 12 | end 13 | end 14 | end 15 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904145127_add_indexes.spree.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree (originally 20160219165458) 2 | class AddIndexes < ActiveRecord::Migration[4.2] 3 | def change 4 | add_index :spree_assets, :position 5 | add_index :spree_option_types, :name 6 | add_index :spree_option_values, :name 7 | add_index :spree_prices, :variant_id 8 | add_index :spree_properties, :name 9 | add_index :spree_roles, :name 10 | add_index :spree_shipping_categories, :name 11 | add_index :spree_taxons, :lft 12 | add_index :spree_taxons, :rgt 13 | add_index :spree_taxons, :name 14 | end 15 | end 16 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904145128_remove_counter_cache_from_spree_variants_to_spree_stock_items.spree.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree (originally 20160509064646) 2 | class RemoveCounterCacheFromSpreeVariantsToSpreeStockItems < ActiveRecord::Migration[4.2] 3 | def up 4 | if column_exists?(:spree_variants, :stock_items_count) 5 | remove_column :spree_variants, :stock_items_count 6 | end 7 | end 8 | 9 | def down 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904145130_change_collation_for_spree_tag_names.spree.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree (originally 20160511072249) 2 | # This migration is added to circumvent issue #623 and have special characters 3 | # work properly 4 | class ChangeCollationForSpreeTagNames < ActiveRecord::Migration[4.2] 5 | def up 6 | if ActsAsTaggableOn::Utils.using_mysql? 7 | execute("ALTER TABLE spree_tags MODIFY name varchar(255) CHARACTER SET utf8 COLLATE utf8_bin;") 8 | end 9 | end 10 | end 11 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904145131_add_missing_indexes_to_spree_taggings.spree.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree (originally 20160511072335) 2 | class AddMissingIndexesToSpreeTaggings < ActiveRecord::Migration[4.2] 3 | def change 4 | add_index :spree_taggings, :tag_id 5 | add_index :spree_taggings, :taggable_id 6 | add_index :spree_taggings, :taggable_type 7 | add_index :spree_taggings, :tagger_id 8 | add_index :spree_taggings, :context 9 | 10 | add_index :spree_taggings, [:tagger_id, :tagger_type] 11 | add_index :spree_taggings, 12 | [:taggable_id, :taggable_type, :tagger_id, :context], 13 | name: "spree_taggings_idy" 14 | end 15 | end 16 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904145132_add_zipcode_required_to_spree_countries.spree.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree (originally 20160608090604) 2 | class AddZipcodeRequiredToSpreeCountries < ActiveRecord::Migration[4.2] 3 | def change 4 | add_column :spree_countries, :zipcode_required, :boolean, default: true 5 | Spree::Country.reset_column_information 6 | Spree::Country.where(iso: Spree::Address::NO_ZIPCODE_ISO_CODES).update_all(zipcode_required: false) 7 | end 8 | end 9 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904145133_add_created_at_to_variant.spree.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree (originally 20161014145148) 2 | class AddCreatedAtToVariant < ActiveRecord::Migration[5.0] 3 | def change 4 | add_column :spree_variants, :created_at, :datetime 5 | Spree::Variant.reset_column_information 6 | Spree::Variant.unscoped.where.not(updated_at: nil).update_all('created_at = updated_at') 7 | Spree::Variant.unscoped.where(updated_at: nil).update_all(created_at: Time.current, updated_at: Time.current) 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904145134_add_null_false_to_spree_variants_timestamps.spree.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree (originally 20161014152814) 2 | class AddNullFalseToSpreeVariantsTimestamps < ActiveRecord::Migration[5.0] 3 | def change 4 | change_column_null :spree_variants, :created_at, false 5 | change_column_null :spree_variants, :updated_at, false 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904145135_add_quantity_to_inventory_units.spree.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree (originally 20161125065505) 2 | class AddQuantityToInventoryUnits < ActiveRecord::Migration[5.0] 3 | def change 4 | add_column :spree_inventory_units, :quantity, :integer, default: 1 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904145145_add_index_on_stock_location_to_spree_customer_returns.spree.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree (originally 20170329110859) 2 | class AddIndexOnStockLocationToSpreeCustomerReturns < ActiveRecord::Migration[5.0] 3 | def change 4 | add_index :spree_customer_returns, :stock_location_id 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904145148_add_index_on_promotion_id_to_order_promotions.spree.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree (originally 20170330132215) 2 | class AddIndexOnPromotionIdToOrderPromotions < ActiveRecord::Migration[5.0] 3 | def change 4 | add_index :spree_order_promotions, :promotion_id 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904145150_add_index_for_prototype_id_to_prototype_taxons.spree.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree (originally 20170331103334) 2 | class AddIndexForPrototypeIdToPrototypeTaxons < ActiveRecord::Migration[5.0] 3 | def change 4 | add_index :spree_prototype_taxons, :prototype_id 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904145151_add_indexes_to_refunds.spree.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree (originally 20170331110454) 2 | class AddIndexesToRefunds < ActiveRecord::Migration[5.0] 3 | def change 4 | add_index :spree_refunds, :payment_id 5 | add_index :spree_refunds, :reimbursement_id 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904145152_add_indexes_to_reimbursement_credits.spree.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree (originally 20170331111757) 2 | class AddIndexesToReimbursementCredits < ActiveRecord::Migration[5.0] 3 | def change 4 | add_index :spree_reimbursement_credits, :reimbursement_id 5 | add_index :spree_reimbursement_credits, [:creditable_id, :creditable_type], name: 'index_reimbursement_credits_on_creditable_id_and_type' 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904145153_add_indexes_to_return_authorizations.spree.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree (originally 20170331115246) 2 | class AddIndexesToReturnAuthorizations < ActiveRecord::Migration[5.0] 3 | def change 4 | add_index :spree_return_authorizations, :order_id 5 | add_index :spree_return_authorizations, :stock_location_id 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904145154_add_indexes_to_return_items.spree.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree (originally 20170331120125) 2 | class AddIndexesToReturnItems < ActiveRecord::Migration[5.0] 3 | def change 4 | add_index :spree_return_items, :return_authorization_id 5 | add_index :spree_return_items, :inventory_unit_id 6 | add_index :spree_return_items, :reimbursement_id 7 | add_index :spree_return_items, :exchange_variant_id 8 | add_index :spree_return_items, :preferred_reimbursement_type_id 9 | add_index :spree_return_items, :override_reimbursement_type_id 10 | end 11 | end 12 | 13 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904145156_add_index_to_shipping_method_categories.spree.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree (originally 20170331123625) 2 | class AddIndexToShippingMethodCategories < ActiveRecord::Migration[5.0] 3 | def change 4 | add_index :spree_shipping_method_categories, :shipping_category_id 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904145158_add_index_to_spree_shipping_rates.spree.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree (originally 20170331124251) 2 | class AddIndexToSpreeShippingRates < ActiveRecord::Migration[5.0] 3 | def change 4 | add_index :spree_shipping_rates, :shipment_id 5 | add_index :spree_shipping_rates, :shipping_method_id 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904145159_add_index_to_spree_stock_items.spree.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree (originally 20170331124513) 2 | class AddIndexToSpreeStockItems < ActiveRecord::Migration[5.0] 3 | def change 4 | add_index :spree_stock_items, :stock_location_id 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904145160_add_index_to_spree_stock_movement.spree.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree (originally 20170331124924) 2 | class AddIndexToSpreeStockMovement < ActiveRecord::Migration[5.0] 3 | def change 4 | add_index :spree_stock_movements, [:originator_id, :originator_type], name: 'index_stock_movements_on_originator_id_and_originator_type' 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904145162_add_analytics_kind_to_spree_trackers.spree.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree (originally 20170722102643) 2 | class AddAnalyticsKindToSpreeTrackers < ActiveRecord::Migration[5.1] 3 | def change 4 | add_column :spree_trackers, :kind, :integer, default: 0, null: false, index: true 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904145163_rename_tracker_kind_field.spree.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree (originally 20170727103056) 2 | class RenameTrackerKindField < ActiveRecord::Migration[5.1] 3 | def change 4 | rename_column :spree_trackers, :kind, :engine 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904145164_remove_icon_from_taxons.spree.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree (originally 20171004223836) 2 | class RemoveIconFromTaxons < ActiveRecord::Migration[5.1] 3 | def change 4 | remove_column :spree_taxons, :icon_file_name if column_exists? :spree_taxons, :icon_file_name 5 | remove_column :spree_taxons, :icon_content_type if column_exists? :spree_taxons, :icon_content_type 6 | remove_column :spree_taxons, :icon_file_size if column_exists? :spree_taxons, :icon_file_size 7 | remove_column :spree_taxons, :icon_updated_at if column_exists? :spree_taxons, :icon_updated_at 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904145165_add_unique_index_on_spree_promotions_code.spree.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree (originally 20180222133746) 2 | class AddUniqueIndexOnSpreePromotionsCode < ActiveRecord::Migration[5.1] 3 | def change 4 | remove_index :spree_promotions, :code 5 | add_index :spree_promotions, :code, unique: true 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904145166_rename_guest_token_to_token_in_orders.spree.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree (originally 20180613080857) 2 | class RenameGuestTokenToTokenInOrders < ActiveRecord::Migration[5.2] 3 | def change 4 | rename_column :spree_orders, :guest_token, :token 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904145167_add_timestamps_to_spree_prices.spree.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree (originally 20180915160001) 2 | class AddTimestampsToSpreePrices < ActiveRecord::Migration[5.2] 3 | def up 4 | add_timestamps :spree_prices, default: Time.current 5 | change_column_default :spree_prices, :created_at, nil 6 | change_column_default :spree_prices, :updated_at, nil 7 | end 8 | 9 | def down 10 | remove_column :spree_prices, :created_at 11 | remove_column :spree_prices, :updated_at 12 | end 13 | end 14 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904145168_add_deleted_at_to_spree_credit_cards.spree.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree (originally 20181024100754) 2 | class AddDeletedAtToSpreeCreditCards < ActiveRecord::Migration[5.2] 3 | def change 4 | add_column :spree_credit_cards, :deleted_at, :datetime 5 | add_index :spree_credit_cards, :deleted_at 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904145171_add_api_key_to_spree_users.spree_api.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree_api (originally 20100107141738) 2 | class AddApiKeyToSpreeUsers < ActiveRecord::Migration[4.2] 3 | def change 4 | unless defined?(User) 5 | add_column :spree_users, :api_key, :string, limit: 40 6 | end 7 | end 8 | end 9 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904145172_resize_api_key_field.spree_api.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree_api (originally 20120411123334) 2 | class ResizeApiKeyField < ActiveRecord::Migration[4.2] 3 | def change 4 | unless defined?(User) 5 | change_column :spree_users, :api_key, :string, limit: 48 6 | end 7 | end 8 | end 9 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904145173_rename_api_key_to_spree_api_key.spree_api.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree_api (originally 20120530054546) 2 | class RenameApiKeyToSpreeApiKey < ActiveRecord::Migration[4.2] 3 | def change 4 | unless defined?(User) 5 | rename_column :spree_users, :api_key, :spree_api_key 6 | end 7 | end 8 | end 9 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904145174_add_index_to_user_spree_api_key.spree_api.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree_api (originally 20131017162334) 2 | class AddIndexToUserSpreeApiKey < ActiveRecord::Migration[4.2] 3 | def change 4 | unless defined?(User) 5 | add_index :spree_users, :spree_api_key 6 | end 7 | end 8 | end 9 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904145178_convert_user_remember_field.spree_auth.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree_auth (originally 20101214150824) 2 | class ConvertUserRememberField < SpreeExtension::Migration[4.2] 3 | def up 4 | remove_column :spree_users, :remember_created_at 5 | add_column :spree_users, :remember_created_at, :datetime 6 | end 7 | 8 | def down 9 | remove_column :spree_users, :remember_created_at 10 | add_column :spree_users, :remember_created_at, :string 11 | end 12 | end 13 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904145179_add_reset_password_sent_at_to_spree_users.spree_auth.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree_auth (originally 20120203010234) 2 | class AddResetPasswordSentAtToSpreeUsers < SpreeExtension::Migration[4.2] 3 | def change 4 | Spree::User.reset_column_information 5 | unless Spree::User.column_names.include?("reset_password_sent_at") 6 | add_column :spree_users, :reset_password_sent_at, :datetime 7 | end 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904145180_make_users_email_index_unique.spree_auth.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree_auth (originally 20120605211305) 2 | class MakeUsersEmailIndexUnique < SpreeExtension::Migration[4.2] 3 | def up 4 | add_index "spree_users", ["email"], name: "email_idx_unique", unique: true 5 | end 6 | 7 | def down 8 | remove_index "spree_users", name: "email_idx_unique" 9 | end 10 | end 11 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904145181_add_deleted_at_to_users.spree_auth.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree_auth (originally 20140904000425) 2 | class AddDeletedAtToUsers < SpreeExtension::Migration[4.2] 3 | def change 4 | add_column :spree_users, :deleted_at, :datetime 5 | add_index :spree_users, :deleted_at 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904145182_add_confirmable_to_users.spree_auth.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree_auth (originally 20141002154641) 2 | class AddConfirmableToUsers < SpreeExtension::Migration[4.2] 3 | def change 4 | add_column :spree_users, :confirmation_token, :string 5 | add_column :spree_users, :confirmed_at, :datetime 6 | add_column :spree_users, :confirmation_sent_at, :datetime 7 | end 8 | end 9 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904145183_add_missing_indices_on_user.spree_auth.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree_auth (originally 20150416152553) 2 | class AddMissingIndicesOnUser < SpreeExtension::Migration[4.2] 3 | def change 4 | unless index_exists?(:spree_users, :bill_address_id) 5 | add_index :spree_users, :bill_address_id 6 | end 7 | unless index_exists?(:spree_users, :ship_address_id) 8 | add_index :spree_users, :ship_address_id 9 | end 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904145184_update_braintree_payment_method_type.spree_gateway.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree_gateway (originally 20121017004102) 2 | class UpdateBraintreePaymentMethodType < SpreeExtension::Migration[4.2] 3 | def up 4 | Spree::PaymentMethod.where(:type => "Spree::Gateway::Braintree").update_all(:type => "Spree::Gateway::BraintreeGateway") 5 | end 6 | 7 | def down 8 | Spree::PaymentMethod.where(:type => "Spree::Gateway::BraintreeGateway").update_all(:type => "Spree::Gateway::Braintree") 9 | end 10 | end 11 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904145185_update_stripe_payment_method_type.spree_gateway.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree_gateway (originally 20130213222555) 2 | class UpdateStripePaymentMethodType < SpreeExtension::Migration[4.2] 3 | def up 4 | Spree::PaymentMethod.where(:type => "Spree::Gateway::Stripe").update_all(:type => "Spree::Gateway::StripeGateway") 5 | end 6 | 7 | def down 8 | Spree::PaymentMethod.where(:type => "Spree::Gateway::StripeGateway").update_all(:type => "Spree::Gateway::Stripe") 9 | end 10 | end 11 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904145186_update_balanced_payment_method_type.spree_gateway.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree_gateway (originally 20130415222802) 2 | class UpdateBalancedPaymentMethodType < SpreeExtension::Migration[4.2] 3 | def up 4 | Spree::PaymentMethod.where(:type => "Spree::Gateway::Balanced").update_all(:type => "Spree::Gateway::BalancedGateway") 5 | end 6 | 7 | def down 8 | Spree::PaymentMethod.where(:type => "Spree::Gateway::BalancedGateway").update_all(:type => "Spree::Gateway::Balanced") 9 | end 10 | end 11 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904145187_update_paypal_payment_method_type.spree_gateway.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree_gateway (originally 20131008221012) 2 | class UpdatePaypalPaymentMethodType < SpreeExtension::Migration[4.2] 3 | def up 4 | Spree::PaymentMethod.where(:type => "Spree::Gateway::PayPal").update_all(:type => "Spree::Gateway::PayPalGateway") 5 | end 6 | 7 | def down 8 | Spree::PaymentMethod.where(:type => "Spree::Gateway::PayPalGateway").update_all(:type => "Spree::Gateway::PayPal") 9 | end 10 | end 11 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/migrate/20190904145188_migrate_stripe_preferences.spree_gateway.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from spree_gateway (originally 20131112133401) 2 | class MigrateStripePreferences < SpreeExtension::Migration[4.2] 3 | def up 4 | Spree::Preference.where("#{ActiveRecord::Base.connection.quote_column_name("key")} LIKE 'spree/gateway/stripe_gateway/login%'").each do |pref| 5 | pref.key = pref.key.gsub('login', 'secret_key') 6 | pref.save 7 | end 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/seeds.rb: -------------------------------------------------------------------------------- 1 | # This file should contain all the record creation needed to seed the database with its default values. 2 | # The data can then be loaded with the rails db:seed command (or created alongside the database with db:setup). 3 | # 4 | # Examples: 5 | # 6 | # movies = Movie.create([{ name: 'Star Wars' }, { name: 'Lord of the Rings' }]) 7 | # Character.create(name: 'Luke', movie: movies.first) 8 | 9 | Spree::Core::Engine.load_seed if defined?(Spree::Core) 10 | Spree::Auth::Engine.load_seed if defined?(Spree::Auth) 11 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/db/test.sqlite3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DataDog/ecommerce-workshop/aaa8069566b6c86ed5407ec830bf64713067fcd5/store-frontend/src/store-frontend-initial-state/db/test.sqlite3 -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/docker-entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # This is entrypoint for docker image of spree sandbox on docker cloud 3 | 4 | # Set our environment to development for now 5 | # TODO: Make this more configurable with a default 6 | export RAILS_ENV=development 7 | # Silence all Ruby 3.0 deprecation warnings for now until we upgrade 8 | # TODO: Remove this once we upgrade to Ruby 3.0 and Rails 6.1 9 | export RUBYOPT='-W0' 10 | # Force semantic-logger to report itself as the storefront app 11 | export SEMANTIC_LOGGER_APP='store-frontend' 12 | 13 | puma --config config/puma.rb 14 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "sandbox", 3 | "private": true, 4 | "dependencies": {} 5 | } 6 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/public/apple-touch-icon-precomposed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DataDog/ecommerce-workshop/aaa8069566b6c86ed5407ec830bf64713067fcd5/store-frontend/src/store-frontend-initial-state/public/apple-touch-icon-precomposed.png -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/public/apple-touch-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DataDog/ecommerce-workshop/aaa8069566b6c86ed5407ec830bf64713067fcd5/store-frontend/src/store-frontend-initial-state/public/apple-touch-icon.png -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DataDog/ecommerce-workshop/aaa8069566b6c86ed5407ec830bf64713067fcd5/store-frontend/src/store-frontend-initial-state/public/favicon.ico -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/public/robots.txt: -------------------------------------------------------------------------------- 1 | # See http://www.robotstxt.org/robotstxt.html for documentation on how to use the robots.txt file 2 | User-agent: * 3 | Disallow: /checkout 4 | Disallow: /cart 5 | Disallow: /orders 6 | Disallow: /user 7 | Disallow: /account 8 | Disallow: /api 9 | Disallow: /password 10 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/test/controllers/discounts_controller_test.rb: -------------------------------------------------------------------------------- 1 | require 'test_helper' 2 | 3 | class DiscountsControllerTest < ActionDispatch::IntegrationTest 4 | test "should get get" do 5 | get discounts_get_url 6 | assert_response :success 7 | end 8 | 9 | test "should get add" do 10 | get discounts_add_url 11 | assert_response :success 12 | end 13 | 14 | end 15 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/vendor/assets/javascripts/spree/backend/all.js: -------------------------------------------------------------------------------- 1 | // This is a manifest file that'll be compiled into including all the files listed below. 2 | // Add new JavaScript/Coffee code in separate files in this directory and they'll automatically 3 | // be included in the compiled file accessible from http://example.com/assets/application.js 4 | // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the 5 | // the compiled file. 6 | // 7 | //= require jquery 8 | //= require jquery_ujs 9 | //= require spree/backend 10 | 11 | //= require_tree . 12 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/vendor/assets/javascripts/spree/frontend/all.js: -------------------------------------------------------------------------------- 1 | // This is a manifest file that'll be compiled into including all the files listed below. 2 | // Add new JavaScript/Coffee code in separate files in this directory and they'll automatically 3 | // be included in the compiled file accessible from http://example.com/assets/application.js 4 | // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the 5 | // the compiled file. 6 | // 7 | //= require jquery 8 | //= require jquery_ujs 9 | //= require accounting.min 10 | //= require spree/frontend 11 | 12 | //= require_tree . 13 | //= require spree/frontend/spree_auth 14 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/vendor/assets/stylesheets/spree/backend/all.css: -------------------------------------------------------------------------------- 1 | /* 2 | * This is a manifest file that'll automatically include all the stylesheets available in this directory 3 | * and any sub-directories. You're free to add application-wide styles to this file and they'll appear at 4 | * the top of the compiled file, but it's generally better to create a new file per style scope. 5 | * 6 | *= require spree/backend 7 | 8 | *= require_self 9 | *= require_tree . 10 | */ 11 | -------------------------------------------------------------------------------- /store-frontend/src/store-frontend-initial-state/vendor/assets/stylesheets/spree/frontend/all.css: -------------------------------------------------------------------------------- 1 | /* 2 | * This is a manifest file that'll automatically include all the stylesheets available in this directory 3 | * and any sub-directories. You're free to add application-wide styles to this file and they'll appear at 4 | * the top of the compiled file, but it's generally better to create a new file per style scope. 5 | * 6 | *= require spree/frontend 7 | 8 | *= require_self 9 | *= require_tree . 10 | */ 11 | -------------------------------------------------------------------------------- /store-frontend/storefront-versions/store-frontend-broken-instrumented/.dockerignore: -------------------------------------------------------------------------------- 1 | # Version control 2 | .git 3 | .gitignore 4 | 5 | # Docker 6 | Dockerfile* 7 | .dockerignore 8 | 9 | # Logs and Temp files 10 | log/* 11 | tmp/* 12 | -------------------------------------------------------------------------------- /store-frontend/storefront-versions/store-frontend-broken-instrumented/build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Set bash strict mode so we insta-fail on any errors 3 | # -e: Exit immediately if a command has non-zero exit code, i.e. fails somehow. 4 | # Otherwise bash is like a Python program that just swallows exceptions. 5 | # -u: Exit with error message if code uses an undefined environment variable, 6 | # instead of silently continuing with an empty string. 7 | # -o pipefail: Like -e, except for piped commands. 8 | set -euo pipefail 9 | 10 | # Enable Docker Buildkit 11 | export DOCKER_BUILDKIT=1 12 | 13 | # Build and tag image 14 | docker image build --progress=plain --tag ddtraining/storefront:latest . 15 | -------------------------------------------------------------------------------- /store-frontend/storefront-versions/store-frontend-broken-no-instrumentation/.dockerignore: -------------------------------------------------------------------------------- 1 | # Version control 2 | .git 3 | .gitignore 4 | 5 | # Docker 6 | Dockerfile* 7 | .dockerignore 8 | 9 | # Logs and Temp files 10 | log/* 11 | tmp/* 12 | -------------------------------------------------------------------------------- /store-frontend/storefront-versions/store-frontend-broken-no-instrumentation/build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Set bash strict mode so we insta-fail on any errors 3 | # -e: Exit immediately if a command has non-zero exit code, i.e. fails somehow. 4 | # Otherwise bash is like a Python program that just swallows exceptions. 5 | # -u: Exit with error message if code uses an undefined environment variable, 6 | # instead of silently continuing with an empty string. 7 | # -o pipefail: Like -e, except for piped commands. 8 | set -euo pipefail 9 | 10 | # Enable Docker Buildkit 11 | export DOCKER_BUILDKIT=1 12 | 13 | # Build and tag image 14 | docker image build --progress=plain --tag ddtraining/storefront-no-instrumentation:latest . 15 | -------------------------------------------------------------------------------- /store-frontend/storefront-versions/store-frontend-instrumented-fixed/.dockerignore: -------------------------------------------------------------------------------- 1 | # Version control 2 | .git 3 | .gitignore 4 | 5 | # Docker 6 | Dockerfile* 7 | .dockerignore 8 | 9 | # Logs and Temp files 10 | log/* 11 | tmp/* 12 | -------------------------------------------------------------------------------- /store-frontend/storefront-versions/store-frontend-instrumented-fixed/build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Set bash strict mode so we insta-fail on any errors 3 | # -e: Exit immediately if a command has non-zero exit code, i.e. fails somehow. 4 | # Otherwise bash is like a Python program that just swallows exceptions. 5 | # -u: Exit with error message if code uses an undefined environment variable, 6 | # instead of silently continuing with an empty string. 7 | # -o pipefail: Like -e, except for piped commands. 8 | set -euo pipefail 9 | 10 | # Enable Docker Buildkit 11 | export DOCKER_BUILDKIT=1 12 | 13 | # Build and tag image 14 | docker image build --progress=plain --tag ddtraining/storefront-fixed:latest . 15 | -------------------------------------------------------------------------------- /storedog.synthetics.json: -------------------------------------------------------------------------------- 1 | { 2 | "tests": [ 3 | { 4 | "id": "w7z-73y-z5s" 5 | }, 6 | { 7 | "id": "gq2-uwi-m23" 8 | } 9 | ] 10 | } -------------------------------------------------------------------------------- /traffic-replay/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM bash:5.1 2 | 3 | RUN wget -O /usr/local/bin/wait-for-it.sh https://raw.githubusercontent.com/vishnubob/wait-for-it/master/wait-for-it.sh && chmod +x /usr/local/bin/wait-for-it.sh 4 | RUN wget -q -O - https://github.com/buger/goreplay/releases/download/v1.1.0/gor_1.1.0_x64.tar.gz | tar -xz -C /usr/local/bin 5 | 6 | COPY requests_0.gor / 7 | ENTRYPOINT wait-for-it.sh -t 0 ${FRONTEND_HOST:-frontend}:${FRONTEND_PORT:-3000} -s -- gor --input-file-loop --input-file requests_0.gor --output-http "http://${FRONTEND_HOST:-frontend}:${FRONTEND_PORT:-3000}" 8 | -------------------------------------------------------------------------------- /traffic-replay/build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Set bash strict mode so we insta-fail on any errors 3 | # -e: Exit immediately if a command has non-zero exit code, i.e. fails somehow. 4 | # Otherwise bash is like a Python program that just swallows exceptions. 5 | # -u: Exit with error message if code uses an undefined environment variable, 6 | # instead of silently continuing with an empty string. 7 | # -o pipefail: Like -e, except for piped commands. 8 | set -euo pipefail 9 | 10 | # Enable Docker Buildkit 11 | export DOCKER_BUILDKIT=1 12 | 13 | # Build and tag image 14 | docker image build --progress=plain --tag ddtraining/traffic-replay:latest . 15 | --------------------------------------------------------------------------------