-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup_db.py
More file actions
23 lines (19 loc) · 790 Bytes
/
setup_db.py
File metadata and controls
23 lines (19 loc) · 790 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import os
import shutil
# Asegurarse de que el directorio instance existe
if not os.path.exists('instance'):
os.makedirs('instance')
# Copiar la base de datos vacía
src = os.path.join('db', 'empty.db')
dst = os.path.join('instance', 'commit_tracker.db') # Nombre corregido
if os.path.exists(src):
# Si ya existe una base de datos, preguntar antes de sobrescribir
if os.path.exists(dst):
response = input(f"Warning: {dst} already exists. Do you want to replace it? (y/N): ")
if response.lower() != 'y':
print("Operation cancelled.")
exit()
shutil.copy2(src, dst)
print(f"Database copied successfully from {src} to {dst}")
else:
print(f"Error: {src} not found. Please ensure the repository was cloned correctly.")