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

schema.rb created when schema_format set to :sql #93

Open
jkogara opened this issue Feb 9, 2021 · 1 comment
Open

schema.rb created when schema_format set to :sql #93

jkogara opened this issue Feb 9, 2021 · 1 comment

Comments

@jkogara
Copy link

jkogara commented Feb 9, 2021

Description

  • As of rails 6.1 rake db:structure:{load|dump} are deprecated and db:schema:{load|dump} are called under the hood. This results in the schema task in hair trigger creating a schema.rb for the project even though it is not required.

Steps to Reproduce

  • Create a new 6.1 rails app and set the schema_format to :sql
  • Run migrations, a schema.rb will be created.

Possible Solution

  • Update the schema:dump task in hair_trigger to use ActiveRecord::Base.schema_format value to determine if the schema.rb file should be generated.
@holstvoogd
Copy link

I've attempted a fix in my fork, basically just setting the previous schema before the regular tasks. It seems to work, but I'm not clear on the use case for setting the previous schema exactly; so I can't verify if everything still works; but the output is the same and when using format=sql, it does only generate a structure.sql.

jenseng pushed a commit that referenced this issue Jan 2, 2024
Fix for #93.
Behavior stays the same as it was for Rails 5 and above.
As it's said in the issue, we don't need to generate a `schema.rb` when
we don't have the setting `schema_format = :ruby`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants