-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Support for comments on table in all databases #3512
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ | |
|
||
namespace Doctrine\DBAL\Schema; | ||
|
||
use Doctrine\DBAL\Platforms\DB2Platform; | ||
use Doctrine\DBAL\Types\Type; | ||
use const CASE_LOWER; | ||
use function array_change_key_case; | ||
|
@@ -209,4 +210,18 @@ protected function _getPortableViewDefinition($view) | |
|
||
return new View($view['name'], $sql); | ||
} | ||
|
||
public function listTableDetails($tableName) : Table | ||
{ | ||
$table = parent::listTableDetails($tableName); | ||
|
||
/** @var DB2Platform $platform */ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There seems to be some repetition of the code like this: most platforms override There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. True, but there is a catch. For most DBMS we want to fetch the comments. For MySQL, we fetch the comments + a bunch of metadata. What we could do is design a method that returns an array of "options" to be applied to the table. Something like: public function listTableDetails($tableName)
{
// ....
$options = $this->getTableOptions($tableName);
foreach ($options as $key => $value) {
$table->addOption($key, $value);
}
return $table;
} Now, for each |
||
$platform = $this->_platform; | ||
$sql = $platform->getListTableCommentsSQL($tableName); | ||
|
||
$tableOptions = $this->_conn->fetchAssoc($sql); | ||
$table->addOption('comment', $tableOptions['REMARKS']); | ||
|
||
return $table; | ||
} | ||
} |
Uh oh!
There was an error while loading. Please reload this page.