Class: Hanami::CliSubCommands::DB Private

Inherits:
Thor
  • Object
show all
Extended by:
Hanami::CliBase
Defined in:
lib/hanami/cli_sub_commands/db.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

A set of subcommands related to DB

It is run with:

`bundle exec hanami db`

Since:

  • 0.6.0

Instance Method Summary collapse

Methods included from Hanami::CliBase

define_commands

Instance Method Details

#applyObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Since:

  • 0.6.0


63
64
65
66
67
68
69
70
71
# File 'lib/hanami/cli_sub_commands/db.rb', line 63

def apply
  if options[:help]
    invoke :help, ['apply']
  else
    assert_development_environment!
    require 'hanami/commands/db/apply'
    Hanami::Commands::DB::Apply.new(options).start
  end
end

#console(name = nil) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Since:

  • 0.6.0


17
18
19
20
21
22
23
24
# File 'lib/hanami/cli_sub_commands/db.rb', line 17

def console(name = nil)
  if options[:help]
    invoke :help, ['console']
  else
    require 'hanami/commands/db/console'
    Hanami::Commands::DB::Console.new(options, name).start
  end
end

#createObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Since:

  • 0.6.0


28
29
30
31
32
33
34
35
36
# File 'lib/hanami/cli_sub_commands/db.rb', line 28

def create
  if options[:help]
    invoke :help, ['create']
  else
    assert_allowed_environment!
    require 'hanami/commands/db/create'
    Hanami::Commands::DB::Create.new(options).start
  end
end

#dropObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Since:

  • 0.6.0


40
41
42
43
44
45
46
47
48
# File 'lib/hanami/cli_sub_commands/db.rb', line 40

def drop
  if options[:help]
    invoke :help, ['drop']
  else
    assert_allowed_environment!
    require 'hanami/commands/db/drop'
    Hanami::Commands::DB::Drop.new(options).start
  end
end

#migrate(version = nil) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Since:

  • 0.6.0


52
53
54
55
56
57
58
59
# File 'lib/hanami/cli_sub_commands/db.rb', line 52

def migrate(version = nil)
  if options[:help]
    invoke :help, ['migrate']
  else
    require 'hanami/commands/db/migrate'
    Hanami::Commands::DB::Migrate.new(options, version).start
  end
end

#prepareObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Since:

  • 0.6.0


75
76
77
78
79
80
81
82
83
# File 'lib/hanami/cli_sub_commands/db.rb', line 75

def prepare
  if options[:help]
    invoke :help, ['prepare']
  else
    assert_allowed_environment!
    require 'hanami/commands/db/prepare'
    Hanami::Commands::DB::Prepare.new(options).start
  end
end

#versionObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Since:

  • 0.6.0


89
90
91
92
93
94
95
96
# File 'lib/hanami/cli_sub_commands/db.rb', line 89

def version
  if options[:help]
    invoke :help, ['version']
  else
    require 'hanami/commands/db/version'
    Hanami::Commands::DB::Version.new(options).start
  end
end