Revision 3031
Added by Aaron Marcuse-Kubitza over 12 years ago
lib/sql.py | ||
---|---|---|
1082 | 1082 |
table = col.table |
1083 | 1083 |
col = sql_gen.to_name_only_col(col) |
1084 | 1084 |
run_query(db, 'ALTER TABLE '+table.to_str(db)+' ALTER COLUMN ' |
1085 |
+col.to_str(db)+' SET NOT NULL', cacheable=True) |
|
1085 |
+col.to_str(db)+' SET NOT NULL', cacheable=True, log_level=3)
|
|
1086 | 1086 |
|
1087 | 1087 |
def add_index_col(db, col, suffix, expr, nullable=True): |
1088 | 1088 |
if sql_gen.index_col(col) != None: return # already has index col |
... | ... | |
1093 | 1093 |
while True: |
1094 | 1094 |
new_typed_col = sql_gen.TypedCol(new_col.name, db.col_info(col).type) |
1095 | 1095 |
try: |
1096 |
add_col(db, col.table, new_typed_col, |
|
1096 |
add_col(db, col.table, new_typed_col, log_level=3,
|
|
1097 | 1097 |
log_ignore_excs=(DuplicateException,)) |
1098 | 1098 |
break |
1099 | 1099 |
except DuplicateException: |
1100 | 1100 |
new_col.name = next_version(new_col.name) |
1101 | 1101 |
# try again with next version of name |
1102 | 1102 |
|
1103 |
update(db, col.table, [(new_col, expr)]) |
|
1103 |
update(db, col.table, [(new_col, expr)], log_level=3)
|
|
1104 | 1104 |
if not nullable: add_not_null(db, new_col) |
1105 | 1105 |
add_index(db, new_col) |
1106 | 1106 |
|
Also available in: Unified diff
add_index_col(): Run all operations with log_level=3 because it is the equivalent of creating an index, and that has log_level=3 to be excluded from the primary algorithm steps. add_not_null(): Run query with log_level=3 because it's an internal operation and for add_index_col() above.