getcandy / candy-api

GetCandy v1 E-Commerce API
https://getcandy.io
Apache License 2.0
444 stars 114 forks source link

Upgrade doctrine/dbal to version 3 if using php8 #354

Open ven7ura opened 3 years ago

ven7ura commented 3 years ago

Users can't migrate using laravel sail and php8.

Expected Behavior

Using commands sail art migrate should resolve without issues.

Current Behavior

Trying to migrate this error shows up: Declaration of Doctrine\DBAL\Driver\PDOConnection::query() must be compatible with PDO::query(string $query, ?int $fetchMode = null, mixed ...$fetchModeArgs)

https://github.com/doctrine/dbal/issues/4042

If I try to install version 3: composer require doctrine/dbal:3.0.0

./composer.json has been updated
Running composer update doctrine/dbal
Loading composer repositories with package information
Updating dependencies
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - getcandy/candy-api is locked to version 0.11.3 and an update of this package was not requested.
    - getcandy/candy-api 0.11.3 requires doctrine/dbal 2.9.2 -> found doctrine/dbal[v2.9.2] but it conflicts with your root composer.json require (3.0.0).

Use the option --with-all-dependencies (-W) to allow upgrades, downgrades and removals for packages currently locked to specific versions.
Installation failed, reverting ./composer.json and ./composer.lock to their original content.

Possible Solution

Update dependencies of doctrine/dbal

Steps to Reproduce

  1. New laravel project
  2. Install laravel sanctum and passport
  3. Install this package
  4. Do sail art migrate

Context (Environment)

win10 wsl2 Ubuntu 20.04

glennjacobs commented 3 years ago

Thanks for reporting. I don't believe we've used Laravel Sail before here. Hopefully a simple fix.

If you get a chance, maybe try manually upgrading Doctrine\DBAL and see if it solves it?

ven7ura commented 3 years ago

Manually upgrading DBAL allows to migrate.. now I face another Exception:

sail art migrate
Migration table created successfully.
Migrating: 2014_10_12_000000_create_users_table
Migrated:  2014_10_12_000000_create_users_table (112.35ms)
Migrating: 2014_10_12_100000_create_password_resets_table
Migrated:  2014_10_12_100000_create_password_resets_table (108.63ms)
Migrating: 2016_06_01_000001_create_oauth_auth_codes_table
Migrated:  2016_06_01_000001_create_oauth_auth_codes_table (226.07ms)
Migrating: 2016_06_01_000002_create_oauth_access_tokens_table
Migrated:  2016_06_01_000002_create_oauth_access_tokens_table (282.42ms)
Migrating: 2016_06_01_000003_create_oauth_refresh_tokens_table
Migrated:  2016_06_01_000003_create_oauth_refresh_tokens_table (465.45ms)
Migrating: 2016_06_01_000004_create_oauth_clients_table
Migrated:  2016_06_01_000004_create_oauth_clients_table (179.91ms)
Migrating: 2016_06_01_000005_create_oauth_personal_access_clients_table
Migrated:  2016_06_01_000005_create_oauth_personal_access_clients_table (73.65ms)
Migrating: 2017_02_01_000000_create_users_table_if_not_exists
Migrated:  2017_02_01_000000_create_users_table_if_not_exists (13.98ms)
Migrating: 2017_02_02_000000_create_user_details_table
Migrated:  2017_02_02_000000_create_user_details_table (539.88ms)
Migrating: 2017_02_02_105826_create_channels_table
Migrated:  2017_02_02_105826_create_channels_table (216.89ms)
Migrating: 2017_02_07_145516_create_languages_table
Migrated:  2017_02_07_145516_create_languages_table (212.76ms)
Migrating: 2017_02_07_150908_create_products_table
Migrated:  2017_02_07_150908_create_products_table (77.63ms)
Migrating: 2017_03_17_111957_create_currencies_table
Migrated:  2017_03_17_111957_create_currencies_table (224.95ms)
Migrating: 2017_03_21_135946_create_taxes_table
Migrated:  2017_03_21_135946_create_taxes_table (146.73ms)
Migrating: 2017_03_30_105723_create_attribute_groups_table
Migrated:  2017_03_30_105723_create_attribute_groups_table (270.85ms)
Migrating: 2017_03_30_105825_create_attributes_table
Migrated:  2017_03_30_105825_create_attributes_table (397.47ms)
Migrating: 2017_03_30_112530_create_product_families_table
Migrated:  2017_03_30_112530_create_product_families_table (77.72ms)
Migrating: 2017_03_30_112725_add_family_to_products_table
Migrated:  2017_03_30_112725_add_family_to_products_table (237.63ms)
Migrating: 2017_06_02_132912_create_layouts_table
Migrated:  2017_06_02_132912_create_layouts_table (219.33ms)
Migrating: 2017_06_02_133222_create_pages_table
Migrated:  2017_06_02_133222_create_pages_table (874.45ms)
Migrating: 2017_06_09_101339_create_routes_table
Migrated:  2017_06_09_101339_create_routes_table (196.74ms)
Migrating: 2017_06_09_105538_create_collections_table
Migrated:  2017_06_09_105538_create_collections_table (81.93ms)
Migrating: 2017_06_09_110513_create_collection_product_table
Migrated:  2017_06_09_110513_create_collection_product_table (456.91ms)
Migrating: 2017_06_09_140502_add_layout_to_products_table
Migrated:  2017_06_09_140502_add_layout_to_products_table (285.14ms)
Migrating: 2017_06_09_142158_create_product_variants_table
Migrated:  2017_06_09_142158_create_product_variants_table (394.57ms)
Migrating: 2017_06_14_092629_create_categories_table
Migrated:  2017_06_14_092629_create_categories_table (118.37ms)
Migrating: 2017_07_06_085647_create_attribute_model_table
Migrated:  2017_07_06_085647_create_attribute_model_table (275.44ms)
Migrating: 2017_07_06_090411_clear_down_tables
Migrated:  2017_07_06_090411_clear_down_tables (36.80ms)
Migrating: 2017_07_14_102630_create_channel_product_table
Migrated:  2017_07_14_102630_create_channel_product_table (454.48ms)
Migrating: 2017_07_25_090852_create_customer_groups_table
Migrated:  2017_07_25_090852_create_customer_groups_table (141.38ms)
Migrating: 2017_07_25_091607_create_customer_group_user_table
Migrated:  2017_07_25_091607_create_customer_group_user_table (470.48ms)
Migrating: 2017_07_25_100905_create_customer_group_product_table
Migrated:  2017_07_25_100905_create_customer_group_product_table (460.90ms)
Migrating: 2017_08_04_082431_add_scopeable_to_attributes_table
Migrated:  2017_08_04_082431_add_scopeable_to_attributes_table (89.38ms)
Migrating: 2017_08_04_084849_create_asset_sources_table
Migrated:  2017_08_04_084849_create_asset_sources_table (103.28ms)
Migrating: 2017_08_04_084909_create_assets_table
Migrated:  2017_08_04_084909_create_assets_table (575.36ms)
Migrating: 2017_08_04_090015_create_tags_table
Migrated:  2017_08_04_090015_create_tags_table (85.40ms)
Migrating: 2017_08_04_090141_create_taggables_table
Migrated:  2017_08_04_090141_create_taggables_table (222.18ms)
Migrating: 2017_08_04_091032_create_transforms_table
Migrated:  2017_08_04_091032_create_transforms_table (145.68ms)
Migrating: 2017_08_04_091304_create_asset_transforms_table
Migrated:  2017_08_04_091304_create_asset_transforms_table (640.98ms)
Migrating: 2017_08_04_112246_create_settings_table
Migrated:  2017_08_04_112246_create_settings_table (154.48ms)
Migrating: 2017_08_07_142503_create_jobs_table
Migrated:  2017_08_07_142503_create_jobs_table (144.17ms)
Migrating: 2017_09_13_131123_add_asset_to_product_variants
Migrated:  2017_09_13_131123_add_asset_to_product_variants (378.31ms)
Migrating: 2017_09_18_101535_create_product_categories_table
Migrated:  2017_09_18_101535_create_product_categories_table (460.42ms)
Migrating: 2017_10_13_085113_add_language_to_users_table
Migrated:  2017_10_13_085113_add_language_to_users_table (290.13ms)
Migrating: 2017_10_13_112429_create_permission_tables
Migrated:  2017_10_13_112429_create_permission_tables (1,470.76ms)
Migrating: 2017_10_19_152735_create_category_channel_table
Migrated:  2017_10_19_152735_create_category_channel_table (426.19ms)
Migrating: 2017_10_20_112643_create_association_groups_table
Migrated:  2017_10_20_112643_create_association_groups_table (120.63ms)
Migrating: 2017_10_20_112743_create_product_association_table
Migrated:  2017_10_20_112743_create_product_association_table (636.22ms)
Migrating: 2017_10_25_115139_create_channel_collection_table
Migrated:  2017_10_25_115139_create_channel_collection_table (403.23ms)
Migrating: 2017_10_25_134000_create_customer_group_collection_table
Migrated:  2017_10_25_134000_create_customer_group_collection_table (417.86ms)
Migrating: 2017_10_26_132046_create_category_customer_group_table
Migrated:  2017_10_26_132046_create_category_customer_group_table (457.74ms)
Migrating: 2017_11_20_092346_create_saved_searches_table
Migrated:  2017_11_20_092346_create_saved_searches_table (127.92ms)
Migrating: 2017_11_27_102233_add_singular_price_to_products
Migrated:  2017_11_27_102233_add_singular_price_to_products (62.19ms)
Migrating: 2017_11_27_102602_add_pricing_to_product_variants_table
Migrated:  2017_11_27_102602_add_pricing_to_product_variants_table (59.51ms)
Migrating: 2017_11_27_170556_create_discounts_table
Migrated:  2017_11_27_170556_create_discounts_table (242.39ms)
Migrating: 2017_11_27_170629_add_discount_criteria_groups
Migrated:  2017_11_27_170629_add_discount_criteria_groups (255.95ms)
Migrating: 2017_11_27_170711_add_discount_criteria_items
Migrated:  2017_11_27_170711_add_discount_criteria_items (333.40ms)
Migrating: 2017_11_28_151459_create_discount_rewards_table
Migrated:  2017_11_28_151459_create_discount_rewards_table (302.02ms)
Migrating: 2017_11_29_100039_create_channel_discount_table
Migrated:  2017_11_29_100039_create_channel_discount_table (473.88ms)
Migrating: 2017_12_04_091903_add_baskets_table
Migrated:  2017_12_04_091903_add_baskets_table (459.40ms)
Migrating: 2017_12_04_092131_create_basket_lines_table
Migrated:  2017_12_04_092131_create_basket_lines_table (452.49ms)
Migrating: 2017_12_05_162250_add_orders_table
Migrated:  2017_12_05_162250_add_orders_table (625.05ms)
Migrating: 2017_12_05_162309_add_order_lines_table
Migrated:  2017_12_05_162309_add_order_lines_table (464.83ms)
Migrating: 2017_12_06_124647_add_transactions_table
Migrated:  2017_12_06_124647_add_transactions_table (292.85ms)
Migrating: 2017_12_07_104658_create_addresses_table
Migrated:  2017_12_07_104658_create_addresses_table (314.05ms)
Migrating: 2017_12_08_103638_create_countries_table
Migrated:  2017_12_08_103638_create_countries_table (317.56ms)
Migrating: 2017_12_08_110901_create_shipping_zone_table
Migrated:  2017_12_08_110901_create_shipping_zone_table (178.88ms)
Migrating: 2017_12_08_110952_create_country_shipping_zones_table
Migrated:  2017_12_08_110952_create_country_shipping_zones_table (560.05ms)
Migrating: 2017_12_08_111615_create_shipping_methods_table
Migrated:  2017_12_08_111615_create_shipping_methods_table (100.94ms)
Migrating: 2017_12_08_111847_create_shipping_prices_table
Migrated:  2017_12_08_111847_create_shipping_prices_table (609.75ms)
Migrating: 2017_12_08_113105_create_shipping_method_zones_table
Migrated:  2017_12_08_113105_create_shipping_method_zones_table (522.88ms)
Migrating: 2017_12_08_114607_create_customer_group_shipping_price_table
Migrated:  2017_12_08_114607_create_customer_group_shipping_price_table (376.36ms)
Migrating: 2017_12_15_102235_create_shipping_method_channel_table
Migrated:  2017_12_15_102235_create_shipping_method_channel_table (468.54ms)
Migrating: 2017_12_18_122848_add_contact_to_orders_table
Migrated:  2017_12_18_122848_add_contact_to_orders_table (57.42ms)
Migrating: 2017_12_18_171243_create_basket_discounts_table
Migrated:  2017_12_18_171243_create_basket_discounts_table (487.91ms)
Migrating: 2017_12_19_115416_create_order_discount_lines_table
Migrated:  2017_12_19_115416_create_order_discount_lines_table (287.99ms)
Migrating: 2017_12_21_092736_add_eu_vat_to_orders_table
Migrated:  2017_12_21_092736_add_eu_vat_to_orders_table (73.21ms)
Migrating: 2018_01_05_094556_add_min_basket_to_shipping_price
Migrated:  2018_01_05_094556_add_min_basket_to_shipping_price (46.76ms)
Migrating: 2018_01_08_150708_add_vat_to_variants_table
Migrated:  2018_01_08_150708_add_vat_to_variants_table (308.51ms)
Migrating: 2018_01_10_102538_move_customer_pricing_to_relational_tables
Migrated:  2018_01_10_102538_move_customer_pricing_to_relational_tables (1,026.90ms)
Migrating: 2018_01_10_105346_create_product_pricing_tiers_table
Migrated:  2018_01_10_105346_create_product_pricing_tiers_table (460.59ms)
Migrating: 2018_01_15_094109_add_tracking_to_orders
Migrated:  2018_01_15_094109_add_tracking_to_orders (203.14ms)
Migrating: 2018_01_15_120102_add_fields_to_transactions
Migrated:  2018_01_15_120102_add_fields_to_transactions (150.85ms)
Migrating: 2018_01_16_161219_create_reward_product_table
Migrated:  2018_01_16_161219_create_reward_product_table (678.65ms)
Migrating: 2018_01_17_110628_create_shipping_method_users_table
Migrated:  2018_01_17_110628_create_shipping_method_users_table (445.63ms)
Migrating: 2018_01_17_143125_create_discount_criteria_set_models
Migrated:  2018_01_17_143125_create_discount_criteria_set_models (340.39ms)
Migrating: 2018_01_23_105003_add_order_reference_to_orders_table
Migrated:  2018_01_23_105003_add_order_reference_to_orders_table (193.68ms)
Migrating: 2018_02_14_160832_add_placed_at_to_orders
Migrated:  2018_02_14_160832_add_placed_at_to_orders (77.97ms)
Migrating: 2018_02_14_170403_migrate_order_placed_at_dates
Migrated:  2018_02_14_170403_migrate_order_placed_at_dates (11.28ms)
Migrating: 2018_02_19_121607_add_url_to_channels
Migrated:  2018_02_19_121607_add_url_to_channels (65.38ms)
Migrating: 2018_02_20_151933_create_payment_types_table
Migrated:  2018_02_20_151933_create_payment_types_table (174.08ms)
Migrating: 2018_02_20_152054_create_payment_type_customer_group
Migrated:  2018_02_20_152054_create_payment_type_customer_group (517.09ms)
Migrating: 2018_02_22_112412_add_converstion_rate_to_orders_table
Migrated:  2018_02_22_112412_add_converstion_rate_to_orders_table (65.66ms)
Migrating: 2018_02_23_144739_add_driver_to_transactions
Migrated:  2018_02_23_144739_add_driver_to_transactions (63.25ms)
Migrating: 2018_04_19_144739_alter_product_families
Migrated:  2018_04_19_144739_alter_product_families (60.76ms)
Migrating: 2018_04_20_090650_modify_orders_and_lines
Migrated:  2018_04_20_090650_modify_orders_and_lines (1,759.93ms)
Migrating: 2018_05_11_090650_add_position_to_product_categories
Migrated:  2018_05_11_090650_add_position_to_product_categories (141.38ms)
Migrating: 2018_05_21_090650_change_columns_to_integers
Migrated:  2018_05_21_090650_change_columns_to_integers (2,516.26ms)
Migrating: 2018_05_25_104010_add_sort_to_categories
Migrated:  2018_05_25_104010_add_sort_to_categories (169.32ms)
Migrating: 2018_06_11_100010_add_saved_baskets
Migrated:  2018_06_11_100010_add_saved_baskets (372.08ms)
Migrating: 2018_06_11_142310_add_pricing_fields_to_variants
Migrated:  2018_06_11_142310_add_pricing_fields_to_variants (226.57ms)
Migrating: 2018_06_12_153510_change_backorder_field_on_variants
Migrated:  2018_06_12_153510_change_backorder_field_on_variants (603.63ms)
Migrating: 2018_06_12_164010_add_incoming_field_on_variants
Migrated:  2018_06_12_164010_add_incoming_field_on_variants (201.24ms)
Migrating: 2018_06_25_093125_add_shipping_regions
Migrated:  2018_06_25_093125_add_shipping_regions (528.53ms)
Migrating: 2018_06_25_101030_change_shipping_price_to_int
Migrated:  2018_06_25_101030_change_shipping_price_to_int (407.73ms)
Migrating: 2018_06_25_125230_add_shipping_zone_to_prices
Migrated:  2018_06_25_125230_add_shipping_zone_to_prices (496.88ms)
Migrating: 2018_06_28_141350_add_manual_flag_to_order_lines
Migrated:  2018_06_28_141350_add_manual_flag_to_order_lines (339.71ms)
Migrating: 2018_06_29_154344_add_customer_reference_to_orders
Migrated:  2018_06_29_154344_add_customer_reference_to_orders (277.41ms)
Migrating: 2018_07_04_115014_add_shipping_preference_to_orders
Migrated:  2018_07_04_115014_add_shipping_preference_to_orders (196.30ms)
Migrating: 2018_08_5_101030_add_fields_to_layouts
Migrated:  2018_08_5_101030_add_fields_to_layouts (719.76ms)
Migrating: 2018_08_7_112000_add_handle_to_payment_types
Migrated:  2018_08_7_112000_add_handle_to_payment_types (241.11ms)
Migrating: 2018_08_8_112000_add_unit_qty_to_order_line
Migrated:  2018_08_8_112000_add_unit_qty_to_order_line (264.49ms)
Migrating: 2018_09_04_154030_add_product_recommendations_table
Migrated:  2018_09_04_154030_add_product_recommendations_table (552.28ms)
Migrating: 2018_09_17_091156_add_lower_limit_to_discounts_table
Migrated:  2018_09_17_091156_add_lower_limit_to_discounts_table (152.12ms)
Migrating: 2018_09_24_104330_add_fraud_fields_to_transactions
Migrated:  2018_09_24_104330_add_fraud_fields_to_transactions (62.29ms)
Migrating: 2018_10_03_141925_add_saved_cards_to_users
Migrated:  2018_10_03_141925_add_saved_cards_to_users (447.69ms)
Migrating: 2018_10_25_111152_add_delivery_total_to_order_lines
Migrated:  2018_10_25_111152_add_delivery_total_to_order_lines (190.16ms)
Migrating: 2018_11_12_154345_add_type_to_orders
Migrated:  2018_11_12_154345_add_type_to_orders (245.42ms)
Migrating: 2019_01_11_110119_add_extra_email_fields_to_orders
Migrated:  2019_01_11_110119_add_extra_email_fields_to_orders (761.45ms)
Migrating: 2019_01_15_161140_rename_variant_on_order_lines
Migrated:  2019_01_15_161140_rename_variant_on_order_lines (624.90ms)
Migrating: 2019_02_15_092655_change_country_columns
Migrated:  2019_02_15_092655_change_country_columns (526.29ms)
Migrating: 2019_03_25_122100_add_min_batch_to_variants_table
Migrated:  2019_03_25_122100_add_min_batch_to_variants_table (481.13ms)
Migrating: 2019_03_29_145426_add_meta_fields_to_orders_baskets
Migrated:  2019_03_29_145426_add_meta_fields_to_orders_baskets (203.88ms)
Migrating: 2019_04_17_115920_create_imports_table
Migrated:  2019_04_17_115920_create_imports_table (285.91ms)
Migrating: 2019_05_07_115920_add_alt_contact_to_contact_details
Migrated:  2019_05_07_115920_add_alt_contact_to_contact_details (77.81ms)
Migrating: 2019_05_31_153000_add_default_to_addresses
Migrated:  2019_05_31_153000_add_default_to_addresses (179.93ms)
Migrating: 2019_08_19_000000_create_failed_jobs_table
Migrated:  2019_08_19_000000_create_failed_jobs_table (94.76ms)
Migrating: 2019_08_23_163932_create_shipping_zone_exclusions_table
Migrated:  2019_08_23_163932_create_shipping_zone_exclusions_table (320.30ms)
Migrating: 2019_08_30_105210_add_company_name_to_orders
Migrated:  2019_08_30_105210_add_company_name_to_orders (137.87ms)
Migrating: 2019_12_14_000001_create_personal_access_tokens_table
Migrated:  2019_12_14_000001_create_personal_access_tokens_table (159.41ms)
Migrating: 2020_01_06_123644_create_recycle_bin_table
Migrated:  2020_01_06_123644_create_recycle_bin_table (120.02ms)
Migrating: 2020_01_06_124544_add_initial_rows_to_recycle_bin_table
Migrated:  2020_01_06_124544_add_initial_rows_to_recycle_bin_table (1.33ms)
Migrating: 2020_01_06_163333_add_set_null_on_delete_on_order_lines

   Illuminate\Database\QueryException

  SQLSTATE[HY000]: General error: 1826 Duplicate foreign key constraint name 'order_lines_product_variant_id_foreign' (SQL: alter table `order_lines` add constraint `order_lines_product_variant_id_foreign` foreign key (`product_variant_id`) references `product_variants` (`id`) on delete SET NULL)

  at vendor/laravel/framework/src/Illuminate/Database/Connection.php:678
    674▕         // If an exception occurs when attempting to run a query, we'll format the error
    675▕         // message to include the bindings with SQL, which will make this exception a
    676▕         // lot more helpful to the developer instead of just the database's errors.
    677▕         catch (Exception $e) {
  ➜ 678▕             throw new QueryException(
    679▕                 $query, $this->prepareBindings($bindings), $e
    680▕             );
    681▕         }
    682▕

      +31 vendor frames
  32  artisan:37
      Illuminate\Foundation\Console\Kernel::handle()
alecritson commented 3 years ago

Hi @ven7ura Could you try bumping the api version to 0.11.4 and try again.

ven7ura commented 3 years ago

Hey @alecritson! I upgraded to 0.11.5 and using dbal:3.0.0 and using sail art candy:install migration works correctly.