Skip to content

Commit

Permalink
Uppercase metadata columns
Browse files Browse the repository at this point in the history
  • Loading branch information
kitloong committed Mar 26, 2020
1 parent 3bc5582 commit d522c9b
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/Xethron/MigrationsGenerator/Generators/FieldGenerator.php
Expand Up @@ -55,12 +55,12 @@ public function generate($table, $schema, $database, $ignoreIndexNames)
protected function getEnum($table)
{
try {
$result = DB::table('information_schema.columns')
->where('table_schema', $this->database)
->where('table_name', $table)
->where('data_type', 'enum')
->get(['column_name', 'column_type']);
if ($result) {
$result = DB::table('information_schema.COLUMNS')
->where('TABLE_SCHEMA', $this->database)
->where('TABLE_NAME', $table)
->where('DATA_TYPE', 'enum')
->get(['COLUMN_NAME', 'COLUMN_TYPE']);
if (count($result)) {
return $result;
} else {
return [];
Expand All @@ -78,8 +78,8 @@ protected function getEnum($table)
protected function setEnum(array $fields, $table)
{
foreach ($this->getEnum($table) as $column) {
$fields[$column->column_name]['type'] = 'enum';
$fields[$column->column_name]['args'] = str_replace('enum(', 'array(', $column->column_type);
$fields[$column->COLUMN_NAME]['type'] = 'enum';
$fields[$column->COLUMN_NAME]['args'] = str_replace('enum(', 'array(', $column->COLUMN_TYPE);
}
return $fields;
}
Expand Down

1 comment on commit d522c9b

@kitloong
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#2 Changed to uppercase

Please sign in to comment.