Example #1
0
 public function getAddTablesDDL(Database $database)
 {
     $ret = $this->getBeginDDL();
     foreach ($database->getTablesForSql() as $table) {
         $ret .= $this->getCommentBlockDDL($table->getName());
         $ret .= $this->getDropTableDDL($table);
         $ret .= $this->getAddTableDDL($table);
         $ret .= $this->getAddIndicesDDL($table);
     }
     $ret2 = '';
     foreach ($database->getTablesForSql() as $table) {
         $ret2 .= $this->getAddForeignKeysDDL($table);
     }
     if ($ret2) {
         $ret .= $this->getCommentBlockDDL('Foreign Keys') . $ret2;
     }
     $ret .= $this->getEndDDL();
     return $ret;
 }
Example #2
0
 public function getWarnings(Database $database, PropelPLatformInterface $platform)
 {
     foreach ($database->getTablesForSql() as $table) {
         foreach ($table->getForeignKeys() as $fk) {
             if ($platform instanceof MssqlPlatform && $fk->hasOnUpdate() && $fk->getOnUpdate() == ForeignKey::SETNULL) {
                 // there may be others that also won't work
                 // we have to skip this because it's unsupported.
                 $this->log(sprintf('Ignoring the "ON UPDATE SET NULL" option for "%s" fk on "%s" table (unsupported by MSSQL).', $fk->getLocalColumnNames(), $table->getName()), Project::MSG_WARN);
             }
             if ($platform instanceof MssqlPlatform && $fk->hasOnDelete() && $fk->getOnDelete() == ForeignKey::SETNULL) {
                 // there may be others that also won't work
                 // we have to skip this because it's unsupported.
                 $this->log(sprintf('Ignoring the "ON DELETE SET NULL" option for "%s" fk on "%s" table (unsupported by MSSQL).', $fk->getLocalColumnNames(), $table->getName()), Project::MSG_WARN);
             }
             if ($platform instanceof OraclePlatform && $fk->hasOnUpdate()) {
                 // there may be others that also won't work
                 // we have to skip this because it's unsupported.
                 $this->log(sprintf('Ignoring the "ON UPDATE" option for "%s" fk on "%s" table (unsupported by current Oracle adapter).', $fk->getLocalColumnNames(), $table->getName()), Project::MSG_WARN);
             }
         }
     }
 }
 public function getAddTablesDDL(Database $database)
 {
     $ret = $this->getBeginDDL();
     foreach ($database->getTablesForSql() as $table) {
         $ret .= $this->getCommentBlockDDL($table->getName());
         $ret .= $this->getDropTableDDL($table);
         $ret .= $this->getAddTableDDL($table);
     }
     $ret .= $this->getEndDDL();
     return $ret;
 }