title: MySQL deleting records that only exist in child table/cakephp update?
body: <p>I have two Myisam tables, let's say Parent and Child. Parent is created in a perl script. Parent is where the child gets the information(Not for editing) that's all the same, while Child holds information unique to it. Following Cakephp naming conventions, they're connected through the Parent's id field and the child's parent_id. When the Parent table is updated through another application(A record being added via Perl) it shows up in Child but if a record is deleted, Child doesn't update. Is there a way following cakephp conventions to have the table update(Removing the record that was deleted in Parent)?
  I do have 'dependent' => true in the parent table for the child? Does that need to be in the child table? Or does that not matter since the table is updated outside of the app?</p>
  
  <p>If nothing else, I can maybe set up a cron job to check the tables periodically, but i'm not sure how to find/delete the records in the child table that no longer exist in the Parent table via <strong>MYSQL</strong>. A combination of joins and where such n such &lt;>? So my question(s) are can i do it with cakephp if the table is updated outside of the app? Or how would I do it with mysql?</p>
  
  <p>Code:</p>
  
  <pre><code>&lt;?php
  class Drug extends AppModel {
      var $name = 'Drug';
    var $order = "Drug.generic ASC";
    var $useDbConfig = 'default';
    var $actsAs = array('ExtendAssociations', 'Containable');
  
    var $hasOne = array(
      'FrenchTranslation' =&gt; array(
          'className' =&gt; 'FrenchTranslation',
          'dependent' =&gt; true
      ),
      'GermanTranslation' =&gt; array(
          'className' =&gt; 'GermanTranslation',
          'dependent' =&gt; true
      ),
      'SpanishTranslation' =&gt; array(
          'className' =&gt; 'SpanishTranslation',
          'dependent' =&gt; true
      )
    );
  }
  ?&gt;
  
  &lt;?php
  class FrenchTranslation extends AppModel {
      var $name = 'FrenchTranslation';
      var $validate = array(
            'drug_id'=&gt;array(
           'The drug_id must be unique.'=&gt;array(
              'rule'=&gt;'isUnique',
              'message'=&gt;'The Drug ID must be unique.',
              'on'=&gt;'create'
            ),
            'The drug_id must be numeric.'=&gt;array(
              'rule'=&gt;array('numeric'),
              'message'=&gt;'The Drug ID must be numeric.'
            )
        ),
        'id'=&gt;array(
            'The id must be unique.'=&gt;array(
              'rule'=&gt;'isUnique',
              'message'=&gt;'The ID must be unique.',
              'on'=&gt;'create'
            ),
            'The id must be numeric.'=&gt;array(
              'rule'=&gt;array('numeric'),
              'message'=&gt;'The ID must be numeric.'            
            )
        )
    );
  
      var $belongsTo = array(
          'Drug' =&gt; array(
              'className' =&gt; 'Drug',
              'foreignKey' =&gt; 'drug_id',
              'conditions' =&gt; '',
              'fields' =&gt; '',
              'order' =&gt; ''
          ),
      'User'=&gt;array(
        'className'=&gt;'User',
        'foreignKey'=&gt;'user_id'
      ),
      );
  }
  ?&gt;
  </code></pre>