Module: Penthouse::Tenants::Migratable

Included in:
SchemaTenant
Defined in:
lib/penthouse/tenants/migratable.rb

Instance Method Summary collapse

Instance Method Details

#migrate(db_schema_file: Penthouse.configuration.db_schema_file) ⇒ void

This method returns an undefined value.

Parameters:

  • db_schema_file (String) (defaults to: Penthouse.configuration.db_schema_file)

    a path to the DB schema file to load, defaults to Penthouse.configuration.db_schema_file



16
17
18
19
20
21
22
23
# File 'lib/penthouse/tenants/migratable.rb', line 16

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