First Commit
This commit is contained in:
1 parent
5eb9dd037d
commit
2e62c0e60b
11877 files changed
+2035312
No files matched your search
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
include "db.php";
|
||||
include "table.php";
|
||||
|
||||
|
||||
$query = "show tables";
|
||||
$results = db_query($query);
|
||||
|
||||
$TableList = array();
|
||||
while ($row = db_fetch_assoc($results)) {
|
||||
$TableList[] = $row['Tables_in_hotlunch'];
|
||||
}
|
||||
|
||||
for ($j = 0; $j < count($TableList); $j++) {
|
||||
$TableName = $TableList[$j];
|
||||
|
||||
$pflag = false;
|
||||
$table = new Table($TableName);
|
||||
|
||||
for ($i = 0; $i < count($table->column_names); $i++) {
|
||||
|
||||
if ($table->column_types[$i] == 'enum') {
|
||||
$fname = $table->column_names[$i];
|
||||
$fvalues = $table->column_values[$i];
|
||||
$fdefault = $table->column_defaults[$i];
|
||||
|
||||
if (strlen($fdefault) == 0) {
|
||||
// if ($pflag == false) echo("$TableName:\n");
|
||||
// $pflag = true;
|
||||
|
||||
// echo(" - $fname $fvalues\n");
|
||||
$values = explode(",", $fvalues);
|
||||
$default = $values[0];
|
||||
|
||||
$query = "alter table $TableName change $fname $fname enum($fvalues) default $default";
|
||||
echo("$query;\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// echo("\n");
|
||||
}
|
||||
|
||||
?>
|
||||
Reference in new issue
Block a user