You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

18 lines
563 B

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

"""
创建股票基础数据相关表(使用 SQLAlchemy ORM兼容 SQLite 和 PostgreSQL
"""
from app.db.session import engine, SessionLocal
from app.db.base import Base
from app.models.stock_basic import StockBasic, IndexBasic, IndexTrade
def create_tables():
"""创建所有股票基础数据相关表"""
print("开始创建数据库表...")
Base.metadata.create_all(bind=engine)
print("数据库表创建完成")
print(f"创建的表: stock_basic, index_basic, index_trade")
if __name__ == "__main__":
create_tables()