初次提交

This commit is contained in:
2025-10-14 20:05:29 +08:00
commit 6e4e48fdd2
673 changed files with 437006 additions and 0 deletions

51
backend/check_tables.py Normal file
View File

@@ -0,0 +1,51 @@
import pymysql
from app.core.config import settings
def check_user_login_table():
try:
# 解析连接字符串
import re
pattern = r'mysql\+pymysql://([^:]+):([^@]+)@([^:]+):(\d+)/(.+)'
match = re.match(pattern, settings.DATABASE_URL)
if match:
username, password, host, port, database = match.groups()
connection = pymysql.connect(
host=host,
port=int(port),
user=username,
password=password,
database=database,
charset='utf8mb4'
)
with connection.cursor() as cursor:
# 检查user_login表结构
print("=== user_login表结构 ===")
cursor.execute("DESCRIBE user_login")
columns = cursor.fetchall()
for column in columns:
print(f"{column[0]}: {column[1]} {column[2]} {column[3]} {column[4]}")
print("\n=== user_login表数据示例 ===")
cursor.execute("SELECT * FROM user_login LIMIT 3")
rows = cursor.fetchall()
for row in rows:
print(row)
print("\n=== 检查是否有用户相关的表 ===")
cursor.execute("SHOW TABLES LIKE '%user%'")
user_tables = cursor.fetchall()
for table in user_tables:
print(f"- {table[0]}")
connection.close()
return True
except Exception as e:
print(f"检查表结构失败: {str(e)}")
return False
if __name__ == "__main__":
check_user_login_table()