2

Well... to be honest, I have absolutely no idea where to even start solving this.

I'd like to view a dependency tree of all my InnoDB tables' Foreign Keys. I want to have a visual representation available.

If it helps, it can be assumed that there are no circular references. I don't know if MySQL even lets you define a circular reference, but anyway...

I just need to know where to look to even find foreign key information, or if there's already a solution out there to do this.

Balaji Kandasamy
  • 4,446
  • 10
  • 40
  • 58
Niet the Dark Absol
  • 320,036
  • 81
  • 464
  • 592
  • Did you see this http://stackoverflow.com/a/11302791/1554982? Looks like you could use the results from this to build up a tree. – Sepster Apr 20 '13 at 16:17

1 Answers1

3

The easiest way to see all the foreign keys is via:

SELECT * FROM INFORMATION_SCHEMA.REFERENTIAL_CONSTRAINTS

Coupled with

SELECT * FROM INFORMATION_SCHEMA.TABLE_CONSTRAINTS

this should provide you the information you are looking for.

Ross Smith II
  • 11,799
  • 1
  • 38
  • 43