Sha256: a1d15863c7f1f995dac2ddcc78c73656e921d0e846ac63bfdece3f183f644c3e

Contents?: true

Size: 785 Bytes

Versions: 6

Compression:

Stored size: 785 Bytes

Contents

# frozen_string_literal: true

require "snowpack/cli/application/command"
require_relative "utils/database_config"

module Snowpack
  module CLI
    module Application
      module Commands
        module DB
          class Drop < Command
            desc "Delete database"

            def call(**)
              db_name = database_config.db_name

              system(database_config.cli_env_vars, "dropdb #{Shellwords.escape(db_name)}")
              out.puts "=> database #{db_name} dropped" if $?.success?
            end

            private

            def database_config
              @database_config ||= Utils::DatabaseConfig.for_application(application)
            end
          end
        end

        register "db drop", Commands::DB::Drop
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
snowpack-1.0.0.alpha7 lib/snowpack/cli/application/commands/db/drop.rb
snowpack-1.0.0.alpha6 lib/snowpack/cli/application/commands/db/drop.rb
snowpack-1.0.0.alpha5 lib/snowpack/cli/application/commands/db/drop.rb
snowpack-1.0.0.alpha4 lib/snowpack/cli/application/commands/db/drop.rb
snowpack-1.0.0.alpha3 lib/snowpack/cli/application/commands/db/drop.rb
snowpack-1.0.0.alpha2 lib/snowpack/cli/application/commands/db/drop.rb