Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
blakeprudhomme opened this issue Sep 28, 2021 · 4 comments
Closed
Labels
type:enhancement Proposed or newly added feature

Comments

@blakeprudhomme
Copy link

blakeprudhomme commented Sep 28, 2021

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
Copy link
Author

Looking at migrations.rb:

def app_dir
"#{Rails.root}/db/migrate"
end
def engine_dir
"#{config.root}/db/migrate"
end

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

Something like:

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

@forkata
Copy link
Contributor

forkata commented Oct 14, 2021

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!

@blakeprudhomme
Copy link
Author

Awesome will take a look now!

@waiting-for-dev waiting-for-dev added the type:enhancement Proposed or newly added feature label Sep 5, 2022
@waiting-for-dev
Copy link
Contributor

Closed by #4190

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:enhancement Proposed or newly added feature
Projects
None yet
Development

No branches or pull requests

3 participants