solidus icon indicating copy to clipboard operation
solidus copied to clipboard

'[Spree WARNING] Missing migrations' when using a secondary database

Open blakeprudhomme opened this issue 4 years ago • 3 comments
trafficstars

We are integrating Solidus into an existing rails app. We have chosen to use a separate database for the store.

With the following setup, everything works as expected, except we get a constant warning about missing migrations.

development:
  primary:
    adapter: postgresql
    encoding: unicode
    database: primary_db_development
  solidus:
    adapter: postgresql
    encoding: unicode
    database: store_db_development
    migrations_paths: db/solidus_migrate
module Store
  def self.prepended(base)
    base.instance_eval do
      self.abstract_class = true
      connects_to database: { writing: :solidus, reading: :solidus }
    end
  end
  Spree::Base.prepend self
end

Solidus Version: 3.1.1 with Rails 6.1.4.1

To Reproduce Set up an existing app with a separate database for Solidus

Current behavior Every time the rails server command or any rails db:* command or rspec command is run in a terminal we get:

[Spree WARNING] Missing migrations.
[Spree WARNING] add_amount_remaining_to_store_credit_events from spree is missing.
[Spree WARNING] add_apply_to_all_to_variant_property_rule from spree is missing.
[Spree WARNING] add_available_locales_to_stores from spree is missing.
[Spree WARNING] add_available_to_columns_and_remove_display_on_from_payment_methods from spree is missing.
[Spree WARNING] add_available_to_users_and_remove_display_on_from_shipping_methods from spree is missing.
[Spree WARNING] add_bcc_email_to_spree_stores from spree is missing.
[Spree WARNING] add_default_billng_flag_to_user_addresses from spree is missing.
[Spree WARNING] add_discontinue_on_to_spree_products from spree is missing.
[Spree WARNING] add_index_to_spree_payments_number from spree is missing.
[Spree WARNING] add_join_characters_to_promotion_code_batch from spree is missing.
[Spree WARNING] add_lft_and_rgt_indexes_to_taxons from spree is missing.
[Spree WARNING] add_name_to_spree_addresses from spree is missing.
[Spree WARNING] add_roles_unique_constraints from spree is missing.
[Spree WARNING] add_time_range_to_tax_rate from spree is missing.
[Spree WARNING] change_column_null_on_prices from spree is missing.
[Spree WARNING] create_promotion_rule_stores from spree is missing.
[Spree WARNING] create_spree_promotion_code_batch from spree is missing.
[Spree WARNING] create_spree_store_credit_reasons_table from spree is missing.
[Spree WARNING] create_spree_wallet_payment_sources from spree is missing.
[Spree WARNING] create_store_shipping_methods from spree is missing.
[Spree WARNING] drop_spree_store_credit_update_reasons from spree is missing.
[Spree WARNING] migrate_credit_cards_to_wallet_payment_sources from spree is missing.
[Spree WARNING] remove_code_from_spree_promotions from spree is missing.
[Spree WARNING] remove_currency_from_line_items from spree is missing.
[Spree WARNING] remove_default_tax_from_spree_zones from spree is missing.
[Spree WARNING] remove_is_default_from_prices from spree is missing.
[Spree WARNING] remove_order_id_from_inventory_units from spree is missing.
[Spree WARNING] remove_spree_store_credits_column from spree is missing.
[Spree WARNING] rename_bogus_gateways from spree is missing.
[Spree WARNING] solidus_one_four from spree is missing.
[Spree WARNING] transform_tax_rate_category_relation from spree is missing.
[Spree WARNING] Run `bundle exec rake railties:install:migrations` to get them.

Running bundle exec rake railties:install:migrations just copies the migrations into the main migrate directory which is un-needed in this instance since they exist in a solidus_migrate directory.

Expected behavior No warnings are shown since the migrations exist in a separate directory

blakeprudhomme avatar Sep 28 '21 13:09 blakeprudhomme

Looking at migrations.rb:

https://github.com/solidusio/solidus/blob/e878076f2ed670d07654ab6293a16588743f2fa6/core/lib/spree/migrations.rb#L68-L74

I wonder if it would be feasible to have the migration directory configurable?

Something like:

config.migration_directory = "#{Rails.root}/db/solidus_migrate"

blakeprudhomme avatar Sep 28 '21 14:09 blakeprudhomme

Hey @blakeprudhomme, we've done some work to introduce a new configuration value for the migration path. If you have a chance take a look at the PR and let us know if you have any feedback. Thanks for opening this issue and the suggestion you had!

forkata avatar Oct 14 '21 20:10 forkata

Awesome will take a look now!

blakeprudhomme avatar Oct 14 '21 20:10 blakeprudhomme

Closed by #4190

waiting-for-dev avatar Sep 05 '22 08:09 waiting-for-dev