def print_create_table(tables):
app.config.from_object('config.default')
database.init_app(app)
engine = database.session.get_bind()
for class_name in tables:
cls = get_class(class_name)
for c in cls.__table__.columns:
if not isinstance(c.type, Enum):
continue
t = c.type
sql = str(CreateEnumType(t).compile(engine))
click.echo(sql.strip() + ';')
for index in cls.__table__.indexes:
sql = str(CreateIndex(index).compile(engine))
click.echo(sql.strip() + ';')
sql = str(CreateTable(cls.__table__).compile(engine))
click.echo(sql.strip() + ';')
评论列表
文章目录