Revision 5020
Added by Aaron Marcuse-Kubitza over 12 years ago
lib/sql.py | ||
---|---|---|
1145 | 1145 |
|
1146 | 1146 |
#### Columns |
1147 | 1147 |
|
1148 |
def add_col(db, table, col, comment=None, **kw_args): |
|
1148 |
def add_col(db, table, col, comment=None, if_not_exists=False, **kw_args):
|
|
1149 | 1149 |
''' |
1150 | 1150 |
@param col TypedCol Name may be versioned, so be sure to propagate any |
1151 | 1151 |
renaming back to any source column for the TypedCol. |
... | ... | |
1163 | 1163 |
run_query(db, str_, recover=True, cacheable=True, **kw_args) |
1164 | 1164 |
break |
1165 | 1165 |
except DuplicateException: |
1166 |
if if_not_exists: raise |
|
1166 | 1167 |
col.name = next_version(col.name) |
1167 | 1168 |
# try again with next version of name |
1168 | 1169 |
|
Also available in: Unified diff
sql.py: add_col(): Added if_not_exists param to abort if the column already exists rather than adding a version #