Author Topic: Postgresql database model synchronisation  (Read 3561 times)

benem

  • EA Novice
  • *
  • Posts: 7
  • Karma: +0/-0
    • View Profile
Postgresql database model synchronisation
« on: May 07, 2020, 08:01:39 pm »
Hi all.
I'm using Enterprise Architect to model a DB schema.

Everything works as intended: I create the model, generate the DDL and export to the DB using the ODBC connection.

The problems arrives when I try to compare the model and the DB to synchronise the changes (done manually on the DB or on the model).

In the shows differences page, all the tables and functions on the DB have public. in front the name and doesn't matches with those on the model that doesn't have it.

As a workaround, I can put public as owner of the table/function in the model. But I don't want do it as I don't want to tie the schema/user to the model (not table by table at least).

Is the another way to tell EA to consider tables without owner as in the public schema? Or, better, strip the schema from the elements in the DB/ODBC connection?

Thanks.

« Last Edit: May 07, 2020, 08:08:23 pm by benem »

pvickers

  • EA User
  • **
  • Posts: 44
  • Karma: +7/-0
    • View Profile
Re: Postgresql database model synchronisation
« Reply #1 on: May 08, 2020, 01:29:57 am »
One way to deal with this is to use the "Compare with options"...and set "Owner" to false.
This way the table owner will be ignored for the comparison.

Hope this helps.

Perry

benem

  • EA Novice
  • *
  • Posts: 7
  • Karma: +0/-0
    • View Profile
Re: Postgresql database model synchronisation
« Reply #2 on: May 08, 2020, 02:17:30 am »
Unfortunately it doesn't work.

Owner to false is the default option.

I think that public in Postgres is a schema, not the owner.

I need an option to ignore the schema.

pvickers

  • EA User
  • **
  • Posts: 44
  • Karma: +7/-0
    • View Profile
Re: Postgresql database model synchronisation
« Reply #3 on: May 09, 2020, 02:17:18 am »
Hi Benem,

Great to hear you are using PostgreSQL…and yes, in PostgreSQL “public” is considered to be a schema.

Generally, I would encourage you to specify the schema name in the model.  This can be very useful as your model grows in complexity.  This will help later when you wish to maintain synchronization between the physical database and the physical model in Sparx EA.
In Sparx EA, the "owner" equates to the "schema" used by PostgreSQL.
(Below I refer to the Sparx EA term "owner", this means the PostgreSQL schema name.)

However, if you wish to avoid specifying the owner in the model, you can do that too.
If you do this, you will have to run the database compare using the “Show Differences with Options”, specify “false” for the owner.  Then in the database compare results list, in the “Action” column, set the option to “Pair with <table-name>”.

Another thing to know about is the ability to easily change the tables’ owner name.
You can use the database builder, right-click the database name and select “Manage DBMS Options”. 
In the lower right select “Change Owner”.  This will enable you to set the owner in the model to the owner name you wish.

Regards,
Perry
« Last Edit: May 09, 2020, 05:47:49 am by pvickers »