> and it was on IRC so better get it out here. What exactly happens if I for
> instance add an +Aux relation, will the DB engine recognize that it's new
> and create the index to include all concerned objects, or will it simply
When the DB model (the "er.l" file) is changed, it is not automatically
detected at runtime. This would be difficult, as it might require a scan
of the whole database. Also, a program is allowed to create arbitrary
data, possibly outside the DB model, so such an automatism would be
The programmer must understand the implications of a change, and run an
explicit rebuild-script. Adding or changing an index (like adding an
+Aux relation) is one of the most typical cases.
> come in to effect on all objects created from now on or will it corrupt the
> DB? If I recall correctly it will simply work from now on but existing
> objects won't be included in the index.
Yes. The DB is not really corrupted in such a case, but the affected
objects may not be found at searches.
> And if I recall correctly I believe there were also some tools to rebuild in
> situations like this or?
'rebuild' (in "lib/too.l") can be used for that.
Sometimes, such modifications can be rather complex, and involve changes
in the structures or types of objects. I strongly recommend to test it
first on a local copy of the database.
It is tricky if not only an index, but the type of indexed data changes.
For example, I had the case last week that the "Land" property of
several object classes changed from a plain string
to an entity
(+Ref +Link) NIL (+Land))
Then simply changing the string in all objects to a '+Link' does not
work, because the new index has a different structure. Therefore,
removing the old string must happen in the old model, while setting the
+Link to the land object must happen in the new model. I achieved this
by switching the class of that relation daemon with 'bind' during each
(for (This ...) # Iterate all involved objects
(let Str (: lnd) # Keep the string value
(bind # Temporarily set old relation classes
(cons (get '+Cls1 'lnd) '(+Need +Sn +Idx +String))
(cons (get '+Cls2 'lnd) '(+Ref +String))
(put> This 'lnd NIL) ) # Clear old value and index
(put> This 'lnd # Set new (entity) value and build index
(request '(+Land) ... Str ..) ) ) )
This is just an example how complex such changes can be. But, on the
other hand, there is almost no limit on what can be done.