22 lines
531 B
Python
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!")
|