Book a Demo

Author Topic: Database design tool  (Read 3384 times)

MatsF

  • EA Novice
  • *
  • Posts: 2
  • Karma: +0/-0
  • I love YaBB 1G - SP1!
    • View Profile
Database design tool
« on: May 31, 2006, 07:19:36 am »
We have done a database design in EA based on several groups of tables which are sometimes related and sometimes not.  Does it exist any methods within EA or with any plugin, to model the overall database relations, based on the set of individual tables? If we use the DDL to create a database in eg. SQLserver there are tools to produce an overall database model.
Is it possible within EA?
MFn

«Midnight»

  • EA Guru
  • *****
  • Posts: 5651
  • Karma: +0/-0
  • That nice Mister Grey
    • View Profile
Re: Database design tool
« Reply #1 on: May 31, 2006, 07:46:57 am »
If I understand correctly what you want to do, I think there is. If you have either the DDL, or the actual schema built in SQL Server, you should be fine. Note that the directions below should work for any of the databases that EA recognizes.

Note that in order to do this you will have to create an ODBC data source to connect to your schema.

First, if you only have the DDL, use it to create an instance of the schema in SQL Server.

Open EA, and create a class diagram where you want your new model. Note that when you are done, all the elements in your data model will reside in the same package as the diagram, so make sure this is where you want things to go. [I usually make sure by creating a new, empty package and diagram.]

From the main menu, choose Project / Database Engineering / Import DB Schema from ODBC. In the dialog use the "..." button to set your data source to the target schema. Set the schema owner and check boxes as appropriate for your needs. Usually the default works well, but experiment if need be.

Make sure that the synchronization option is set to Import as New Objects. This will ensure that a new model is created.

You also need to ensure that the Import To... option is set to Diagram & Package. Otherwise the elements will be created but you will end up with a blank diagram.

Invoke the import. When you do, you will see a dialog that presents a list of available things for import. You probably want to click select all, but if not just choose the ones you want. Start the import and things should go smoothly from there.

One note, when EA finishes the import the dialog will remain (for some reason). You need to click the Close button to get back to your new model.

HTH,
David
No, you can't have it!

Dave_Bullet

  • EA User
  • **
  • Posts: 295
  • Karma: +0/-0
    • View Profile
Re: Database design tool
« Reply #2 on: May 31, 2006, 10:08:58 pm »
Do you mean produce a visual model of the related tables with their PK/FK connections?

If so - yes...
assuming your tables are already loaded into EA (either following the above reverse engineer instructions or if you have defined some tables....)

1. Create a class diagram
2. Drag on 1 or more of the tables you want to relate
3. Right click each table and select "Add -> Insert related elements"

EA will search and put onto the diagram any other tables that have an explicit (ie. FK) relationship defined.  Saves you having to manually go through each table and drag onto the diagram the ones that are related.

Cheers,
David.
"I know I'm close to a good design, but it's like the balloon animals, squeeze in one spot and the problem moves down the line"

MatsF

  • EA Novice
  • *
  • Posts: 2
  • Karma: +0/-0
  • I love YaBB 1G - SP1!
    • View Profile
Re: Database design tool
« Reply #3 on: May 31, 2006, 11:13:44 pm »
That was a good tip
Thanks ;)
MFn

«Midnight»

  • EA Guru
  • *****
  • Posts: 5651
  • Karma: +0/-0
  • That nice Mister Grey
    • View Profile
Re: Database design tool
« Reply #4 on: June 01, 2006, 04:33:00 am »
Of course you will first have to define the relationships someplace in order to use the Insert Related Elements feature.

However if you've already done the definitions, this is certainly the way to go. Not only that, but this is a good way to find problems - which will typically be 'missing' relations or unexpected behavior - on a one-by-one basis. Much easier to debug than the all at once method I gave above.

If you have not defined the relationships, try the import method. Just remember to use an empty package and diagram, and not to overwrite your existing work - use the settings given above - until you are sure it works.
No, you can't have it!