diff --git a/lib/Migration/Version000004Date20210331142734.php b/lib/Migration/Version000004Date20210331142734.php index 129c78aa..f7470ba3 100644 --- a/lib/Migration/Version000004Date20210331142734.php +++ b/lib/Migration/Version000004Date20210331142734.php @@ -6,6 +6,7 @@ use Closure; use OCP\DB\ISchemaWrapper; +use OCP\DB\Types; use OCP\Migration\SimpleMigrationStep; use OCP\Migration\IOutput; @@ -34,20 +35,20 @@ public function changeSchema(IOutput $output, Closure $schemaClosure, array $opt if (!$schema->hasTable('approval_rules')) { $table = $schema->createTable('approval_rules'); - $table->addColumn('id', 'integer', [ + $table->addColumn('id', Types::INTEGER, [ 'autoincrement' => true, 'notnull' => true, 'length' => 4, ]); - $table->addColumn('tag_pending', 'integer', [ + $table->addColumn('tag_pending', Types::INTEGER, [ 'notnull' => true, 'length' => 4, ]); - $table->addColumn('tag_approved', 'integer', [ + $table->addColumn('tag_approved', Types::INTEGER, [ 'notnull' => true, 'length' => 4, ]); - $table->addColumn('tag_rejected', 'integer', [ + $table->addColumn('tag_rejected', Types::INTEGER, [ 'notnull' => true, 'length' => 4, ]); @@ -56,20 +57,20 @@ public function changeSchema(IOutput $output, Closure $schemaClosure, array $opt if (!$schema->hasTable('approval_rule_requesters')) { $table = $schema->createTable('approval_rule_requesters'); - $table->addColumn('id', 'integer', [ + $table->addColumn('id', Types::INTEGER, [ 'autoincrement' => true, 'notnull' => true, 'length' => 4, ]); - $table->addColumn('rule_id', 'integer', [ + $table->addColumn('rule_id', Types::INTEGER, [ 'notnull' => true, 'length' => 4, ]); - $table->addColumn('entity_type', 'integer', [ + $table->addColumn('entity_type', Types::INTEGER, [ 'notnull' => true, 'length' => 4, ]); - $table->addColumn('entity_id', 'string', [ + $table->addColumn('entity_id', Types::STRING, [ 'notnull' => true, 'length' => 300, ]); @@ -78,20 +79,20 @@ public function changeSchema(IOutput $output, Closure $schemaClosure, array $opt if (!$schema->hasTable('approval_rule_approvers')) { $table = $schema->createTable('approval_rule_approvers'); - $table->addColumn('id', 'integer', [ + $table->addColumn('id', Types::INTEGER, [ 'autoincrement' => true, 'notnull' => true, 'length' => 4, ]); - $table->addColumn('rule_id', 'integer', [ + $table->addColumn('rule_id', Types::INTEGER, [ 'notnull' => true, 'length' => 4, ]); - $table->addColumn('entity_type', 'integer', [ + $table->addColumn('entity_type', Types::INTEGER, [ 'notnull' => true, 'length' => 4, ]); - $table->addColumn('entity_id', 'string', [ + $table->addColumn('entity_id', Types::STRING, [ 'notnull' => true, 'length' => 300, ]); diff --git a/lib/Migration/Version000004Date20210427102750.php b/lib/Migration/Version000004Date20210427102750.php index f3068efb..f962b8f8 100644 --- a/lib/Migration/Version000004Date20210427102750.php +++ b/lib/Migration/Version000004Date20210427102750.php @@ -6,6 +6,7 @@ use Closure; use OCP\DB\ISchemaWrapper; +use OCP\DB\Types; use OCP\Migration\SimpleMigrationStep; use OCP\Migration\IOutput; use OCP\IDBConnection; @@ -43,9 +44,9 @@ public function changeSchema(IOutput $output, Closure $schemaClosure, array $opt /** @var ISchemaWrapper $schema */ $schema = $schemaClosure(); $table = $schema->getTable('approval_rules'); - $table->addColumn('description', 'text', [ + $table->addColumn('description', Types::TEXT, [ 'notnull' => true, - 'default' => '', + 'default' => '???', ]); return $schema; } diff --git a/lib/Migration/Version000004Date20210427142434.php b/lib/Migration/Version000004Date20210427142434.php index d85b42d3..2efcb99b 100644 --- a/lib/Migration/Version000004Date20210427142434.php +++ b/lib/Migration/Version000004Date20210427142434.php @@ -6,6 +6,7 @@ use Closure; use OCP\DB\ISchemaWrapper; +use OCP\DB\Types; use OCP\Migration\SimpleMigrationStep; use OCP\Migration\IOutput; @@ -34,27 +35,27 @@ public function changeSchema(IOutput $output, Closure $schemaClosure, array $opt if (!$schema->hasTable('approval_activity')) { $table = $schema->createTable('approval_activity'); - $table->addColumn('id', 'integer', [ + $table->addColumn('id', Types::INTEGER, [ 'autoincrement' => true, 'notnull' => true, 'length' => 4, ]); - $table->addColumn('file_id', 'integer', [ + $table->addColumn('file_id', Types::INTEGER, [ 'notnull' => true, 'length' => 4, ]); - $table->addColumn('rule_id', 'integer', [ + $table->addColumn('rule_id', Types::INTEGER, [ 'notnull' => true, 'length' => 4, ]); - $table->addColumn('user_id', 'string', [ + $table->addColumn('user_id', Types::STRING, [ 'notnull' => true, 'length' => 300, ]); - $table->addColumn('new_state', 'integer', [ + $table->addColumn('new_state', Types::INTEGER, [ 'notnull' => true, ]); - $table->addColumn('timestamp', 'integer', [ + $table->addColumn('timestamp', Types::INTEGER, [ 'notnull' => true, 'length' => 4, ]); diff --git a/src/components/AdminSettings.vue b/src/components/AdminSettings.vue index 79feeec9..ee269073 100644 --- a/src/components/AdminSettings.vue +++ b/src/components/AdminSettings.vue @@ -165,7 +165,11 @@ export default { }, invalidRuleMessage() { const newRule = this.newRule - const noMissingField = newRule.tagPending && newRule.tagApproved && newRule.tagRejected && newRule.approvers.length > 0 + const noMissingField = newRule.description + && newRule.tagPending + && newRule.tagApproved + && newRule.tagRejected + && newRule.approvers.length > 0 if (!noMissingField) { return t('approval', 'All fields are required') } @@ -230,7 +234,7 @@ export default { }, onRuleInput(id, rule) { // save if all values are set - if (rule.tagPending && rule.tagApproved && rule.tagRejected && rule.approvers.length > 0) { + if (rule.description && rule.tagPending && rule.tagApproved && rule.tagRejected && rule.approvers.length > 0) { this.savingRule = true const req = { tagPending: rule.tagPending,