File tree Expand file tree Collapse file tree 1 file changed +14
-2
lines changed
Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -338,12 +338,24 @@ function setTableComment(self, newComment)
338338 self .alter(sprintf(' COMMENT="%s "' , newComment ));
339339 end
340340
341- function addAttribute(self , definition )
341+ function addAttribute(self , definition , after )
342342 % dj.Table/addAttribute - add a new attribute to the
343343 % table. A full line from the table definition is
344344 % passed in as "definition".
345+ %
346+ % The definition can specify where to place the new attribute.
347+ % Make after="FIRST" to add the attribute as the first
348+ % attribute or "AFTER `attr`" to place it after an existing
349+ % attribute.
350+ if nargin < 3
351+ after= ' ' ;
352+ else
353+ assert(strcmpi(after ,' FIRST' ) || strncmpi(after ,' AFTER' ,5 ))
354+ after = [' ' after ];
355+ end
356+
345357 sql = fieldToSQL(parseAttrDef(definition , false ));
346- self .alter(sprintf(' ADD COLUMN %s ' , sql(1 : end - 2 )));
358+ self .alter(sprintf(' ADD COLUMN %s%s ' , sql(1 : end - 2 ), after ));
347359 end
348360
349361 function dropAttribute(self , attrName )
You can’t perform that action at this time.
0 commit comments