class Runcobo::Tasks::Database

Defined in:

tasks/database.cr

Constant Summary

CONNECTION_OVERRIDES = ["PGHOST", "PGHOSTADDR", "PGPORT", "PGDATABASE", "PGSERVICE", "PGSERVICEFILE", "PGOPTIONS", "MYSQL_HOST", "MYSQL_TCP_PORT", "MYSQL_UNIX_PORT"] of ::String
DEPLOYMENT_KINDS = ["staging", "production"] of ::String
DEPLOYMENT_OPTIONS = SAFE_OPTIONS + (["sslrootcert", "sslcert", "sslkey", "sslcrl", "target_session_attrs"] of ::String)
LOCAL_KINDS = ["development", "test"] of ::String
MYSQL_TLS_MODES = ["true", "false", "skip-verify", "preferred"] of ::String
SAFE_OPTIONS = ["application_name", "connect_timeout", "sslmode"] of ::String

Constructors

Class Method Summary

Instance Method Summary

Constructor Detail

def self.new(settings : Config, runner : Runcobo::Tasks::Runner = Runner.new) #

[View source]

Class Method Detail

def self.validate_migration_kind(kind : String, operation : String) #

[View source]

Instance Method Detail

def connection_environment(environment = ENV.to_h) : Hash(String, String) #

[View source]
def console(kind : String) #

[View source]
def database_name(kind : String) : String #

[View source]
def database_url(kind : String, environment = ENV.to_h) : String #

[View source]
def default_database_url(kind : String) : String #

[View source]
def engine : Engine #

[View source]
def ensure_database(kind : String) : String #

[View source]
def local : Path #

[View source]
def migrate(kind : String, options = Migrations::Options.new) #

[View source]
def migration_database_url(kind : String, operation : String, environment = ENV.to_h) : String #

[View source]
def mysql(url : String, source : String | Nil = nil, *, database : Bool = true, command = "mysql", extra : Array(String) = [] of String, capture : Bool = true, input : Process::Stdio = Process::Redirect::Close) : Result #

Runs the MySQL client against a server from a URL. The password, if any, is passed in a private option file rather than on the command line.


[View source]
def prepare(kind : String) #

[View source]
def psql(url : String, source : String | Nil = nil, *, capture : Bool = true) : Result #

[View source]
def rollback(kind : String, options = Migrations::Options.new) #

[View source]
def runner : Runner #

[View source]
def seed(kind : String) #

[View source]
def settings : Config #

[View source]
def sqlite_path(url : String) : Path #

The database file of a SQLite URL, resolved from the project root.


[View source]
def status(kind : String, options = Migrations::Options.new) #

[View source]
def wait(kind : String, options = Migrations::Options.new) #

[View source]