def base_classes(self): """ Returns all base classes for history model. """ parents = ( self.find_closest_versioned_parent() or self.manager.option(self.model, 'base_classes') or (declarative_base(self.model), ) ) return parents + (VersionClassBase, )
def build_models(self): """ Build declarative history models based on classes that were collected during class instrumentation process. """ if self.pending_classes: cls = self.pending_classes[0] self.declarative_base = declarative_base(cls) self.transaction_log_cls = self.create_transaction_log() self.transaction_changes_cls = self.create_transaction_changes() self.transaction_meta_cls = self.create_transaction_meta() for cls in self.pending_classes: if not self.option(cls, 'versioning'): continue table = self.closest_matching_table(cls) if table is not None: builder = ModelBuilder(self, cls) builder( table, self.transaction_log_cls, self.transaction_changes_cls )