anchor.diff:          ?assertException(throw,{'ClientError',{"Unique index violation",{idx_meta_table_1,2,<<"table">>,"meta"}}}, insert(meta_table_1, {meta_table_1,"meta2",<<"table"/utf8>>,"1"})),
           ?assertEqual(2, length(read(meta_table_1))),
           ?assertEqual(2, length(read(idx_meta_table_1))),
  -        Idx3Def = #ddIdxDef{id=1,name= <<"json index on b1:b">>,type=ivk,pl=[<<"b1:b">>,<<"b1:c:a">>]},
  +        Idx3Def = #ddIdxDef{id=3,name= <<"json index on b1:b">>,type=ivk,pl=[<<"b1:b">>,<<"b1:c:a">>]},
           ?assertEqual(ok, create_or_replace_index(meta_table_1, [Idx3Def])),
           ?assertEqual(2, length(read(meta_table_1))),
           ?assertEqual(0, length(read(idx_meta_table_1))),
  -        JSON1 =  <<"{\"a\":\"Value-a\",\"b\":\"Value-b\",\"c\":{\"a\":\"Value-ca\",\"b\":\"Value-cb\"}}">>,
  +        JSON1 = <<
  +            "{"
  +                "\"a\":\"Value-a\","
  +                "\"b\":\"Value-b\","
  +                "\"c\":{"
  +                    "\"a\":\"Value-ca\","
  +                    "\"b\":\"Value-cb\""
  +                "}"
  +            "}"
  +                >>,
           % {
           %     "a": "Value-a",
           %     "b": "Value-b",
  
positive.code:                 ],
          ?assertEqual(PROP1,imem_json:decode(JSON1)),        
          ?assertEqual({meta_table_1,"json1",JSON1,"1"}, insert(meta_table_1, {meta_table_1,"json1",JSON1,"1"})),
          ?assertEqual([#ddIndex{stu={1, <<"value-b">>,"json1"}}
                       ,#ddIndex{stu={1, <<"value-ca">>,"json1"}}
                       ], read(idx_meta_table_1)),
  
          ?assertEqual(ok, create_table(meta_table_2, Types2, [])),
  
  
negative.code:             foldl(FoldFun, ok, Table)
      end.
  
  drop_index({Schema,Table}, Index) ->
      MySchema = schema(),
      case Schema of
          MySchema -> drop_index(Table, Index);
          _ ->        ?UnimplementedException({"Drop Index in foreign schema",{Schema,Table}})
      end;
  drop_index(Table, Index) when is_atom(Table) ->
      case read(ddTable,{schema(), Table}) of
          [#ddTable{}=D] ->
              case lists:keyfind(index, 1, D#ddTable.opts) of
                  {index, Indices} ->
                      {IndexToDrop, RestIndices} =
                      lists:foldl(
                        fun(I, {Drop, Rest}) ->
                                case Index of
                                    Index
                                      when is_binary(Index)
                                           andalso I#ddIdxDef.name =:= Index ->
                                        {I, Rest};
                                    Index
                                      when is_integer(Index)
                                           andalso I#ddIdxDef.id =:= Index ->
                                        {I, Rest};
                                    _ ->
                                        {Drop, [I|Rest]}
                                end
                        end
                        , {undefined, []}
                        , lists:reverse(Indices)),
                      case IndexToDrop of
                          undefined ->
                              ?ClientError({"Index does not exist for",Table,Index});
                          _ ->
                              if RestIndices =:= [] ->
                                     drop_index(Table);
                                 true ->
                                     create_or_replace_index(Table, RestIndices)
                              end
                      end;
                  false ->
                      drop_index(Table)
              end;
          [] ->
              ?ClientError({"Table dictionary does not exist for",Table})
      end.
  
  drop_index({Schema,Table}) ->
      MySchema = schema(),
      case Schema of
  