thuss / standalone-migrations

A gem to use Rails Database Migrations in non Rails projects
http://gabrito.com/post/standalone-migrations-using-rails-migrations-in-non-rails-projects
MIT License
992 stars 152 forks source link

`db` directory is created automatically when custom other path is specified #181

Closed Pysis868 closed 12 months ago

Pysis868 commented 12 months ago

Fix the lingering problem I was having: https://github.com/thuss/standalone-migrations/issues/170#issuecomment-1810509488

Possibly not yet handled because of a Rails upgrade?

If I explored this correctly, after a rake, Rails app, and configuration load, migrate, then dump the schema, and this dump creates the incorrect folder that I encountered.

In addition to the location mentioned in the stacktrace:

The other mkdir locations were in:

[6] pry(primary)> backtrace
--> #0  ActiveRecord::Tasks::DatabaseTasks.dump_schema(db_config#ActiveRecord::DatabaseConfigurations::HashConfig, format#Symbol) at /home/<username>/.local/share/gem/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/tasks/database_tasks.rb:431
    #1  block (4 levels) in block (4 levels) in <top (required)> at /home/<username>/.local/share/gem/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/railties/databases.rake:461
    ͱ-- #2  Array.each at /home/<username>/.local/share/gem/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/railties/databases.rake:457
    #3  block (3 levels) in block (3 levels) in <top (required)> at /home/<username>/.local/share/gem/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/railties/databases.rake:457
    #4  block in Rake::Task.block in execute(args#Rake::TaskArguments) at /home/<username>/.local/share/gem/ruby/3.2.0/gems/rake-13.1.0/lib/rake/task.rb:281
    ͱ-- #5  Array.each at /home/<username>/.local/share/gem/ruby/3.2.0/gems/rake-13.1.0/lib/rake/task.rb:281
    #6  Rake::Task.execute(args#Rake::TaskArguments) at /home/<username>/.local/share/gem/ruby/3.2.0/gems/rake-13.1.0/lib/rake/task.rb:281
    #7  block in Rake::Task.block in invoke_with_call_chain(task_args#Rake::TaskArguments, invocation_chain#Rake::InvocationChain::EmptyInvocationChain) at /home/<username>/.local/share/gem/ruby/3.2.0/gems/rake-13.1.0/lib/rake/task.rb:219
    ͱ-- #8  Monitor.synchronize at /home/<username>/.local/share/gem/ruby/3.2.0/gems/rake-13.1.0/lib/rake/task.rb:199
    #9  Rake::Task.invoke_with_call_chain(task_args#Rake::TaskArguments, invocation_chain#Rake::InvocationChain::EmptyInvocationChain) at /home/<username>/.local/share/gem/ruby/3.2.0/gems/rake-13.1.0/lib/rake/task.rb:199
    #10 Rake::Task.invoke(*args#Array) at /home/<username>/.local/share/gem/ruby/3.2.0/gems/rake-13.1.0/lib/rake/task.rb:188
    #11 block (2 levels) in block (2 levels) in <top (required)> at /home/<username>/.local/share/gem/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/railties/databases.rake:113
    #12 block in Rake::Task.block in execute(args#Rake::TaskArguments) at /home/<username>/.local/share/gem/ruby/3.2.0/gems/rake-13.1.0/lib/rake/task.rb:281
    ͱ-- #13 Array.each at /home/<username>/.local/share/gem/ruby/3.2.0/gems/rake-13.1.0/lib/rake/task.rb:281
    #14 Rake::Task.execute(args#Rake::TaskArguments) at /home/<username>/.local/share/gem/ruby/3.2.0/gems/rake-13.1.0/lib/rake/task.rb:281
    #15 block in Rake::Task.block in invoke_with_call_chain(task_args#Rake::TaskArguments, invocation_chain#Rake::InvocationChain::EmptyInvocationChain) at /home/<username>/.local/share/gem/ruby/3.2.0/gems/rake-13.1.0/lib/rake/task.rb:219
    ͱ-- #16 Monitor.synchronize at /home/<username>/.local/share/gem/ruby/3.2.0/gems/rake-13.1.0/lib/rake/task.rb:199
    #17 Rake::Task.invoke_with_call_chain(task_args#Rake::TaskArguments, invocation_chain#Rake::InvocationChain::EmptyInvocationChain) at /home/<username>/.local/share/gem/ruby/3.2.0/gems/rake-13.1.0/lib/rake/task.rb:199
    #18 Rake::Task.invoke(*args#Array) at /home/<username>/.local/share/gem/ruby/3.2.0/gems/rake-13.1.0/lib/rake/task.rb:188
    #19 block (2 levels) in block (2 levels) in <top (required)> at /home/<username>/.local/share/gem/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/railties/databases.rake:105
    #20 block in Rake::Task.block in execute(args#Rake::TaskArguments) at /home/<username>/.local/share/gem/ruby/3.2.0/gems/rake-13.1.0/lib/rake/task.rb:281
    ͱ-- #21 Array.each at /home/<username>/.local/share/gem/ruby/3.2.0/gems/rake-13.1.0/lib/rake/task.rb:281
    #22 Rake::Task.execute(args#Rake::TaskArguments) at /home/<username>/.local/share/gem/ruby/3.2.0/gems/rake-13.1.0/lib/rake/task.rb:281
    #23 block in Rake::Task.block in invoke_with_call_chain(task_args#Rake::TaskArguments, invocation_chain#Rake::InvocationChain::EmptyInvocationChain) at /home/<username>/.local/share/gem/ruby/3.2.0/gems/rake-13.1.0/lib/rake/task.rb:219
    ͱ-- #24 Monitor.synchronize at /home/<username>/.local/share/gem/ruby/3.2.0/gems/rake-13.1.0/lib/rake/task.rb:199
    #25 Rake::Task.invoke_with_call_chain(task_args#Rake::TaskArguments, invocation_chain#Rake::InvocationChain::EmptyInvocationChain) at /home/<username>/.local/share/gem/ruby/3.2.0/gems/rake-13.1.0/lib/rake/task.rb:199
    #26 Rake::Task.invoke(*args#Array) at /home/<username>/.local/share/gem/ruby/3.2.0/gems/rake-13.1.0/lib/rake/task.rb:188
    #27 Rake::Application.invoke_task(task_string#String) at /home/<username>/.local/share/gem/ruby/3.2.0/gems/rake-13.1.0/lib/rake/application.rb:182
    #28 block (2 levels) in Rake::Application.block (2 levels) in top_level at /home/<username>/.local/share/gem/ruby/3.2.0/gems/rake-13.1.0/lib/rake/application.rb:138
    ͱ-- #29 Array.each at /home/<username>/.local/share/gem/ruby/3.2.0/gems/rake-13.1.0/lib/rake/application.rb:138
    #30 block in Rake::Application.block in top_level at /home/<username>/.local/share/gem/ruby/3.2.0/gems/rake-13.1.0/lib/rake/application.rb:138
    #31 Rake::Application.run_with_threads at /home/<username>/.local/share/gem/ruby/3.2.0/gems/rake-13.1.0/lib/rake/application.rb:147
    #32 Rake::Application.top_level at /home/<username>/.local/share/gem/ruby/3.2.0/gems/rake-13.1.0/lib/rake/application.rb:132
    #33 block in Rake::Application.block in run(argv#Array) at /home/<username>/.local/share/gem/ruby/3.2.0/gems/rake-13.1.0/lib/rake/application.rb:83
    #34 Rake::Application.standard_exception_handling at /home/<username>/.local/share/gem/ruby/3.2.0/gems/rake-13.1.0/lib/rake/application.rb:208
    #35 Rake::Application.run(argv#Array) at /home/<username>/.local/share/gem/ruby/3.2.0/gems/rake-13.1.0/lib/rake/application.rb:80
    #36 <top (required)> at /home/<username>/.local/share/gem/ruby/3.2.0/gems/rake-13.1.0/exe/rake:27
    ͱ-- #37 Kernel.load at /home/<username>/bin/rake:25
    #38 <main> at /home/<username>/bin/rake:25