Files
Inf_Tec_Auto/init_database.py
2024-12-19 09:04:00 -08:00

22 lines
531 B
Python

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!")