public function update() { parent::update(); if (!$this->silent) { echo "change field {$this->field} in {$this->table}\n"; } $table = $this->model->getRow($this->table); if (!$table) { throw new Kwf_ClientException("Table '{$this->table}' not found"); } $field = $table->getChildRows('Fields', $this->model->select()->whereId($this->field))->current(); if (!$field) { throw new Kwf_ClientException("Field {$this->field} does not exist"); } if (isset($this->type)) { $field->type = $this->type; } if (isset($this->null)) { $field->null = $this->null; } if (isset($this->key)) { $field->key = $this->key; } if ($this->default !== false) { $field->default = $this->default; } if (isset($this->extra)) { $field->extra = $this->extra; } $field->save(); return array(); }
public function update() { parent::update(); if (!$this->silent) { echo "drop table {$this->table}\n"; } $table = $this->model->getRow($this->table); if (!$table) { throw new Kwf_ClientException("Table '{$this->table}' does not exist"); } $table->delete(); return array(); }
public function update() { parent::update(); if (!$this->silent) { echo "drop field {$this->field} from {$this->table}\n"; } $table = $this->model->getRow($this->table); $field = $table->getChildRows('Fields', $this->model->select()->whereId($this->field))->current(); if (!$field) { throw new Kwf_ClientException("Field {$this->field} does not exist"); } $field->delete(); return array(); }
public function update() { parent::update(); if (!$this->silent) { echo "rename field {$this->field} in {$this->table}\n"; } $table = $this->model->getRow($this->table); if (!$table) { throw new Kwf_ClientException("Table '{$this->table}' not found"); } $field = $table->getChildRows('Fields', $this->model->select()->whereId($this->field))->current(); if (!$field) { throw new Kwf_ClientException("Field {$this->field} does not exist"); } $field->field = $this->newName; $field->save(); return array(); }