class Legion::Extensions::Data::Migrator

Public Class Methods

new(path, extension, _lex_name, **) click to toggle source
Calls superclass method
# File lib/legion/extensions/data/migrator.rb, line 7
def initialize(path, extension, _lex_name, **)
  Legion::Logging.fatal @extension
  @path = path
  @extension = extension
  super(Legion::Data::Connection.sequel, path)
end

Public Instance Methods

default_schema_column() click to toggle source
# File lib/legion/extensions/data/migrator.rb, line 14
def default_schema_column
  :schema_version
end
default_schema_table() click to toggle source
# File lib/legion/extensions/data/migrator.rb, line 18
def default_schema_table
  :extensions
end
ds()
Alias for: schema_dataset
schema_dataset() click to toggle source
# File lib/legion/extensions/data/migrator.rb, line 22
def schema_dataset
  dataset = Legion::Data::Connection.sequel.from(default_schema_table).where(namespace: @extension)
  return dataset unless dataset.count.positive?

  Legion::Logging.unknown Legion::Data::Model::Extension.insert(active: 1, namespace: @extension, extension: lex_name)
  Legion::Data::Connection.sequel.from(default_schema_table).where(namespace: @extension)
end
Also aliased as: ds