From c0c849047bdc3f2a1e1332c16d1de40f7bffc2b9 Mon Sep 17 00:00:00 2001 From: Sean Ang Date: Wed, 25 Sep 2019 18:43:33 +0800 Subject: [PATCH 1/2] Also rename nested column fields if they exist Just a thought, has not been tested throughly. --- utils/dbmaint.q | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/utils/dbmaint.q b/utils/dbmaint.q index d00d97c..79b8624 100644 --- a/utils/dbmaint.q +++ b/utils/dbmaint.q @@ -66,7 +66,10 @@ reordercols0:{[tabledir;neworder] rename1col:{[tabledir;oldname;newname] if[(oldname in ac)and not newname in ac:allcols tabledir; stdout"renaming ",(string oldname)," to ",(string newname)," in `",string tabledir; - .os.ren[` sv tabledir,oldname;` sv tabledir,newname];@[tabledir;`.d;:;.[ac;where ac=oldname;:;newname]]]} + .os.ren[` sv tabledir,oldname;` sv tabledir,newname]; + if[key ` sv tabledir,oldname1:`$(string oldname),"#"; + .os.ren[` sv tabledir,oldname1;` sv tabledir,`$(string newname),"#"]]; + @[tabledir;`.d;:;.[ac;where ac=oldname;:;newname]]]} ren1table:{[old;new]stdout"renaming ",(string old)," to ",string new;.os.ren[old;new];} From b2a20bcdc260711264c35ef59fa874df71d78925 Mon Sep 17 00:00:00 2001 From: Sean Ang Date: Wed, 8 Jan 2020 19:54:12 +0800 Subject: [PATCH 2/2] Fix boolean comparison on the enum map file --- utils/dbmaint.q | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/dbmaint.q b/utils/dbmaint.q index 79b8624..3944512 100644 --- a/utils/dbmaint.q +++ b/utils/dbmaint.q @@ -67,7 +67,7 @@ rename1col:{[tabledir;oldname;newname] if[(oldname in ac)and not newname in ac:allcols tabledir; stdout"renaming ",(string oldname)," to ",(string newname)," in `",string tabledir; .os.ren[` sv tabledir,oldname;` sv tabledir,newname]; - if[key ` sv tabledir,oldname1:`$(string oldname),"#"; + if[not ()~key ` sv tabledir,oldname1:`$(string oldname),"#"; .os.ren[` sv tabledir,oldname1;` sv tabledir,`$(string newname),"#"]]; @[tabledir;`.d;:;.[ac;where ac=oldname;:;newname]]]}