Skip to content

Commit

Permalink
fix get_opt and fix dump schema
Browse files Browse the repository at this point in the history
  • Loading branch information
Tanin authored and Tanin committed Apr 5, 2012
1 parent fcfc73b commit 47ed974
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 13 deletions.
2 changes: 1 addition & 1 deletion commands/dump.php
Expand Up @@ -16,7 +16,7 @@
$create_table_result = mysql_query("SHOW CREATE TABLE `" . $table_name . "`;");
$this_sql = mysql_fetch_array($create_table_result, MYSQL_NUM);

$dump_sql .= $this_sql[1] . "\n\n";
$dump_sql .= "mysql_query(\"" . $this_sql[1] . "\");\n\n";

mysql_free_result($create_table_result);
}
Expand Down
10 changes: 10 additions & 0 deletions schema/20120405121406_test_migration.sql
@@ -0,0 +1,10 @@
mysql_query("CREATE TABLE `members` (
`id` int(10) NOT NULL AUTO_INCREMENT,
`username` varchar(255) DEFAULT NULL,
`password` varchar(255) DEFAULT NULL,
`age` int(10) DEFAULT NULL,
`high_school` varchar(255) DEFAULT NULL,
`height` int(10) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1");

29 changes: 17 additions & 12 deletions test/config_hook.php
@@ -1,21 +1,26 @@
<?php
$options = getopt("", array("test"));

if (isset($options['test'])) {
try {
$options = getopt("", array("test"));

$mysql_database_name = $argv[2];
$mysql_username = $argv[3];
$mysql_password = $argv[4];
if (isset($options['test'])) {

$migration_dir = "test/migration";
$schema_dir = "test/schema";
$mysql_database_name = $argv[2];
$mysql_username = $argv[3];
$mysql_password = $argv[4];

$new_argv = array("migrate.php");
for ($i=5;$i<sizeof($argv);$i++) {
$new_argv[] = $argv[$i];
}
$migration_dir = "test/migration";
$schema_dir = "test/schema";

$new_argv = array("migrate.php");
for ($i=5;$i<sizeof($argv);$i++) {
$new_argv[] = $argv[$i];
}

$argv = $new_argv;
$argv = $new_argv;
}
} catch (Exception $e) {

}

?>

0 comments on commit 47ed974

Please sign in to comment.