0

I'm actually writing my Bachelorthesis and made an ER-Model upgrade for the database based on the stuff I need for the implementation.

My following problem is, that the database in my company is basically based on triggers and there is no actual ER-Model which I could use. Is it even possible to make an ER-Model based on a database which is pretty much only using trigger to interact with the tables inside? There are pretty much no foreign keys.

Thanks for your answers,

Cheers

Daniel Halling
  • 127
  • 3
  • 10
  • 1
    Another reason to add to the list of [reasons not to use stored procedures](http://stackoverflow.com/a/6369030/256196) – Bohemian Jul 21 '16 at 08:51
  • Yeah you got a point there... :) – Daniel Halling Jul 21 '16 at 09:03
  • I was badly scarred by building the entire business logic of a company in SPs (admittedly, not many triggers) - and it was all my design! It worked, but whoa...never again. I also lead (technically and politically) the total rewrite using app code. Using the DB for non-DB stuff is madness. It comes down to this: just because you *can* do something using some particular software doesn't mean you should. – Bohemian Jul 21 '16 at 09:28
  • yeah I can see it myself actually in the company where I write my thesis. But that database is a hugh mess imo. – Daniel Halling Jul 21 '16 at 09:37
  • 1
    The ER model is a conceptual model of the organization of data. It doesn't address data manipulation processes and events. UML activity and sequence diagrams may be more appropriate, but they don't show the organization of data. Nothing wrong with making two diagrams. – reaanb Jul 21 '16 at 10:14
  • Alright thanks for your answer. I'll do a UML for all the trigger stuff to show whats going on. – Daniel Halling Jul 21 '16 at 10:18

1 Answers1

0

the database [is] based on triggers and there is no actual ER-Model which I could use....

There are pretty much no foreign keys.

I must say it sounds like your are being badly advised. You have an academic project, the design of which does not use conventional foreign keys, and that cannot be modeled with an entity relationship diagram?

only using trigger to interact with the tables

Triggers were invented before DRI was defined in the SQL standard. IIRC, they were invented by Sybase, around 1986. If their use is restricted to enforcing referential integrity constraints -- as should be -- they will be used sparingly. Most RI enforcement since the advent of SQL-92 is readily and preferably supplied declaratively in the database schema. Triggers today are properly seen as obsolete and exotic: largely superseded by DRI, and occasionally useful as a workaround in weird situations.

Can database interaction be only through triggers? Trivially, no. A trigger cannot insert new data. Without ridiculous gyrations, a trigger cannot select data to be returned to the application. But in any case that's barely a database design issue: the observations hold, no matter the tables in question.

Community
  • 1
  • 1
James K. Lowden
  • 7,574
  • 1
  • 16
  • 31
  • wow first of all, thank you for your answer. I discussed the problem with some other developers in the company and made some other approach for the problem. Nontheless thanks for your answer! :) – Daniel Halling Aug 05 '16 at 10:27