File size: 931 Bytes
b584a3f
 
 
 
 
 
 
 
6a23285
b584a3f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/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())