[elephant-devel] Fix for class redefinition schema bug

Leslie P. Polzer leslie.polzer at gmx.net
Mon Sep 1 12:41:38 UTC 2008


Problem: when a class schema is introduced its db schema doesn't
get saved.

Proposal:

--- old-unstable/src/elephant/classes.lisp      2008-09-01 14:37:20.462677601 +0200
+++ new-unstable/src/elephant/classes.lisp      2008-09-01 14:37:20.462677601 +0200
@@ -92,16 +92,18 @@

 (defmethod finalize-inheritance :after ((instance persistent-metaclass))
   "Constructs the metaclass schema when the class hierarchy is valid"
   (let* ((old-schema (%class-schema instance))
         (new-schema (compute-schema instance)))
     ;; Update schema chain
     (setf (schema-predecessor new-schema) old-schema)
     (setf (%class-schema instance) new-schema)
+    (when *store-controller*
+      (lookup-schema *store-controller* instance)) ; ensure db schema
     ;; Cleanup some slot values
     (let ((idx-state (%class-indexing instance)))
       (when (consp idx-state)
        (setf (%class-indexing instance) (first idx-state))))
     ;; Compute derived index triggers
     (awhen (derived-index-slot-defs instance)
       (compute-derived-index-triggers instance it))
     ;; Synchronize instances to new schemas

Issue: What happens when the store controller isn't open
at class definition time? Is this a problem?

Should we perhaps walk all persistent classes and ensure
that they have db schemas whenever a store controller is opened?

  Leslie

-- 
LinkedIn Profile: http://www.linkedin.com/in/polzer
Xing Profile: https://www.xing.com/profile/LeslieP_Polzer
Blog: http://blog.viridian-project.de/




More information about the elephant-devel mailing list