Carregar ficheiros para "/"

This commit is contained in:
2024-12-19 09:04:00 -08:00
parent 39dbb95672
commit faa63ae8e5
5 changed files with 627 additions and 0 deletions

21
init_database.py Normal file
View File

@ -0,0 +1,21 @@
import os
from database import init_db, get_session
from models import Folder
def initialize_database():
# Remove existing database if it exists
if os.path.exists("automotive_docs.db"):
os.remove("automotive_docs.db")
# Create new database
engine = init_db()
# Create initial root folder
session = get_session()
root = Folder(name="Root")
session.add(root)
session.commit()
if __name__ == "__main__":
initialize_database()
print("Database initialized successfully!")