TDatabaseManager.ValidateDatabase extension

Hello Wagner,

is it possible to extend the validation of a database?
I have for myself the class "TDatabaseManager" with the properties:

public property IgnoreRemoved: Boolean read FIgnoreRemoved write FIgnoreRemoved;

expanded.
The reason: I access the same database with different servers. There are more tables in the database than in the entities. I don't use the UpdateDatabase function, but the validation. I get errors that tables in the entity have been removed and the database is therefore out of order.
Or is there another, better way to ignore foreign tables in the DB?
The same could be done for columns, sequences, etc. But I don't need that.

I changed this:

procedure TDatabaseManager.ActionTableRemoved(Table: TTableMetadata);
begin
  if FAllowDestructiveCommands then
  begin
    FCommands.Add(TDropTableCommand.Create(Table));
    FActions.Add(TTableRemovedAction.Create(Table));
  end
  else *!!!*if not FIgnoreRemoved then*!!!*
    FErrors.Add(TTableRemovedError.Create(Table));
end;

Another point is that "domains" are not taken into account in the database.
Since we have to install our servers on different systems (previously Microsoft SQL Server and PostgreSQL), we use domains.
E.g.
PostgreSQL: Uuid
MSSQL: uniqueidentifier
We use the domain on MSSQL:
CREATE TYPE Uuid FROM uniqueidentifier;

We work around this problem by making the "IgnoreDataTypes" property public in the same class.
But it would be better if the data types were controlled.

We now have 2 new properties.
Can you maybe consider these in the next release? Then we don't always have to change the code.

Thanks very much
Thomas

Hi Thomas,

While I'm glad you found a suitable solution for your problem, I'm not sure if it's worth adding it to official Aurelius distribution simply because I consider it redundant.

The errors are polymorphic and detailed on purpose. You should/could simply interact through the Errors property and check (or remove) all the actions that are of type TTableRemoveError. This way you can ignore such actions.

Hm, yes, that's actually true. I can evaluate any problems centrally at my place.
Sure, that works. I could have recognized it myself. It's quite a lot of stress with me at the moment. Thanks.

1 Like

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.