-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
134 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,3 +7,4 @@ vendor | |
*_composite.xml | ||
clover.xml | ||
coveralls-upload.json | ||
phpunit.xml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<?php | ||
/** | ||
* DBSteward unit test for mysql5 foreign key extraction | ||
* | ||
* @package DBSteward | ||
* @license http://www.opensource.org/licenses/bsd-license.php Simplified BSD License | ||
*/ | ||
|
||
require_once __DIR__ . '/Mysql5ExtractionTest.php'; | ||
|
||
/** | ||
* @group mysql5 | ||
*/ | ||
class Mysql5ExtractCompoundForeignKeyTest extends Mysql5ExtractionTest { | ||
|
||
public function testCompoundFKeyExtraction() { | ||
$sql = <<<SQL | ||
CREATE TABLE t1 (c1 int, c2 int); | ||
CREATE TABLE t2 (c1 int, c2 int); | ||
CREATE INDEX t2_fkey_idx ON t2 (c1, c2); | ||
ALTER TABLE t1 ADD FOREIGN KEY (c1, c2) REFERENCES t2 (c1, c2) ON UPDATE RESTRICT ON DELETE SET NULL; | ||
SQL; | ||
|
||
$expected = <<<XML | ||
<foreignKey | ||
columns="c1, c2" | ||
foreignSchema="Mysql5ExtractionTest" | ||
foreignTable="t2" | ||
foreignColumns="c1, c2" | ||
constraintName="t1_ibfk_1" | ||
onDelete="SET_NULL"/> | ||
XML; | ||
|
||
$schema = $this->extract($sql); | ||
$this->assertEquals(simplexml_load_string($expected), $schema->table[0]->foreignKey); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters