38 lines
1.1 KiB
Python
38 lines
1.1 KiB
Python
|
|
from app import create_app, db
|
||
|
|
from sqlalchemy import text
|
||
|
|
|
||
|
|
app = create_app()
|
||
|
|
|
||
|
|
with app.app_context():
|
||
|
|
# 检查alembic_version表结构
|
||
|
|
result = db.session.execute(text('DESCRIBE alembic_version'))
|
||
|
|
print("alembic_version表结构:")
|
||
|
|
for row in result.fetchall():
|
||
|
|
print(row)
|
||
|
|
|
||
|
|
# 检查当前版本
|
||
|
|
try:
|
||
|
|
result = db.session.execute(text('SELECT * FROM alembic_version'))
|
||
|
|
print("\n当前alembic版本:")
|
||
|
|
for row in result.fetchall():
|
||
|
|
print(row)
|
||
|
|
except Exception as e:
|
||
|
|
print(f"查询alembic_version表出错: {e}")
|
||
|
|
|
||
|
|
# 检查audit_log表结构
|
||
|
|
try:
|
||
|
|
result = db.session.execute(text('DESCRIBE audit_log'))
|
||
|
|
print("\naudit_log表结构:")
|
||
|
|
for row in result.fetchall():
|
||
|
|
print(row)
|
||
|
|
except Exception as e:
|
||
|
|
print(f"查询audit_log表结构出错: {e}")
|
||
|
|
|
||
|
|
# 检查device表结构
|
||
|
|
try:
|
||
|
|
result = db.session.execute(text('DESCRIBE device'))
|
||
|
|
print("\ndevice表结构:")
|
||
|
|
for row in result.fetchall():
|
||
|
|
print(row)
|
||
|
|
except Exception as e:
|
||
|
|
print(f"查询device表结构出错: {e}")
|