mirror of
https://github.com/vrana/adminer.git
synced 2026-02-08 07:40:16 +01:00
Shorten all but numeric and date types in select
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
- Improve print of nested tables
|
||||
- Hide sort links on unsortable columns
|
||||
- Display uneditable fields in edit form
|
||||
- Shorten all but numeric and date types in select
|
||||
- PostgreSQL: Offer foreign keys in create table
|
||||
- PostgreSQL: Add missing parentheses to CHECK export
|
||||
- PostgreSQL: Allow creating NOT DEFERRABLE foreign keys
|
||||
|
||||
@@ -846,7 +846,7 @@ function is_url(?string $string): bool {
|
||||
* @param array{type: string} $field
|
||||
*/
|
||||
function is_shortable(array $field): bool {
|
||||
return preg_match('~char|text|json|lob|geometry|point|linestring|polygon|string|bytea|hstore~', $field["type"]);
|
||||
return !preg_match('~' . number_type() . '|date|time|year~', $field["type"]);
|
||||
}
|
||||
|
||||
/** Split server into host and (port or socket)
|
||||
|
||||
@@ -180,7 +180,7 @@ if (isset($_GET["igdb"])) {
|
||||
if (preg_match('~^DEPRECATED!~', $comment)) {
|
||||
continue;
|
||||
}
|
||||
$this->fields[$table]['id'] = array('full_type' => 'bigserial', 'comment' => '');
|
||||
$this->fields[$table]['id'] = array('full_type' => 'bigint', 'comment' => '');
|
||||
$this->links[$link] = $table;
|
||||
$this->tables[$table] = array('Name' => $table, 'Comment' => $comment);
|
||||
foreach ($xpath->query('tbody/tr', $els[$i+2]) as $tr) {
|
||||
@@ -355,9 +355,10 @@ if (isset($_GET["igdb"])) {
|
||||
function fields($table) {
|
||||
$return = array();
|
||||
foreach (driver()->fields[$table] ?: array() as $key => $val) {
|
||||
$type = strtolower(preg_replace('~ .*~', '', $val['full_type']));
|
||||
$return[$key] = $val + array(
|
||||
"field" => $key,
|
||||
"type" => (preg_match('~^int|bool|enum~i', $val['full_type']) ? $val['full_type'] : 'varchar'), // shorten reference columns
|
||||
"type" => ($type == 'reference' ? 'int' : $type), // align right reference columns
|
||||
"privileges" => array("select" => 1) + ($table == 'webhooks' ? array() : array("where" => 1, "order" => 1)),
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user