Spaces:
Running
Running
| #!/usr/bin/env python3 | |
| from __future__ import annotations | |
| import argparse | |
| import sys | |
| from pathlib import Path | |
| sys.path.insert(0, str(Path(__file__).resolve().parent.parent)) | |
| from base_datos import iniciar_historial_usuario | |
| from config import HISTORY_DB_PATH | |
| def main() -> int: | |
| parser = argparse.ArgumentParser(description="Crea la BD SQLite con el esquema completo.") | |
| parser.add_argument( | |
| "--db-path", | |
| type=Path, | |
| default=HISTORY_DB_PATH, | |
| help=f"Ruta de la base de datos (por defecto: {HISTORY_DB_PATH})", | |
| ) | |
| args = parser.parse_args() | |
| db_path: Path = args.db_path.resolve() | |
| db_path.parent.mkdir(parents=True, exist_ok=True) | |
| iniciar_historial_usuario() | |
| print(f"BD creada/verificada: {db_path}") | |
| print("Tablas: Usuarios, Peliculas, Emociones, Historial_Peliculas, Ciclo_Recomendacion") | |
| return 0 | |
| if __name__ == "__main__": | |
| raise SystemExit(main()) | |