Sha256: e12c6d7b88a5beafd6611b4bec431da5f612a9d3eea54d014baf6a47f06ee46d

Contents?: true

Size: 966 Bytes

Versions: 14

Compression:

Stored size: 966 Bytes

Contents

#
# This class provides an abstract for the tenant interface. Whilst any Proc
# could be used, it's safest for people to sub-class to ensure that any future
# interface changes are catered for.
#
# A tenant class's responsibility is to receive a block, around which it should
# handle switching to the given tenant's configuration, ensuring that if an
# exception occurs, the configuration is reset back to the global configuration.
#
module Penthouse
  module Tenants
    module Migratable

      # @param db_schema_file [String] a path to the DB schema file to load, defaults to Penthouse.configuration.db_schema_file
      # @return [void]
      def migrate(db_schema_file: Penthouse.configuration.db_schema_file)
        if File.exist?(db_schema_file)
          # run the migrations within this schema
          call { load(db_schema_file) }
        else
          raise ArgumentError, "#{db_schema_file} does not exist"
        end
      end

    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
penthouse-0.10.0 lib/penthouse/tenants/migratable.rb
penthouse-0.9.0 lib/penthouse/tenants/migratable.rb
penthouse-0.8.0 lib/penthouse/tenants/migratable.rb
penthouse-0.7.5 lib/penthouse/tenants/migratable.rb
penthouse-0.7.4 lib/penthouse/tenants/migratable.rb
penthouse-0.7.3 lib/penthouse/tenants/migratable.rb
penthouse-0.7.2 lib/penthouse/tenants/migratable.rb
penthouse-0.7.1 lib/penthouse/tenants/migratable.rb
penthouse-0.7.0 lib/penthouse/tenants/migratable.rb
penthouse-0.6.0 lib/penthouse/tenants/migratable.rb
penthouse-0.5.0 lib/penthouse/tenants/migratable.rb
penthouse-0.4.2 lib/penthouse/tenants/migratable.rb
penthouse-0.4.1 lib/penthouse/tenants/migratable.rb
penthouse-0.4.0 lib/penthouse/tenants/migratable.rb