0

I'm creating a file system like directory management. Something like:

home
  - child
    - child
      - child
        - ...
  - child
    - child
  ...

I would like to store all data in one single table.

So I would have a record structured like this:

id (primary)    name (text)    parent_id (int)

The first record in the table would be "home" and would have as parent_id its own id, and can't be deleted.

For all other children I would like to add a foreign key for parent_id so that if the user deletes one of its parents all the children will be deleted in cascade.

I'm trying to do this with phpMyAdmin but I'm having some trouble.

I get here but I can't link the two fields (it only shows up the id field):

enter image description here

Can someone explain how I can achieve this? Thanks.

devamat
  • 2,293
  • 6
  • 27
  • 50

0 Answers0