|
5 | 5 | namespace Icinga\Module\Icingadb\Model;
|
6 | 6 |
|
7 | 7 | use Icinga\Module\Icingadb\Common\Auth;
|
| 8 | +use Icinga\Module\Icingadb\Common\Backend; |
8 | 9 | use Icinga\Module\Icingadb\Model\Behavior\BoolCast;
|
9 | 10 | use Icinga\Module\Icingadb\Model\Behavior\HasProblematicParent;
|
10 | 11 | use Icinga\Module\Icingadb\Model\Behavior\ReRoute;
|
@@ -70,7 +71,7 @@ public function getKeyName()
|
70 | 71 |
|
71 | 72 | public function getColumns()
|
72 | 73 | {
|
73 |
| - return [ |
| 74 | + $columns = [ |
74 | 75 | 'environment_id',
|
75 | 76 | 'name_checksum',
|
76 | 77 | 'properties_checksum',
|
@@ -105,14 +106,19 @@ public function getColumns()
|
105 | 106 | 'zone_name',
|
106 | 107 | 'zone_id',
|
107 | 108 | 'command_endpoint_name',
|
108 |
| - 'command_endpoint_id', |
109 |
| - 'affected_children' |
| 109 | + 'command_endpoint_id' |
110 | 110 | ];
|
| 111 | + |
| 112 | + if (Backend::getDbSchemaVersion() >= 6) { |
| 113 | + $columns[] = 'affected_children'; |
| 114 | + } |
| 115 | + |
| 116 | + return $columns; |
111 | 117 | }
|
112 | 118 |
|
113 | 119 | public function getColumnDefinitions()
|
114 | 120 | {
|
115 |
| - return [ |
| 121 | + $columns = [ |
116 | 122 | 'environment_id' => t('Environment Id'),
|
117 | 123 | 'name_checksum' => t('Service Name Checksum'),
|
118 | 124 | 'properties_checksum' => t('Service Properties Checksum'),
|
@@ -148,8 +154,13 @@ public function getColumnDefinitions()
|
148 | 154 | 'zone_id' => t('Zone Id'),
|
149 | 155 | 'command_endpoint_name' => t('Endpoint Name'),
|
150 | 156 | 'command_endpoint_id' => t('Endpoint Id'),
|
151 |
| - 'affected_children' => t('Affected Children') |
152 | 157 | ];
|
| 158 | + |
| 159 | + if (Backend::getDbSchemaVersion() >= 6) { |
| 160 | + $columns['affected_children'] = t('Affected Children'); |
| 161 | + } |
| 162 | + |
| 163 | + return $columns; |
153 | 164 | }
|
154 | 165 |
|
155 | 166 | public function getSearchColumns()
|
@@ -196,7 +207,9 @@ public function createBehaviors(Behaviors $behaviors)
|
196 | 207 | 'command_endpoint_id'
|
197 | 208 | ]));
|
198 | 209 |
|
199 |
| - $behaviors->add(new HasProblematicParent()); |
| 210 | + if (Backend::getDbSchemaVersion() >= 6) { |
| 211 | + $behaviors->add(new HasProblematicParent()); |
| 212 | + } |
200 | 213 | }
|
201 | 214 |
|
202 | 215 | public function createDefaults(Defaults $defaults)
|
|
0 commit comments