J3 Issue ?
avatar alikon
alikon
12 Jun 2017

The problem

In the current CMS schema even if all tables (for mysql) are declared ENGINE=InnoDB and
InnoDB table type does support Foreign Keys, we still have the same schema as we were stuck on MYISAM without FK support

The proposal

  1. Review the CMS schema
  2. Define Relations between Tables/Entity
  3. For each Relation define the type of relationships (1:1), (1:n), (m:n)
  4. Define the foreign key
  5. For each FK define actions ON UPDATE / ON DELETE
  6. Implement the DBAL to manage FK

Expected result

the referential integrity is managed by the DB layer using FK

Actual result

The pseudo Foreign Key are made by code
as for example ( #__menu , #__ menu_types) etc.

Example

fk

A menu type may have (0..n) menu items
A menu item must have (1:1) and only menu type

ALTER TABLE #__menu  
ADD FOREIGN KEY ('menutype', 'client_id')
REFERENCES #__menu_types ('menutype', 'client_id')
ON DELETE CASCADE
ON UPDATE CASCADE

Additional comments

postgresql & mssql already supports Referential Integrity/ Foreign Keys

avatar alikon alikon - open - 12 Jun 2017
avatar joomla-cms-bot joomla-cms-bot - change - 12 Jun 2017
Labels Added: ?
avatar joomla-cms-bot joomla-cms-bot - labeled - 12 Jun 2017
avatar franz-wohlkoenig franz-wohlkoenig - change - 12 Jun 2017
Category SQL
avatar mbabker
mbabker - comment - 12 Jun 2017

All I can say is a big ? from me.

avatar zero-24 zero-24 - change - 12 Jun 2017
Labels Added: ?
avatar zero-24 zero-24 - labeled - 12 Jun 2017
avatar franz-wohlkoenig franz-wohlkoenig - change - 12 Jun 2017
Status New Discussion
avatar alikon alikon - change - 13 Jun 2017
The description was changed
avatar alikon alikon - edited - 13 Jun 2017
avatar franz-wohlkoenig franz-wohlkoenig - change - 4 Apr 2019
Labels Added: J3 Issue
avatar franz-wohlkoenig franz-wohlkoenig - labeled - 4 Apr 2019
avatar franz-wohlkoenig franz-wohlkoenig - change - 20 Apr 2019
Title
[RFC] Referential Integrity / Foreign Key - Support
Referential Integrity / Foreign Key - Support
avatar franz-wohlkoenig franz-wohlkoenig - edited - 20 Apr 2019
avatar alikon
alikon - comment - 21 Jul 2019

lack of interest as every db related stuffs

avatar alikon alikon - close - 21 Jul 2019
avatar alikon alikon - change - 21 Jul 2019
Status Discussion Closed
Closed_Date 0000-00-00 00:00:00 2019-07-21 07:05:01
Closed_By alikon
Labels Added: ?
Removed: ?
avatar joomla-cms-bot joomla-cms-bot - change - 21 Jul 2019
Labels Removed: ?
avatar joomla-cms-bot joomla-cms-bot - unlabeled - 21 Jul 2019

Add a Comment

Login with GitHub to post a comment