Add imports support for Command

This commit is contained in:
Alexander Fuhr 2015-06-29 10:39:37 +02:00
parent c7f7d37523
commit cdb66b648a
6 changed files with 84 additions and 0 deletions

View File

@ -50,5 +50,10 @@ class IcingaCommandForm extends DirectorObjectForm
'template' => $this->translate('Command template'),
))
));
$this->addElement('text', 'imports', array(
'label' => $this->translate('Imports'),
'description' => $this->translate('The inherited command template names')
));
}
}

View File

@ -20,6 +20,8 @@ class IcingaCommand extends IcingaObject
protected $supportsCustomVars = true;
protected $supportsImports = true;
protected function renderMethods_execute()
{
// Execute is a reserved word in SQL, column name was prefixed

View File

@ -0,0 +1,17 @@
CREATE TABLE icinga_command_inheritance (
command_id INT(10) UNSIGNED NOT NULL,
parent_command_id INT(10) UNSIGNED NOT NULL,
weight MEDIUMINT UNSIGNED DEFAULT NULL,
PRIMARY KEY (command_id, parent_command_id),
UNIQUE KEY unique_order (command_id, weight),
CONSTRAINT icinga_command_inheritance_command
FOREIGN KEY command (command_id)
REFERENCES icinga_command (id)
ON DELETE CASCADE
ON UPDATE CASCADE,
CONSTRAINT icinga_command_inheritance_parent_command
FOREIGN KEY command (parent_command_id)
REFERENCES icinga_command (id)
ON DELETE RESTRICT
ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

View File

@ -206,6 +206,24 @@ CREATE TABLE icinga_command (
ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE icinga_command_inheritance (
command_id INT(10) UNSIGNED NOT NULL,
parent_command_id INT(10) UNSIGNED NOT NULL,
weight MEDIUMINT UNSIGNED DEFAULT NULL,
PRIMARY KEY (command_id, parent_command_id),
UNIQUE KEY unique_order (command_id, weight),
CONSTRAINT icinga_command_inheritance_command
FOREIGN KEY command (command_id)
REFERENCES icinga_command (id)
ON DELETE CASCADE
ON UPDATE CASCADE,
CONSTRAINT icinga_command_inheritance_parent_command
FOREIGN KEY command (parent_command_id)
REFERENCES icinga_command (id)
ON DELETE RESTRICT
ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE icinga_command_argument (
id INT(10) UNSIGNED AUTO_INCREMENT NOT NULL,
command_id INT(10) UNSIGNED NOT NULL,

View File

@ -0,0 +1,20 @@
CREATE TABLE icinga_command_inheritance (
command_id integer NOT NULL,
parent_command_id integer NOT NULL,
weight integer DEFAULT NULL,
PRIMARY KEY (command_id, parent_command_id),
CONSTRAINT icinga_command_inheritance_command
FOREIGN KEY (command_id)
REFERENCES icinga_command (id)
ON DELETE CASCADE
ON UPDATE CASCADE,
CONSTRAINT icinga_command_inheritance_parent_command
FOREIGN KEY (parent_command_id)
REFERENCES icinga_command (id)
ON DELETE RESTRICT
ON UPDATE CASCADE
);
CREATE UNIQUE INDEX command_inheritance_unique_order ON icinga_command_inheritance (command_id, weight);
CREATE INDEX command_inheritance_command ON icinga_command_inheritance (command_id);
CREATE INDEX command_inheritance_command_parent ON icinga_command_inheritance (parent_command_id);

View File

@ -263,6 +263,28 @@ CREATE INDEX command_zone ON icinga_command (zone_id);
COMMENT ON COLUMN icinga_command.object_type IS 'external_object is an attempt to work with existing commands';
CREATE TABLE icinga_command_inheritance (
command_id integer NOT NULL,
parent_command_id integer NOT NULL,
weight integer DEFAULT NULL,
PRIMARY KEY (command_id, parent_command_id),
CONSTRAINT icinga_command_inheritance_command
FOREIGN KEY (command_id)
REFERENCES icinga_command (id)
ON DELETE CASCADE
ON UPDATE CASCADE,
CONSTRAINT icinga_command_inheritance_parent_command
FOREIGN KEY (parent_command_id)
REFERENCES icinga_command (id)
ON DELETE RESTRICT
ON UPDATE CASCADE
);
CREATE UNIQUE INDEX command_inheritance_unique_order ON icinga_command_inheritance (command_id, weight);
CREATE INDEX command_inheritance_command ON icinga_command_inheritance (command_id);
CREATE INDEX command_inheritance_command_parent ON icinga_command_inheritance (parent_command_id);
CREATE TABLE icinga_command_argument (
id serial,
command_id integer NOT NULL,