Sha256: b5474b8b3411c839e1b6945f009d91cde5bc3b7c1faf5d4caf23e7e6b7f59aba

Contents?: true

Size: 738 Bytes

Versions: 4

Compression:

Stored size: 738 Bytes

Contents

module Cardio
  class Migration
    # methods for stamping migration versions to files
    module Stamp
      def stamp
        mode do
          return unless (version = stampable_version) && (file = stamp_file)
          puts ">>  writing version: #{version} to #{file.path}"
          file.puts version
        end
      end

      private

      def stamp_file
        ::File.open stamp_path, "w"
      end

      def stampable_version
        version = ActiveRecord::Migrator.current_version
        version.to_i.positive? && version
      end

      def stamp_path
        stamp_dir = ENV["SCHEMA_STAMP_PATH"] || File.join(Cardio.root, "db")

        File.join stamp_dir, "version_#{migration_type}.txt"
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
card-1.108.1 lib/cardio/migration/stamp.rb
card-1.108.0 lib/cardio/migration/stamp.rb
card-1.107.0 lib/cardio/migration/stamp.rb
card-1.106.0 lib/cardio/migration/stamp.rb