Sha256: 9d4c8610c1775d2875572344b4916ddc69a2ed0a6c8edc2951d952b9c77dce7c

Contents?: true

Size: 948 Bytes

Versions: 18

Compression:

Stored size: 948 Bytes

Contents

module Hanami
  class CLI
    module Commands
      module Db
        # @since 1.1.0
        # @api private
        class Console < Command
          requires 'model.sql'

          desc "Starts a database console"

          # @since 1.1.0
          # @api private
          def call(**options)
            context = Context.new(options: options)

            start_console(context)
          end

          private

          # @since 1.1.0
          # @api private
          def start_console(*)
            exec console.connection_string
          end

          # @since 1.1.0
          # @api private
          def configuration_url
            Hanami::Components['model.configuration'].url
          end

          # @since 1.1.0
          # @api private
          def console
            require "hanami/model/sql/console"
            Hanami::Model::Sql::Console.new(configuration_url)
          end
        end
      end
    end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
hanami-1.3.5 lib/hanami/cli/commands/db/console.rb
hanami-1.3.4 lib/hanami/cli/commands/db/console.rb
hanami-1.3.3 lib/hanami/cli/commands/db/console.rb
hanami-1.3.2 lib/hanami/cli/commands/db/console.rb
hanami-1.3.1 lib/hanami/cli/commands/db/console.rb
hanami-1.3.0 lib/hanami/cli/commands/db/console.rb
hanami-1.3.0.beta1 lib/hanami/cli/commands/db/console.rb
hanami-1.2.0 lib/hanami/cli/commands/db/console.rb
hanami-1.2.0.rc2 lib/hanami/cli/commands/db/console.rb
hanami-1.2.0.rc1 lib/hanami/cli/commands/db/console.rb
hanami-1.2.0.beta2 lib/hanami/cli/commands/db/console.rb
hanami-1.2.0.beta1 lib/hanami/cli/commands/db/console.rb
hanami-1.1.1 lib/hanami/cli/commands/db/console.rb
hanami-1.1.0 lib/hanami/cli/commands/db/console.rb
hanami-1.1.0.rc1 lib/hanami/cli/commands/db/console.rb
hanami-1.1.0.beta3 lib/hanami/cli/commands/db/console.rb
hanami-1.1.0.beta2 lib/hanami/cli/commands/db/console.rb
hanami-1.1.0.beta1 lib/hanami/cli/commands/db/console.rb