Database Manager, UpdateDatabase non destructive?

Hi Wagner,

We have some relationships in our database that we don't want Aurelius to map. Which is fine but when we use TDatabaseManager.Update database it deletes these relationships. I thought the database manager was non-destructive.

We are using Firebird 2.5, we have a uniquely indexed field on one table (not the primary key) that at the database level is a foreign key on another table.

Here is what we see when we check the database

/*
Action: Foreign key: USERS_ACCESS.FK_USERS_ACCESS_1 - Removed.
Action: Foreign key: USERS_ACCESS.FK_USERS_ACCESS_2 - Removed.
Action: Unique key: GROUPS.UNQ1_GROUPS - Removed.
Action: Column: USERS.IS_WEB_USER - Created.
Action: Foreign key: GROUPS_ACCESS.FK_GROUPS_ACCESS_1 - Removed.
Action: Foreign key: GROUPS_ACCESS.FK_GROUPS_ACCESS_2 - Removed.
Action: Unique key: PERMISSIONS.UNQ1_PERMISSIONS - Removed.
Action: Foreign key: GROUP_MEMBERS.FK_GROUP_MEMBERS_1 - Removed.
Action: Foreign key: GROUP_MEMBERS.FK_GROUP_MEMBERS_2 - Removed.

*/
ALTER TABLE GROUPS_ACCESS
  DROP CONSTRAINT FK_GROUPS_ACCESS_1 ;
ALTER TABLE GROUPS_ACCESS
  DROP CONSTRAINT FK_GROUPS_ACCESS_2 ;
ALTER TABLE GROUP_MEMBERS
  DROP CONSTRAINT FK_GROUP_MEMBERS_1 ;
ALTER TABLE GROUP_MEMBERS
  DROP CONSTRAINT FK_GROUP_MEMBERS_2 ;
ALTER TABLE USERS_ACCESS
  DROP CONSTRAINT FK_USERS_ACCESS_1 ;
ALTER TABLE USERS_ACCESS
  DROP CONSTRAINT FK_USERS_ACCESS_2 ;
ALTER TABLE PERMISSIONS
  DROP CONSTRAINT UNQ1_PERMISSIONS ;
ALTER TABLE GROUPS
  DROP CONSTRAINT UNQ1_GROUPS ;  

Hi Steve,
Indeed, the "destructive" operations of database manager relates to data. A foreign key can be created because it doesn't destroy any data, and is a "100% safe" operation, in the sense that it will never raise an error - as opposed to an operation to create a foreign key, which can fail because data in database can be inconsistent.

The list of operations Aurelius database manager does and does is listed here:

https://doc.tmssoftware.com/biz/aurelius/guide/database.html#actions

You can see that removing foreign keys and unique keys are valid operations.

It's also worth noting that Aurelius does support foreign keys referencing fields that are not primary keys.