Skip to content

Commit

Permalink
Fix exporter.
Browse files Browse the repository at this point in the history
  • Loading branch information
heycarsten committed Oct 30, 2014
1 parent 2add5cb commit dfe31fc
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/v1/exporter.rb
Expand Up @@ -160,10 +160,11 @@ def csv_file(table)

def copy(table)
db_name = ActiveRecord::Base.connection.current_database
db_host = ActiveRecord::Base.connection.instance_variable_get(:@config)[:host]
cols = DUMP_COLS[table].join(', ')
sql = "COPY #{table} (#{cols}) TO STDOUT DELIMITER ',' CSV HEADER"

`psql -d #{db_name} -o #{csv_file(table)} -c "#{sql}"`
`psql -U lcboapi -h #{db_host} -d #{db_name} -o #{csv_file(table)} -c "#{sql}"`
end
end
end

0 comments on commit dfe31fc

Please sign in to comment.