Probably database relationship cycle -


my issue related cycle relationship, need solve database schema in order best practice, used on tracking vehicles system

my problem description:

  1. a route contain on or more fences, , fence coul contained 1 or more routes
  2. a route has assigned vehicles ( consider vehicles part or other routes )
  3. when route, contain fences, has vehicle assigned, need control when vehicle pass inside fence; need store if fence set on each vehicle compare when vehicle inside fence

i have solved issue on these way, ma not sure is practice, if no, which 1 best practice problem?

cycle problem

1 - route contain on or more fences, , fence coul contained 1 or more routes

    route --< routefencerelationship >-- fence      "routefencerelationship"     pk routefencerelationshipid     fk routeid     fk fenceid 

many many relationships don't work well, i'd heavily suggest relationship table define routes contain fences.

2 - route has assigned vehicles ( consider vehicles part or other routes )

    vehicle --< vehiclerouterelationship >-- route      "vehiclerouterelationship"     pk vehicleroutrelationshipid     fk vehicleid     fk routeid 

same again here, relationship table avoid issues come many many relationship.

3 - when route, contain fences, has vehicle assigned, need control when vehicle pass inside fence; need store if fence set on each vehicle compare when vehicle inside fence

    fence --< fencevehiclepassevent >-- vehicle      "fencevehiclepassevent"     pk fencevehiclepasseventid     fk fenceid     fk vehicleid     timestamp 

i didn't understand third point, can add entry in table vehicle, fence , time passes through. looking for?


Comments

Popular posts from this blog

php - Calling a template part from a post -

Firefox SVG shape not printing when it has stroke -

How to mention the localhost in android -