Skip to content

Commit 80e0cd3

Browse files
committed
Quoted path to <Rails.env>_structure.sql file in db:test:clone_structure task.
Leaving the path unquoted causes errors in paths containing spaces or dashes.
1 parent 1eac911 commit 80e0cd3

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

activerecord/lib/active_record/railties/databases.rake

+2-2
Original file line numberDiff line numberDiff line change
@@ -424,10 +424,10 @@ db_namespace = namespace :db do
424424
ENV['PGHOST'] = abcs['test']['host'] if abcs['test']['host']
425425
ENV['PGPORT'] = abcs['test']['port'].to_s if abcs['test']['port']
426426
ENV['PGPASSWORD'] = abcs['test']['password'].to_s if abcs['test']['password']
427-
`psql -U "#{abcs['test']['username']}" -f #{Rails.root}/db/#{Rails.env}_structure.sql #{abcs['test']['database']} #{abcs['test']['template']}`
427+
`psql -U "#{abcs['test']['username']}" -f "#{Rails.root}/db/#{Rails.env}_structure.sql" #{abcs['test']['database']} #{abcs['test']['template']}`
428428
when /sqlite/
429429
dbfile = abcs['test']['database'] || abcs['test']['dbfile']
430-
`sqlite3 #{dbfile} < #{Rails.root}/db/#{Rails.env}_structure.sql`
430+
`sqlite3 #{dbfile} < "#{Rails.root}/db/#{Rails.env}_structure.sql"`
431431
when 'sqlserver'
432432
`sqlcmd -S #{abcs['test']['host']} -d #{abcs['test']['database']} -U #{abcs['test']['username']} -P #{abcs['test']['password']} -i db\\#{Rails.env}_structure.sql`
433433
when 'oci', 'oracle'

0 commit comments

Comments
 (0)