def add_column(self, table, name, coltype, **kwargs):
"""
Add the given column to the given table.
:param table: Table name to add column to.
:param name: Name of the column field to add.
:param coltype: Column type (from FIELD_TO_PEEWEE).
:param kwargs: Arguments for the given column type.
:return: None
"""
field_class = FIELD_TO_PEEWEE.get(coltype, peewee.CharField)
self.migrator.add_column(table, name, field_class(**kwargs)).run()
评论列表
文章目录