Class: Penthouse::Tenants::OctopusSchemaTenant

Inherits:
SchemaTenant show all
Defined in:
lib/penthouse/tenants/octopus_schema_tenant.rb

Direct Known Subclasses

OctopusShardTenant

Instance Attribute Summary

Attributes inherited from SchemaTenant

#default_schema, #persistent_schemas, #tenant_schema

Attributes inherited from BaseTenant

#identifier

Instance Method Summary collapse

Methods inherited from SchemaTenant

#initialize

Methods included from Migratable

#migrate

Methods inherited from BaseTenant

#initialize

Constructor Details

This class inherits a constructor from Penthouse::Tenants::SchemaTenant

Instance Method Details

#call(shard: :master, &block) {|SchemaTenant| ... } ⇒ void

This method returns an undefined value.

ensures we’re on the correct Octopus shard, then just updates the schema name with the tenant name

Parameters:

  • shard (String, Symbol) (defaults to: :master)

    The shard to execute within, usually master

  • block (Block)

    The code to execute within the schema

Yields:



23
24
25
26
27
# File 'lib/penthouse/tenants/octopus_schema_tenant.rb', line 23

def call(shard: :master, &block)
  Octopus.using(shard) do
    super(&block)
  end
end

#createvoid

This method returns an undefined value.

creates the tenant schema within the master shard



32
33
34
# File 'lib/penthouse/tenants/octopus_schema_tenant.rb', line 32

def create(*)
  call { super }
end

#deletevoid

This method returns an undefined value.

drops the tenant schema within the master shard



39
40
41
# File 'lib/penthouse/tenants/octopus_schema_tenant.rb', line 39

def delete(*)
  call { super }
end

#exists?Boolean

returns whether or not the schema exists

Returns:

  • (Boolean)

    whether or not the schema exists in the master shard

See Also:



46
47
48
# File 'lib/penthouse/tenants/octopus_schema_tenant.rb', line 46

def exists?(*)
  call { super }
end