袁聪的第二次提交,项目已完整
This commit is contained in:
+10
-2
@@ -17,9 +17,17 @@ VERSIONS_DIR = ROOT / "alembic" / "versions"
|
||||
|
||||
def expected_tables() -> set[str]:
|
||||
text = SQL_FILE.read_text(encoding="utf-8")
|
||||
tables = set(re.findall(r"CREATE TABLE `?([A-Za-z0-9_]+)`?", text))
|
||||
tables = set(re.findall(
|
||||
r"CREATE TABLE\s+(?:IF NOT EXISTS\s+)?`?([A-Za-z0-9_]+)`?",
|
||||
text,
|
||||
flags=re.IGNORECASE,
|
||||
))
|
||||
for path in VERSIONS_DIR.glob("*.py"):
|
||||
tables.update(re.findall(r"CREATE TABLE `?([A-Za-z0-9_]+)`?", path.read_text(encoding="utf-8")))
|
||||
tables.update(re.findall(
|
||||
r"CREATE TABLE\s+(?:IF NOT EXISTS\s+)?`?([A-Za-z0-9_]+)`?",
|
||||
path.read_text(encoding="utf-8"),
|
||||
flags=re.IGNORECASE,
|
||||
))
|
||||
return tables
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user