mirror of
https://github.com/simonw/sqlite-utils.git
synced 2026-07-26 02:44:33 +02:00
add-column col_type now optional, defaults to str
This commit is contained in:
parent
557dc3f9a7
commit
3cab079d3e
6 changed files with 18 additions and 8 deletions
|
|
@ -276,7 +276,9 @@ class Table:
|
|||
self.db.conn.execute(sql)
|
||||
return self
|
||||
|
||||
def add_column(self, col_name, col_type):
|
||||
def add_column(self, col_name, col_type=None):
|
||||
if col_type is None:
|
||||
col_type = str
|
||||
sql = "ALTER TABLE [{table}] ADD COLUMN [{col_name}] {col_type};".format(
|
||||
table=self.name, col_name=col_name, col_type=COLUMN_TYPE_MAPPING[col_type]
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue