Skip to content

Commit

Permalink
fix drop type error
Browse files Browse the repository at this point in the history
  • Loading branch information
mihailShumilov committed Feb 14, 2015
1 parent 802f3ab commit 9cced1a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions Convertor.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,8 @@ private function end($parser, $name)
case "table_structure":

if (array_key_exists("types", $this->tableFields)) {
foreach ($this->tableFields["types"] as $customType) {
fwrite( $this->oFh, "DROP TYPE IF EXISTS {$customType};\n" );
foreach ($this->tableFields["types"] as $customTypeName => $customType) {
fwrite( $this->oFh, "DROP TYPE IF EXISTS {$customTypeName};\n" );
fwrite($this->oFh, "CREATE TYPE " . $customType . ";\n");
}
}
Expand Down Expand Up @@ -229,7 +229,7 @@ private function convert_field_data($attrs)
} elseif (substr($attrs['Type'], 0, 4) == "enum") {
//Create custom type
$dataType = $this->tableFields['name'] . "_enum_" . $attrs['Field'];
$this->tableFields["types"][] = $dataType . " as " . $attrs['Type'];
$this->tableFields["types"][$dataType] = $dataType . " as " . $attrs['Type'];
$fieldStr .= $dataType . " ";
} else {
$fieldStr .= $attrs['Type'] . " ";
Expand Down

0 comments on commit 9cced1a

Please sign in to comment.