Sha256: 88c11a2e90e2d234e24b86a93617f6a0357fe0d3834ff85468f7edb403145e24
Contents?: true
Size: 957 Bytes
Versions: 36
Compression:
Stored size: 957 Bytes
Contents
module CassandraObject module Migrations extend ActiveSupport::Concern extend ActiveSupport::Autoload included do class_attribute :migrations self.migrations = [] class_attribute :current_schema_version self.current_schema_version = 0 end autoload :Migration class MigrationNotFoundError < StandardError def initialize(record_version, migrations) super("Cannot migrate a record from #{record_version.inspect}. Migrations exist for #{migrations.map(&:version)}") end end module InstanceMethods def schema_version Integer(@schema_version || self.class.current_schema_version) end end module ClassMethods def migrate(version, &blk) migrations << Migration.new(version, blk) if version > self.current_schema_version self.current_schema_version = version end end end end end
Version data entries
36 entries across 36 versions & 1 rubygems