Dumping db structure after migrations fails for projects with spaces in their path
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 72/100
Research direction
Search the Hanami CLI code for .exec_load_command, then read the migration flow that invokes it and any related tests. Reproduce by running hanami db migrate from a project path containing spaces; done means the migration completes and the structure dump succeeds with the path intact.
Written by the indexing model from the issue text.
Description
Describe the bug
If the project's path contains spaces, at the end of a database migration when the database structure is loaded with .exec_load_command those spaces get interpreted as multiple shell arguments, raising an error.
=> database db/hanami_app.sqlite migrated in 0.001s
Error: in prepare, near "out": syntax error
out/hanami_app
^--- error here
!!! => "db/hanami_app.sqlite structure dumped to config/db/structure.sql" FAILED
To Reproduce
Create a directory with a space. Within that directory create a new hanami application with a single migration. Run the migration and the error occurs.
$ mkdir "spaced out" && cd "spaced out"
$ hanami new hanami_app
Created hanami_app/
-> Within hanami_app/
[truncated]
$ cat <<EOF > config/db/migrate/20261011205238_create_table.rb
ROM::SQL.migration do
change do
create_table :foo do
primary_key :bar
column :baz, :text, null: false
end
end
end
EOF
$ bundle exec hanami db migrate
=> database db/hanami_app.sqlite migrated in 0.001s
Error: in prepare, near "out": syntax error
out/hanami_app
^--- error here
!!! => "db/hanami_app.sqlite structure dumped to config/db/structure.sql" FAILED
Expected behavior
Hanami should gracefully handle paths with spaces by quoting them or using some other shell-safe method.
My environment
- Ruby version: ruby 4.0.6 (2026-07-14 revision 03b6d3f889) +PRISM [arm64-darwin24]
- OS: macOS
- Dominant language
- Ruby
- Stars
- 33
- Forks
- 54
- Avg merge
- 12h 48m
- Merged PRs (30d)
- 2
Getting set up
- Ships a Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from hanami/hanami-cli
-
db commands hand psql the user and password still percent encodedPossibly taken @aaronmallen claimed this 13 days ago. Openbug
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
hanami/hanami-cli#449 · 1 comment · 1 assignee ·
-
Difficulty 3/5 1-2 days Newbie friendliness 35/100
hanami/hanami-cli#450 ·
-
MariaDB supportOpen
Difficulty 5/5 Over a week Newbie friendliness 35/100
hanami/hanami-cli#448 · 3 comments ·
-
bug help wanted
Difficulty 3/5 1-2 days Newbie friendliness 55/100
hanami/hanami-cli#438 · 3 comments ·
-
Difficulty 3/5 1-2 days Newbie friendliness 65/100
hanami/hanami-cli#418 ·
All issues in hanami/hanami-cli
Similar issues
-
documentation
Difficulty 1/5 Under an hour Newbie friendliness 86/100
bridgetownrb/bridgetown#1130 ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
stripe/stripe-ruby#1994 ·
Maintainers usually reply within 1 day
-
[Fehler]: /abdeckstift wirft 500 — part_type aus der Phonemreduction-Umbenennung nicht mitgezogenOpenbug
Difficulty 2/5 1-3 hours Newbie friendliness 73/100
wort-schule/wort.schule#787 ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
lugassawan/swe-workbench#799 ·
Maintainers usually reply within 1 day
-
2.8.6: NoMethodError "undefined method 'first'" in profdata_coverage_dir whenever --scheme is usedOpen
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
SlatherOrg/slather#586 · 2 comments ·