Sha256: 50197cf43f2a1a61b59a9c36fea91aec8d3430f4afc3dfa9e536d548288f9a23
Contents?: true
Size: 1.25 KB
Versions: 2
Compression:
Stored size: 1.25 KB
Contents
# frozen_string_literal: true require 'active_model' require_relative '../crud/json_file' require_relative '../services/migration_version/hydrator_service' require_relative '../validators/version_validator' module Dsu module Models # This class represents a dsu migration_version. class MigrationVersion < Crud::JsonFile include Support::Fileable attr_reader :options alias exist? file_exist? def initialize(version: nil, options: {}) super(migration_version_path) FileUtils.mkdir_p migration_version_folder @options = options || {} @version = version and return if version file_hash = if exist? read do |migration_version_hash| hydrated_hash = Services::MigrationVersion::HydratorService.new(migration_version_hash: migration_version_hash).call migration_version_hash.merge!(hydrated_hash) end end self.version = file_hash.try(:[], :version) || 0 end # Returns true if the current dsu install is the # current migration version. def current_migration? version == Dsu::Migration::VERSION end def to_h { version: version } end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
dsu-2.4.4 | lib/dsu/models/migration_version.rb |
dsu-2.4.3 | lib/dsu/models/migration_version.rb |