[odb-users] Drop table in schema migration

Dieter Govaerts dieter.govaerts at bricsys.com
Mon Apr 18 10:58:21 EDT 2016


Hello Boris,

On Monday, 18 April, 2016 16:40, "Boris Kolpackov" <boris at codesynthesis.com> said:
> dieter.govaerts at bricsys.com <dieter.govaerts at bricsys.com> writes:
> 
>> I would like to recreate a set of classes to include polymorphism using db
>> migration. There is no need to maintain the data so I would just have
>> increased the version, drop the tables, increase the version, recreate the
>> classes with polymorphism. I see however no documented way to immediately
>> drop the classes/tables from the db. Simply omitting the the header from the
>> "odb --generate-schema-only --schema-format separate --at-once" command
>> didn't work.
> 
> I am not sure what you mean by "immediately drop the classes/tables from the
> db". Also, are the old and new classes use the same table names? A concrete
> example would really help with understanding of what you are trying to
> achieve.

I meant to actually drop the table from the db as opposed to soft-delete as described in 13.4 of the manual. The new classes and the old classes will use the same names.

I currently have following classes in the db:
- Building
- Story
These classes are unrelated (polymorphic wise). I would like to replace it with the following hierarchy:
         SpatialStructure
            ^     ^
           /       \
    Building       Story
such that I can refer to either a building or a story with the ID of a SpatialStructure.

As said, data migration is not important. What I wanted was to create a new version 5 which forgets the original classes as if they never existed (drop table). Then create a new version 6 with the new structure.

Dieter




More information about the odb-users mailing list