chore: remove legacy tables and series table scripts
Build and Push Reader API Image / docker (push) Successful in 38s

- Removed mongoose dependency from package-lock.json.
- Deleted legacy import tables: ImportCandidateChapter, AssetNovelMapping, ImportJob, ImportSession, SourceAsset via new script `drop_legacy_import_tables.py`.
- Added script `drop_series_table.py` to drop the Series table.

Co-authored-by: Copilot <copilot@github.com>
This commit is contained in:
2026-05-04 19:43:22 +07:00
parent 1b1217ace2
commit 212d4df42f
6 changed files with 402 additions and 570 deletions
+35
View File
@@ -0,0 +1,35 @@
import os
from urllib.parse import parse_qsl, urlencode, urlsplit, urlunsplit
from dotenv import load_dotenv
from sqlalchemy import create_engine, text
def main() -> None:
load_dotenv()
database_url = os.getenv("DATABASE_URL")
if not database_url:
raise RuntimeError("DATABASE_URL missing")
parts = urlsplit(database_url)
filtered_query = [(k, v) for (k, v) in parse_qsl(parts.query, keep_blank_values=True) if k.lower() != "schema"]
normalized_url = urlunsplit((parts.scheme, parts.netloc, parts.path, urlencode(filtered_query), parts.fragment))
engine = create_engine(normalized_url)
tables = [
"ImportCandidateChapter",
"AssetNovelMapping",
"ImportJob",
"ImportSession",
"SourceAsset",
]
with engine.begin() as conn:
for table in tables:
conn.execute(text(f'DROP TABLE IF EXISTS "{table}" CASCADE'))
print("Dropped legacy tables")
if __name__ == "__main__":
main()