コード例 #1
0
ファイル: Entangler.php プロジェクト: tristanpemble/lhm_php
 /**
  * @return string
  */
 protected function createDeleteTrigger()
 {
     $name = $this->trigger('delete');
     $primaryKey = $this->sqlHelper->extractPrimaryKey($this->origin);
     if (empty($primaryKey)) {
         throw new \RuntimeException("Table `{$this->origin->getName()}` does not have a primary key.");
     }
     $primaryKey = $this->sqlHelper->quoteColumn($primaryKey);
     $originName = $this->adapter->quoteTableName($this->origin->getName());
     $destinationName = $this->adapter->quoteTableName($this->destination->getName());
     return implode("\n ", ["CREATE TRIGGER {$name}", "AFTER DELETE ON {$originName} FOR EACH ROW", "DELETE IGNORE FROM {$destinationName} {$this->sqlHelper->annotation()}", "WHERE {$destinationName}.{$primaryKey} = OLD.{$primaryKey}"]);
 }
コード例 #2
0
 public function testAnnotation()
 {
     $this->assertEquals("/* large hadron migration (php) */", $this->helper->annotation());
 }