Browse Source

CDB: Fix crash on renaming column with reference on it

lviguier 9 months ago
parent
commit
fa4254bf03
1 changed files with 10 additions and 0 deletions
  1. 10 0
      hide/comp/cdb/Editor.hx

+ 10 - 0
hide/comp/cdb/Editor.hx

@@ -1823,6 +1823,16 @@ class Editor extends Component {
 			beginChanges(true);
 			var err;
 			if( col != null ) {
+				base.mapType(function(t) {
+					return switch( t ) {
+					case TRef(o) if( o.indexOf(col.name) >= 0 ):
+						TRef(StringTools.replace(o, col.name, c.name));
+					case TLayer(o) if( o.indexOf(col.name) >= 0 ):
+						TLayer(StringTools.replace(o, col.name, c.name));
+					default:
+						t;
+					}
+				});
 				var newPath = c.name;
 				var back = newPath.split("/");
 				var finalPart = back.pop();