[Groonga-commit] groonga/gcs [master] Check field existence before run

Back to archive index

null+****@clear***** null+****@clear*****
2012年 8月 3日 (金) 18:54:34 JST


SHIMODA Hiroshi	2012-08-03 18:54:34 +0900 (Fri, 03 Aug 2012)

  New Revision: de66e5019cfc0285dddc5a676c60331cca105d0e
  https://github.com/groonga/gcs/commit/de66e5019cfc0285dddc5a676c60331cca105d0e

  Log:
    Check field existence before run

  Modified files:
    bin/cs-configure-fields

  Modified: bin/cs-configure-fields (+12 -4)
===================================================================
--- bin/cs-configure-fields    2012-08-03 18:52:17 +0900 (50138ad)
+++ bin/cs-configure-fields    2012-08-03 18:54:34 +0900 (f15744f)
@@ -40,17 +40,25 @@ if (!program.name) {
   console.log('You must specify the field name.');
   return false;
 }
-if (!program.type) {
-  console.log('You must specify the field type.');
-  return false;
-}
 
 var field = domain.getIndexField(program.name);
 
 if (program.delete) {
+  if (!field.exists()) {
+    console.log('You must specify an existing field.');
+    return false;
+  }
   field.deleteSync();
   console.log('Updated 1 Index Field:');
 } else {
+  if (!program.type) {
+    console.log('You must specify the field type.');
+    return false;
+  }
+  if (field.exists()) {
+    console.log('You must specify not-existing field name.');
+    return false;
+  }
   field.type = program.type;
   field.createSync();
   console.log('Updated 1 Index Field:');
-------------- next part --------------
HTML$B$NE:IU%U%!%$%k$rJ]4I$7$^$7$?(B...
下載 



Groonga-commit メーリングリストの案内
Back to archive index