Initial commit: clean project structure
- Backend: FastAPI + SQLAlchemy + Celery (Python 3.11+) - Frontend: Vue 3 + TypeScript + Pinia + Tailwind - Admin Frontend: separate Vue 3 app for management - Docker Compose: 9 services orchestration - Specs: design prototypes, memory system PRD, product roadmap Cleanup performed: - Removed temporary debug scripts from backend root - Removed deprecated admin_app.py (embedded UI) - Removed duplicate docs from admin-frontend - Updated .gitignore for Vite cache and egg-info
This commit is contained in:
27
backend/scripts/add_config_column.py
Normal file
27
backend/scripts/add_config_column.py
Normal file
@@ -0,0 +1,27 @@
|
||||
import asyncio
|
||||
import os
|
||||
import sys
|
||||
|
||||
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
||||
|
||||
from app.db.database import async_engine
|
||||
from sqlalchemy import text
|
||||
|
||||
async def upgrade_db():
|
||||
print("🚀 Checking database schema...")
|
||||
async with async_engine.begin() as conn:
|
||||
# Check if column exists
|
||||
result = await conn.execute(text(
|
||||
"SELECT column_name FROM information_schema.columns WHERE table_name='providers' AND column_name='config_json';"
|
||||
))
|
||||
if result.scalar():
|
||||
print("✅ Column 'config_json' already exists.")
|
||||
else:
|
||||
print("⚠️ Column 'config_json' missing. Adding it now...")
|
||||
await conn.execute(text("ALTER TABLE providers ADD COLUMN config_json JSON;"))
|
||||
print("✅ Column 'config_json' added successfully.")
|
||||
|
||||
if __name__ == "__main__":
|
||||
if sys.platform == 'win32':
|
||||
asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())
|
||||
asyncio.run(upgrade_db())
|
||||
29
backend/scripts/fix_db_schema.py
Normal file
29
backend/scripts/fix_db_schema.py
Normal file
@@ -0,0 +1,29 @@
|
||||
import asyncio
|
||||
import os
|
||||
import sys
|
||||
|
||||
# Add backend to path
|
||||
sys.path.append(os.path.join(os.getcwd()))
|
||||
|
||||
from sqlalchemy import text
|
||||
from sqlalchemy.ext.asyncio import create_async_engine, async_sessionmaker, AsyncSession
|
||||
from app.core.config import settings
|
||||
|
||||
async def add_column():
|
||||
engine = create_async_engine(settings.database_url)
|
||||
async_session = async_sessionmaker(engine, expire_on_commit=False)
|
||||
async with async_session() as session:
|
||||
try:
|
||||
print("Adding config_json column to providers table...")
|
||||
await session.execute(text("ALTER TABLE providers ADD COLUMN IF NOT EXISTS config_json JSONB DEFAULT '{}'::jsonb"))
|
||||
await session.commit()
|
||||
print("Successfully added config_json column.")
|
||||
except Exception as e:
|
||||
print(f"Error adding column: {e}")
|
||||
await session.rollback()
|
||||
|
||||
if __name__ == "__main__":
|
||||
import asyncio
|
||||
if sys.platform == "win32":
|
||||
asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())
|
||||
asyncio.run(add_column())
|
||||
21
backend/scripts/manual_init_db.py
Normal file
21
backend/scripts/manual_init_db.py
Normal file
@@ -0,0 +1,21 @@
|
||||
import asyncio
|
||||
import sys
|
||||
import os
|
||||
|
||||
# Add backend to path
|
||||
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
||||
|
||||
from app.db.database import init_db
|
||||
from app.core.logging import setup_logging
|
||||
|
||||
async def main():
|
||||
setup_logging()
|
||||
print("Initializing database...")
|
||||
try:
|
||||
await init_db()
|
||||
print("Database initialized successfully.")
|
||||
except Exception as e:
|
||||
print(f"Error initializing database: {e}")
|
||||
|
||||
if __name__ == "__main__":
|
||||
asyncio.run(main())
|
||||
Reference in New Issue
Block a user