Carregar ficheiros para "/"
This commit is contained in:
21
init_database.py
Normal file
21
init_database.py
Normal 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!")
|
||||
Reference in New Issue
Block a user