Sha256: 5c7a94d109fc16db30ea107c503778f3821b77b4954a0c41214f0fcf3deea2a5
Contents?: true
Size: 1.24 KB
Versions: 25
Compression:
Stored size: 1.24 KB
Contents
module Neo4j module Migrations # Overrides the init_on_load method so that it will check if any migration is needed. # The init_on_create method is also overridden so that it sets the version to the latest migration number # when a new node is created. # # Migration will take place if needed when the node is loaded. # module LazyNodeMixin extend ActiveSupport::Concern included do extend Neo4j::Migrations::ClassMethods end module ClassMethods # Remote all migration and set migrate_to = nil # Does not change the version of nodes. def reset_migrations! @migrations = nil @migrate_to = nil end end def migrate! self.class._migrate!(self._java_node, self) end def init_on_create(*) super # set the db version to the current self[:_db_version] = self.class.migrate_to end def init_on_load(*) # :nodoc: super migrate! # this if for Neo4j::Rails::Model which keeps the properties in this variable @properties.clear if instance_variable_defined? :@properties end def db_version self[:_db_version] end end end end
Version data entries
25 entries across 25 versions & 1 rubygems