Sha256: caed4319b170928db853ab432ab034d5b8826ce3ae96fe82a49550a0441613cb

Contents?: true

Size: 472 Bytes

Versions: 1

Compression:

Stored size: 472 Bytes

Contents

module Caco::Postgres
  class Sql < Trailblazer::Operation
    step :build_command
    step Subprocess(Caco::Executer),
      input: { sql_command: :command },
      output: [:exit_code, :output, :stderr],
      id: "shell"

    def build_command(ctx, sql:, **)
      ctx[:sql_command] = "su -l -c \"psql -e -U postgres -d postgres <<EOF
      #{sql}
      EOF
      \" postgres"
      # ctx[:sql_command] = "psql -U fernandes -d postgres -c \"#{sql}\""
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
caco-0.1.0 lib/caco/postgres/sql.rb